/* AMÉLIORATIONS CSS FORMULAIRE DE RECHERCHE */

/* ===== SEARCH BOX ENHANCED ===== */
.search-box {
    position: relative;
}

.search-box__field {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-box__field:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 168, 132, 0.2) !important;
    z-index: 10;
}

.search-box__field input:focus,
.search-box__field select:focus {
    box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.3);
}

/* Placeholder animation */
.search-box__field input::placeholder,
.search-box__field select::placeholder {
    transition: all 0.3s ease;
    opacity: 0.6;
}

.search-box__field input:focus::placeholder,
.search-box__field select:focus::placeholder {
    opacity: 0.3;
    transform: translateX(5px);
}

/* ===== VALIDATION STATES ===== */
.search-box__field.valid {
    border-left: 3px solid #00A884 !important;
}

.search-box__field.invalid {
    border-left: 3px solid #dc3545 !important;
    animation: shake 0.3s ease-in-out;
}

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

.search-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: slideDown 0.3s ease-out;
}

.search-error::before {
    content: '⚠';
}

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

/* ===== BUTTON STATES ===== */
.search-box__btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.search-box__btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: scale(0.98);
}

.search-box__btn svg {
    animation: spin 1s linear infinite;
}

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

/* Ripple effect on click */
.search-box__btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.search-box__btn:active::after {
    width: 300px;
    height: 300px;
}

/* ===== CLEAR BUTTON ===== */
.search-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
    z-index: 5;
}

.search-clear-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.search-clear-btn:active {
    transform: translateY(-50%) scale(0.9);
}

/* ===== RECENT SEARCHES ===== */
.recent-searches {
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.recent-searches button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.recent-searches button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.recent-searches button:active {
    transform: translateY(0) scale(0.98);
}

/* ===== AUTOCOMPLETE ENHANCED ===== */
.search-box__autocomplete {
    animation: slideDown 0.3s ease-out;
    backdrop-filter: blur(10px);
}

.autocomplete-item {
    transition: all 0.2s ease;
    position: relative;
}

.autocomplete-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: #00A884;
    transition: width 0.2s ease;
}

.autocomplete-item:hover::before {
    width: 3px;
}

.autocomplete-item:hover {
    background: linear-gradient(90deg, rgba(0, 168, 132, 0.1) 0%, transparent 100%);
    padding-left: 20px;
}

.autocomplete-item.selected {
    background: rgba(0, 168, 132, 0.15);
    border-left: 3px solid #00A884;
}

/* ===== POPULAR SEARCHES ===== */
.search-extras__link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.search-extras__link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.search-extras__link:hover::before {
    left: 100%;
}

.search-extras__link:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ===== LOADING SKELETON ===== */
@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

.search-box__field.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 468px 100%;
    animation: shimmer 1.2s ease-in-out infinite;
}

/* ===== TOOLTIPS ===== */
.search-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 100;
}

.search-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

.search-box__field:hover .search-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-12px);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .search-box__field {
        min-width: 100% !important;
    }

    .search-clear-btn {
        width: 24px;
        height: 24px;
        font-size: 16px;
    }

    .recent-searches button {
        font-size: 12px;
        padding: 6px 12px;
    }

    .search-error {
        font-size: 11px;
    }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .search-box__autocomplete {
        background: #2d2d2d;
        color: #f5f5f5;
    }

    .autocomplete-item:hover {
        background: linear-gradient(90deg, rgba(0, 168, 132, 0.2) 0%, transparent 100%);
    }

    .search-error {
        color: #ff6b6b;
    }
}

/* ===== FOCUS VISIBLE (ACCESSIBILITY) ===== */
.search-box__field input:focus-visible,
.search-box__field select:focus-visible {
    outline: 2px solid #00A884;
    outline-offset: 2px;
}

.search-box__btn:focus-visible {
    outline: 2px solid #FFB700;
    outline-offset: 2px;
}

/* ===== PRINT ===== */
@media print {
    .search-box,
    .recent-searches,
    .search-extras {
        display: none;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .search-box__field {
        border: 2px solid currentColor;
    }

    .search-error {
        font-weight: bold;
        border-left: 3px solid #dc3545;
        padding-left: 8px;
    }
}

/* ===== CHAR COUNTER ===== */
.char-counter {
    position: absolute;
    bottom: 4px;
    right: 12px;
    font-size: 10px;
    color: #999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-box__field input:focus ~ .char-counter {
    opacity: 1;
}
