/**
 * Villa Maila Contact Form Styles
 * Enhanced styles for form validation and user feedback
 */

/* Form Messages */
.form-message {
    padding: 15px 20px;
    margin-bottom: 25px;
    border-radius: 4px;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

.form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Field Validation Styles */
.contact-form input.error,
.contact-form textarea.error {
    border-bottom-color: #dc3545 !important;
    background-color: #fff5f5;
    animation: shake 0.5s ease-in-out;
}

.field-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: block;
    animation: fadeIn 0.3s ease-in;
}

/* Checkbox Validation Styles */
.privacy-checkbox.error .checkmark {
    border-color: #dc3545 !important;
    background-color: #fff5f5;
    animation: shake 0.5s ease-in-out;
}

.checkbox-error {
    margin-top: 8px;
    padding-left: 32px;
}

/* Loading State */
.submit-btn.loading {
    position: relative;
    color: transparent !important;
}

.submit-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Enhanced Form Styles */
.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-bottom-color: #cca558 !important;
    background-color: #fffaf0;
    transition: all 0.3s ease;
}

.contact-form input.valid,
.contact-form textarea.valid {
    border-bottom-color: #28a745 !important;
}

/* Phone Number Formatting */
#phone {
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* Message Character Counter */
.message-counter {
    text-align: right;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.message-counter.warning {
    color: #ffc107;
}

.message-counter.error {
    color: #dc3545;
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .form-message {
        padding: 12px 15px;
        margin: 0 20px 20px 20px;
        font-size: 14px;
    }
    
    .field-error {
        font-size: 11px;
    }
    
    .contact-form input,
    .contact-form textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Accessibility Improvements */
.contact-form input:focus,
.contact-form textarea:focus,
.contact-form button:focus {
    outline: 2px solid #cca558;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .form-message.success {
        background: #000;
        color: #fff;
        border: 2px solid #0f0;
    }
    
    .form-message.error {
        background: #000;
        color: #fff;
        border: 2px solid #f00;
    }
    
    .field-error {
        color: #f00;
        font-weight: bold;
    }
}

/* Print Styles */
@media print {
    .form-message,
    .field-error,
    .submit-btn {
        display: none !important;
    }
    
    .contact-form input,
    .contact-form textarea {
        border: 1px solid #000 !important;
        background: transparent !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .form-message.success {
        background: #1e4d2b;
        color: #d4edda;
        border-color: #28a745;
    }
    
    .form-message.error {
        background: #4d1e1e;
        color: #f8d7da;
        border-color: #dc3545;
    }
    
    .field-error {
        color: #ff6b6b;
    }
}
