/* ================================================
   SECURE FORM STYLING & SECURITY ENHANCEMENTS
   ================================================ */

/* Form Security States */
.contact-form .form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.contact-form .form-control.is-valid {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Loading State Animations */
.btn-loading {
    transition: all 0.3s ease;
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Form Message Styling */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Enhanced Form Styling */
.contact-form .form-control {
    transition: all 0.3s ease;
    border: 2px solid #e0e0e0;
    padding: 12px 16px;
    font-size: 16px;
    background-color: #fff;
}

.contact-form .form-control:focus {
    border-color: #1F8A70;
    box-shadow: 0 0 0 0.2rem rgba(31, 138, 112, 0.25);
    outline: none;
}

.contact-form .form-control::placeholder {
    color: #6c757d;
    opacity: 0.8;
}

/* Submit Button Enhanced States */
.theme-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.theme-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.theme-btn:disabled:hover {
    transform: none !important;
}

/* Security Visual Indicators */
.security-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 8px;
}

.security-indicator.secure {
    background-color: #28a745;
}

.security-indicator.warning {
    background-color: #ffc107;
}

.security-indicator.danger {
    background-color: #dc3545;
}

/* CSRF Token Status (for debugging - remove in production) */
.csrf-debug {
    font-size: 10px;
    color: #6c757d;
    opacity: 0.5;
}

/* Rate Limiting Warning */
.rate-limit-warning {
    background: linear-gradient(45deg, #ff6b6b, #ffa500);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 15px;
    animation: pulse 2s infinite;
}

/* Honeypot Hidden Field Protection */
input[name="website_url"] {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Mobile Responsiveness for Forms */
@media (max-width: 768px) {
    .contact-form-wrapper {
        padding: 20px 15px !important;
    }
    
    .contact-form .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px 16px;
    }
    
    .theme-btn {
        width: 100%;
        justify-content: center;
    }
    
    .alert {
        font-size: 13px;
        padding: 10px 12px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .contact-form .form-control {
        border-width: 3px;
    }
    
    .contact-form .form-control:focus {
        border-color: #000;
        box-shadow: 0 0 0 3px #000;
    }
    
    .alert {
        border-width: 2px;
        font-weight: bold;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .contact-form .form-control,
    .theme-btn,
    .btn-loading,
    .alert {
        transition: none;
    }
    
    .fa-spinner {
        animation: none;
    }
    
    .rate-limit-warning {
        animation: none;
    }
}

/* Dark Mode Support (if implemented) */
@media (prefers-color-scheme: dark) {
    .contact-form .form-control {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .contact-form .form-control::placeholder {
        color: #a0aec0;
    }
    
    .contact-form .form-control:focus {
        border-color: #68d391;
        box-shadow: 0 0 0 0.2rem rgba(104, 211, 145, 0.25);
    }
    
    .alert-success {
        background-color: #2d5a3d;
        border-color: #38a169;
        color: #c6f6d5;
    }
    
    .alert-danger {
        background-color: #5a2d2d;
        border-color: #e53e3e;
        color: #fed7d7;
    }
}

/* Print Styles */
@media print {
    .contact-form,
    .theme-btn,
    .alert {
        display: none !important;
    }
}

/* Focus Visible for Better Accessibility */
.contact-form .form-control:focus-visible {
    outline: 2px solid #1F8A70;
    outline-offset: 2px;
}

.theme-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Form Validation Messages */
.form-feedback {
    display: block;
    width: 100%;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.3;
}

.form-feedback.invalid-feedback {
    color: #dc3545;
}

.form-feedback.valid-feedback {
    color: #28a745;
}

/* Character Counter for Textarea */
.char-counter {
    font-size: 11px;
    color: #6c757d;
    text-align: right;
    margin-top: 4px;
}

.char-counter.warning {
    color: #ffc107;
}

.char-counter.danger {
    color: #dc3545;
}

/* Form Header with Security Badge */
.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.security-badge {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #28a745;
}

.security-badge i {
    margin-right: 4px;
}

/* Enhanced Button States */
.theme-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(31, 138, 112, 0.3);
}

.theme-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(31, 138, 112, 0.2);
}

/* Success Animation */
@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.form-success {
    animation: successPulse 0.6s ease-out;
}