﻿/* ============================================================================
   SEARCH SECTION - Enhanced Glassmorphism Design
   ============================================================================ */

.search-section {
    padding: 16px 10px 20px 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 100%);
    backdrop-filter: blur(25px) saturate(190%);
    -webkit-backdrop-filter: blur(25px) saturate(190%);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: sticky;
    top: 0;
    z-index: 101;
    will-change: transform, padding, box-shadow;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.search-section.sticky {
    padding: 20px 24px 14px 24px;
    top: 0;
    transform: translateY(-95px);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.header.scrolled .search-section.sticky {
    transform: translateY(-77px);
}

.search-container {
    position: relative;
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
    max-width: 100%;
}

.search-input-wrapper {
    position: relative;
    box-shadow: 0 14px 48px rgba(0, 0, 0, 0.08),
                0 7px 24px rgba(0, 0, 0, 0.05),
                inset 0 2px 2px rgba(255, 255, 255, 0.9),
                inset 0 -2px 2px rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(250, 250, 250, 0.7) 100%);
    backdrop-filter: blur(35px) saturate(210%);
    -webkit-backdrop-filter: blur(35px) saturate(210%);
    border-radius: 22px;
    padding: 8px 16px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    width: 100%;
    overflow: visible; /* must NOT be hidden — dropdown escapes below the pill */
}

.search-input-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1.5px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.2));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.search-input-wrapper:focus-within {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 18px 52px rgba(17, 17, 26, 0.15),
                0 12px 36px rgba(0, 0, 0, 0.08),
                inset 0 2px 2px rgba(255, 255, 255, 0.95);
    transform: translateY(-4px);
    backdrop-filter: blur(45px) saturate(230%);
    -webkit-backdrop-filter: blur(45px) saturate(230%);
}

.search-input-wrapper:focus-within::before {
    opacity: 1;
}

.search-section.sticky .search-input-wrapper {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.65) 100%);
    backdrop-filter: blur(40px) saturate(220%);
    -webkit-backdrop-filter: blur(40px) saturate(220%);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    border-radius: 14px;
    transition: all 0.3s ease;
    z-index: 0;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.12), inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

.search-section.sticky .search-input-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1.5px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.2));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.search-section.sticky .search-input-wrapper:focus-within::before {
    opacity: 0.8;
}

.search-section.sticky .search-input-wrapper:focus-within {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12),
                0 8px 24px rgba(0, 0, 0, 0.06),
                inset 0 1px 1px rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
}

.search-icon {
    margin-right: 12px;
    color: #c2cfdd;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.search-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.5;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 0px 0px rgba(0,0,0,0));
}

.search-input-wrapper:focus-within .search-icon {
    color: #FF6B35;
    transform: scale(1.25) rotate(-10deg);
    filter: drop-shadow(0 4px 12px rgba(255, 107, 53, 0.4));
}

.search-input-wrapper:focus-within .search-icon svg {
    stroke: #FF6B35;
    filter: drop-shadow(0 3px 10px rgba(255, 107, 53, 0.5));
}

.search-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 16px;
    color: #1a202c;
    outline: none;
    font-family: inherit;
    font-weight: 500;
    min-width: 0;
    width: 100%;
    letter-spacing: 0.3px;
}

.search-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
    letter-spacing: 0.2px;
}

/* Voice Controls Wrapper */
.voice-controls-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 6px;
}

/* Voice Search Button */
.voice-search-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.5) 100%);
    backdrop-filter: blur(25px) saturate(190%);
    -webkit-backdrop-filter: blur(25px) saturate(190%);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 16px;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08),
                0 4px 12px rgba(0, 0, 0, 0.04),
                inset 0 2px 2px rgba(255, 255, 255, 0.8);
    position: relative;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    z-index: 10;
    pointer-events: auto;
}

.voice-search-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1.5px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.15));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.voice-search-btn:hover::before {
    opacity: 1;
}

.voice-search-btn svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.4;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 2;
    pointer-events: auto;
}

.voice-search-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.75) 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    color: #FF6B35;
    transform: scale(1.15) translateY(-3px);
    box-shadow: 0 12px 32px rgba(255, 107, 53, 0.15),
                0 6px 16px rgba(255, 107, 53, 0.08),
                inset 0 2px 2px rgba(255, 255, 255, 0.9);
}

.voice-search-btn:hover svg {
    stroke: #FF6B35;
    filter: drop-shadow(0 3px 10px rgba(255, 107, 53, 0.4));
}

.voice-search-btn.listening {
    background: radial-gradient(circle at center, #ff4b5c 0%, #d63031 70%);
    color: white;
    box-shadow: 0 0 25px rgba(255, 71, 87, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: scale(1.15);
    animation: mic-breath 1.4s ease-in-out infinite;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.voice-search-btn.listening::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,71,87,0.6) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
    opacity: 0;
    animation: mic-glow 1.5s ease-in-out infinite;
}

.voice-search-btn.listening svg {
    stroke: white;
    filter: drop-shadow(0 0 6px rgba(255,255,255,0.8));
    z-index: 1;
}

@keyframes mic-breath {
    0% {
        transform: scale(1.1);
        box-shadow: 0 0 15px rgba(255, 71, 87, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        transform: scale(1.25);
        box-shadow: 0 0 30px rgba(255, 71, 87, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    100% {
        transform: scale(1.1);
        box-shadow: 0 0 15px rgba(255, 71, 87, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
}

@keyframes mic-glow {
    0% {
        opacity: 0.2;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.3);
    }
    100% {
        opacity: 0.2;
        transform: scale(1);
    }
}

/* Language Selector */
.language-selector-compact {
    position: relative;
    flex-shrink: 0;
    pointer-events: auto;
}

.current-language {
    width: 42px;
    height: 42px;
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.5) 100%);
    backdrop-filter: blur(25px) saturate(190%);
    -webkit-backdrop-filter: blur(25px) saturate(190%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08),
                0 4px 12px rgba(0, 0, 0, 0.04),
                inset 0 2px 2px rgba(255, 255, 255, 0.8);
    position: relative;
    flex-shrink: 0;
    z-index: 10;
    pointer-events: auto;
}

.current-language::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1.5px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.15));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.current-language:hover::before {
    opacity: 1;
}

.current-language:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.75) 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    transform: translateY(-3px) scale(1.12);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08),
                0 6px 16px rgba(0, 0, 0, 0.04),
                inset 0 2px 2px rgba(255, 255, 255, 0.9);
}

.current-language:active {
    transform: translateY(0) scale(1);
}

.current-language::after {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #FF6B35, #FF8C42);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.6);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.current-language:hover::after {
    transform: scale(1.25);
    box-shadow: 0 3px 12px rgba(255, 107, 53, 0.8);
}

.lang-flag {
    font-size: 18px;
    line-height: 1;
    pointer-events: auto;
    z-index: 2;
}

/* Language Dropdown — position/top/right are set by JS (fixed coords) so no !important here */
.language-dropdown {
    position: absolute;   /* JS overrides to fixed on open */
    right: 0;             /* JS overrides to viewport-relative px */
    top: calc(100% + 12px); /* JS overrides to viewport-relative px */
    z-index: 999999999 !important;
    background: rgba(255, 255, 255, 0.97) !important;
    backdrop-filter: blur(70px) saturate(230%) !important;
    -webkit-backdrop-filter: blur(70px) saturate(230%) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.15),
                0 12px 32px rgba(0, 0, 0, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
    padding: 12px;
    min-width: 170px;
    max-width: 210px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-16px) scale(0.92);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.language-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 14px;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(60px) saturate(220%);
    -webkit-backdrop-filter: blur(60px) saturate(220%);
    transform: rotate(45deg);
    border-top: 1.5px solid rgba(255, 255, 255, 0.4);
    border-left: 1.5px solid rgba(255, 255, 255, 0.4);
}

.language-selector-compact.open .language-dropdown {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 15px;
    border: none;
    background: transparent;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: left;
    position: relative;
    animation: slideInLang 0.2s ease backwards;
    pointer-events: auto;
    z-index: 1;
}

.lang-option:nth-child(1) {
    animation-delay: 0.05s;
}

.lang-option:nth-child(2) {
    animation-delay: 0.1s;
}

.lang-option:nth-child(3) {
    animation-delay: 0.15s;
}

.lang-option:nth-child(4) {
    animation-delay: 0.2s;
}

.lang-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
    opacity: 0;
    transition: opacity 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 14px;
    z-index: 0;
}

.lang-option:hover::before {
    opacity: 1;
}

.lang-option:hover {
    transform: translateX(8px) translateY(-2px);
    background: rgba(255, 255, 255, 0.2);
}

.lang-option.active {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.92), rgba(255, 140, 66, 0.92));
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    color: white;
    font-weight: 600;
    box-shadow: 0 10px 28px rgba(255, 107, 53, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.lang-option.active .lang-name {
    color: white;
}

.lang-option .lang-flag {
    font-size: 20px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.lang-name {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    flex: 1;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

@keyframes slideInLang {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.language-dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    display: none;
}

.language-dropdown-overlay.active {
    display: block;
}

/* ============================================================================
   RESPONSIVE BREAKPOINTS
   ============================================================================ */

@media (max-width: 1024px) {
    .search-section {
        padding: 14px 16px 18px 16px;
    }
    .search-section.sticky {
        padding: 18px 20px 12px 20px;
    }
}

@media (max-width: 768px) {
    .search-section {
        padding: 12px 12px 16px 12px;
    }
    .search-section.sticky {
        padding: 16px 16px 10px 16px;
    }
    .search-input-wrapper {
        padding: 4px 10px;
        border-radius: 16px;
    }
    .search-icon {
        margin-right: 10px;
    }
    .search-icon svg {
        width: 20px;
        height: 20px;
    }
    .voice-controls-wrapper {
        gap: 5px;
        margin-left: 5px;
    }
    .current-language,
    .voice-search-btn {
        width: 38px;
        height: 38px;
    }
    .voice-search-btn svg {
        width: 20px;
        height: 20px;
    }
    .lang-flag {
        font-size: 17px;
    }
    .language-dropdown {
        min-width: 150px;
    }
}

@media (max-width: 640px) {
    .search-section {
        padding: 10px 10px 14px 10px;
    }
    .search-section.sticky {
        padding: 14px 14px 8px 14px;
    }
    .search-input-wrapper {
        padding: 3px 8px;
        border-radius: 14px;
        border-width: 1.5px;
    }
    .search-icon {
        margin-right: 8px;
    }
    .search-icon svg {
        width: 18px;
        height: 18px;
    }
    .search-input {
        font-size: 15px;
    }
    .voice-controls-wrapper {
        gap: 4px;
        margin-left: 4px;
    }
    .current-language,
    .voice-search-btn {
        width: 36px;
        height: 36px;
    }
    .voice-search-btn svg {
        width: 18px;
        height: 18px;
    }
    .lang-flag {
        font-size: 16px;
    }
    .current-language::after {
        width: 7px;
        height: 7px;
    }
    .language-dropdown {
        min-width: 145px;
        right: -5px;
    }
}

@media (max-width: 480px) {
    .search-section {
        padding: 8px 8px 12px 8px;
    }
    .search-section.sticky {
        padding: 23px 12px 6px 12px;
    }
    .search-input-wrapper {
        padding: 5px 6px;
        border-radius: 12px;
        border-width: 1.5px;
    }
    .search-icon {
        margin-right: 6px;
    }
    .search-icon svg {
        width: 16px;
        height: 16px;
    }
    .search-input {
        font-size: 14px;
    }
    .voice-controls-wrapper {
        gap: 3px;
        margin-left: 3px;
    }
    .current-language,
    .voice-search-btn {
        width: 34px;
        height: 34px;
    }
    .voice-search-btn svg {
        width: 16px;
        height: 16px;
        stroke-width: 2.6;
    }
    .lang-flag {
        font-size: 14px;
    }
    .current-language::after {
        width: 6px;
        height: 6px;
        bottom: 2px;
        right: 2px;
    }
    .language-dropdown {
        min-width: 135px;
        right: -8px;
        padding: 6px;
    }
    .lang-option {
        padding: 8px 12px;
        gap: 10px;
    }
    .lang-name {
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .search-section {
        padding: 6px 6px 10px 6px;
    }
    .search-input-wrapper {
        padding: 3px 4px;
        border-radius: 10px;
    }
    .search-icon {
        margin-right: 4px;
    }
    .voice-controls-wrapper {
        gap: 2px;
        margin-left: 2px;
    }
    .current-language,
    .voice-search-btn {
        width: 32px;
        height: 32px;
    }
    .voice-search-btn svg {
        width: 14px;
        height: 14px;
    }
    .lang-flag {
        font-size: 13px;
    }
    .language-dropdown {
        min-width: 125px;
    }
}

