/* Appointment Booking Form Validation Styles */

/* Form validation states */
.form-field {
    position: relative;
    margin-bottom: 1rem;
}

.form-field input,
.form-field select,
.form-field textarea {
    transition: all 0.3s ease;
}

/* Error states */
.form-field input.border-red-500,
.form-field select.border-red-500,
.form-field textarea.border-red-500 {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-field input:focus.border-red-500,
.form-field select:focus.border-red-500,
.form-field textarea:focus.border-red-500 {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
    outline: none;
}

/* Success states */
.form-field input.border-green-500,
.form-field select.border-green-500,
.form-field textarea.border-green-500 {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-field input:focus.border-green-500,
.form-field select:focus.border-green-500,
.form-field textarea:focus.border-green-500 {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    outline: none;
}

/* Error messages */
.field-error {
    display: flex;
    align-items: center;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #ef4444;
    animation: slideDown 0.3s ease;
}

.field-error i {
    margin-right: 0.25rem;
    flex-shrink: 0;
}

/* Global error messages */
.global-error {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    color: #dc2626;
    animation: slideDown 0.3s ease;
}

.global-error i {
    margin-right: 0.5rem;
    flex-shrink: 0;
}

/* Success messages */
.field-success {
    display: flex;
    align-items: center;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #10b981;
    animation: slideDown 0.3s ease;
}

.field-success i {
    margin-right: 0.25rem;
    flex-shrink: 0;
}

/* Loading states */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #f3f4f6;
    border-radius: 50%;
    border-top-color: #01493b;
    animation: spin 1s ease-in-out infinite;
}

/* Form section error states */
.section-error {
    border: 2px solid #ef4444 !important;
    background-color: #fef2f2 !important;
    animation: shake 0.5s ease;
}

/* Phone number input specific styles */
.phone-input-container {
    position: relative;
}

.phone-input-container .country-flag {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1rem;
    background-color: #10b981;
    border-radius: 0.125rem;
    margin-right: 0.5rem;
}

.phone-input-container input {
    padding-left: 3rem;
}

/* Terms checkbox validation */
.terms-checkbox-container {
    position: relative;
}

.terms-checkbox-container.error {
    border: 2px solid #ef4444;
    background-color: #fef2f2;
    border-radius: 0.5rem;
    padding: 0.75rem;
    animation: shake 0.5s ease;
}

.terms-checkbox-container.error label {
    color: #dc2626;
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Focus states for better accessibility */
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

/* Required field indicators */
.required-field::after {
    content: ' *';
    color: #ef4444;
    font-weight: bold;
}

/* Validation summary */
.validation-summary {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease;
}

/* Form error container */
#formErrorsContainer {
    transition: all 0.3s ease;
}

#formErrorsContainer.hidden {
    opacity: 0;
    transform: translateY(-10px);
}

#formErrorsContainer:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}

.validation-summary h3 {
    color: #dc2626;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.validation-summary ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.validation-summary li {
    color: #dc2626;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
}

.validation-summary li::before {
    content: '•';
    margin-right: 0.5rem;
    font-weight: bold;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .field-error,
    .field-success {
        font-size: 0.75rem;
    }
    
    .global-error {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .loading-overlay {
        padding: 1rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-field input.border-red-500,
    .form-field select.border-red-500,
    .form-field textarea.border-red-500 {
        border-width: 2px;
    }
    
    .field-error,
    .global-error {
        font-weight: 600;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .field-error,
    .field-success,
    .global-error,
    .section-error {
        animation: none;
    }
    
    .loading-spinner {
        animation: none;
    }
}

/* Print styles */
@media print {
    .field-error,
    .field-success,
    .global-error,
    .loading-overlay {
        display: none;
    }
}
