/*
 * Modern Form Animation Styles
 * Enhanced animations and micro-interactions for booking forms
 */

/* Field Animation Keyframes */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes checkmarkDraw {
    0% {
        stroke-dashoffset: 16;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* Enhanced Field States */
.form-field-wrapper.shake {
    animation: shake 0.5s ease-in-out;
}

.form-field-wrapper.highlight {
    animation: pulse 0.6s ease-in-out;
}

/* Enhanced Error States */
.form-field-wrapper.error {
    position: relative;
}

.form-field-wrapper.error .form-control {
    border-color: #e53e3e;
    background-color: #ffeaea;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.form-field-wrapper.error .field-label {
    color: #e53e3e;
}

.form-field-wrapper.success .form-control {
    border-color: #38a169;
    background-color: #f0fff4;
    box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.1);
}

.form-field-wrapper.success .field-label {
    color: #38a169;
}

/* Modern validation messages */
.form-field-wrapper .validation-message {
    position: absolute;
    bottom: -25px;
    left: 0;
    right: 0;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    display: none;
    z-index: 10;
}

.form-field-wrapper .validation-message.show {
    display: block;
    animation: slideInRight 0.3s ease-out;
}

.form-field-wrapper .validation-message.error {
    background: linear-gradient(135deg, #fed7d7, #feb2b2);
    color: #742a2a;
    border: 1px solid #fc8181;
}

.form-field-wrapper .validation-message.success {
    background: linear-gradient(135deg, #c6f6d5, #9ae6b4);
    color: #22543d;
    border: 1px solid #68d391;
}

/* Error icon indicators */
.form-field-wrapper.error::after {
    content: "⚠";
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    color: #e53e3e;
    font-size: 16px;
    pointer-events: none;
    z-index: 5;
}

.form-field-wrapper.success::after {
    content: "✓";
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    color: #38a169;
    font-size: 16px;
    font-weight: bold;
    pointer-events: none;
    z-index: 5;
}

.form-field-wrapper .success-checkmark {
    animation: bounceIn 0.5s ease-out;
}

/* Radio and Checkbox Enhancements */
.radio-option.selected,
.checkbox-option.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.radio-option input[type="radio"]:checked,
.checkbox-option input[type="checkbox"]:checked {
    accent-color: #667eea;
}

/* Custom Radio Button Styling */
.radio-option input[type="radio"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option input[type="radio"]:checked {
    border-color: #667eea;
    background: #667eea;
}

.radio-option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* Custom Checkbox Styling */
.checkbox-option input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    margin-right: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkbox-option input[type="checkbox"]:checked {
    border-color: #667eea;
    background: #667eea;
}

.checkbox-option input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Select Enhancement */
.form-control.has-value {
    color: #2d3748;
    font-weight: 500;
}

/* File Upload Styling */
.file-info {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 6px;
    font-size: 14px;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.form-control[type="file"].has-value {
    border-color: #38a169;
    background: #f0fff4;
}

/* Loading States */
.form-field-wrapper.loading {
    opacity: 0.6;
    pointer-events: none;
}

.form-field-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Progress Bar Enhancements */
.progress-fill {
    background: linear-gradient(90deg, #667eea, #764ba2);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Button Hover Effects */
.primary-btn {
    position: relative;
    overflow: hidden;
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s;
}

.primary-btn:hover::before {
    left: 100%;
}

/* Form Completion Animation */
.booking-form.completed {
    animation: completePulse 0.8s ease-out;
}

@keyframes completePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Success State */
.form-field-wrapper.success .field-container {
    animation: slideInRight 0.5s ease-out;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .radio-option,
    .checkbox-option {
        padding: 16px;
        margin-bottom: 8px;
    }
    
    .help-tooltip {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: 280px;
        z-index: 10000;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    }
    
    .help-tooltip::before {
        content: '';
        position: absolute;
        top: -8px;
        left: 50%;
        transform: translateX(-50%);
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        border-bottom: 8px solid #2d3748;
    }
}

/* Focus States */
.form-control:focus,
.radio-option:focus-within,
.checkbox-option:focus-within {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .modern-booking-form {
        background: #1a202c;
        border-color: #2d3748;
        color: #e2e8f0;
    }
    
    .form-control {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .form-control:focus {
        border-color: #667eea;
        background: #2d3748;
    }
    
    .field-label {
        color: #e2e8f0;
    }
    
    .radio-option,
    .checkbox-option {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .radio-option:hover,
    .checkbox-option:hover {
        background: #374151;
    }
}