/**
 * Contact Form Styles
 * Validation feedback, custom dropdown, and animations.
 * Loaded globally so styles survive AJAX page transitions.
 */

/* Validation Styles - High Specificity */
#contact-form .form-input-group.success input,
#contact-form .form-input-group.success textarea,
#contact-form .form-input-group.success select,
#contact-form .form-input-group.success .custom-select-trigger {
    border-color: #10b981 !important;
    background-color: #f0fdf4 !important;
}
.dark #contact-form .form-input-group.success input,
.dark #contact-form .form-input-group.success textarea,
.dark #contact-form .form-input-group.success select,
.dark #contact-form .form-input-group.success .custom-select-trigger {
    background-color: rgba(6, 78, 59, 0.5) !important;
    border-color: #059669 !important;
}

#contact-form .form-input-group.error input,
#contact-form .form-input-group.error textarea,
#contact-form .form-input-group.error select,
#contact-form .form-input-group.error .custom-select-trigger {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}
.dark #contact-form .form-input-group.error input,
.dark #contact-form .form-input-group.error textarea,
.dark #contact-form .form-input-group.error select,
.dark #contact-form .form-input-group.error .custom-select-trigger {
    background-color: rgba(127, 29, 29, 0.5) !important;
    border-color: #dc2626 !important;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Custom Dropdown Styles */
.custom-select-dropdown {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05);
}

.dark .custom-select-dropdown {
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Scrollbar styling */
.custom-select-options::-webkit-scrollbar {
    width: 6px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: transparent;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.dark .custom-select-options::-webkit-scrollbar-thumb {
    background: #475569;
}

/* Option hover animation */
.dropdown-option {
    position: relative;
    overflow: hidden;
}

.dropdown-option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, #06b6d4, #10b981);
    transform: scaleY(0);
    transition: transform 0.2s ease;
    border-radius: 0 3px 3px 0;
}

.dropdown-option:hover::before,
.dropdown-option.selected-option::before {
    transform: scaleY(1);
}

/* Selected option pulse animation */
@keyframes selectPulse {
    0% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(6, 182, 212, 0); }
    100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
}

.custom-select-trigger.selecting {
    animation: selectPulse 0.4s ease-out;
}

/* Option icon bounce on hover */
.dropdown-option:hover .option-icon {
    animation: iconBounce 0.4s ease;
}

@keyframes iconBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Staggered animation for options */
.dropdown-option {
    opacity: 0;
    animation: optionFadeIn 0.3s ease forwards;
}

.dropdown-option:nth-child(1) { animation-delay: 0.02s; }
.dropdown-option:nth-child(2) { animation-delay: 0.04s; }
.dropdown-option:nth-child(3) { animation-delay: 0.06s; }
.dropdown-option:nth-child(4) { animation-delay: 0.08s; }
.dropdown-option:nth-child(5) { animation-delay: 0.10s; }
.dropdown-option:nth-child(6) { animation-delay: 0.12s; }
.dropdown-option:nth-child(7) { animation-delay: 0.14s; }

@keyframes optionFadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Search input focus glow */
#dropdown-search:focus {
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

/* Arrow rotation transition */
.custom-select-arrow {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Selected state badge animation */
.selected-icon {
    animation: badgePop 0.3s ease;
}

@keyframes badgePop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Focus visible outline for accessibility */
.custom-select-trigger:focus-visible {
    outline: 2px solid #06b6d4;
    outline-offset: 2px;
}

/* Gradient border effect on hover */
.custom-select-trigger {
    position: relative;
    background-clip: padding-box;
}

.custom-select-trigger:hover {
    border-color: transparent;
    background-image: linear-gradient(#f8fafc, #f8fafc), 
                      linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

.dark .custom-select-trigger:hover {
    background-image: linear-gradient(#1e293b, #1e293b), 
                      linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
}
