/* --- Premium Expanding Search Bar --- */
.search-box-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    width: 38px; /* Initial icon width */
    height: 38px;
    overflow: visible; /* Allow dropdown to show outside wrapper bounds */
}

/* Active State (Expanded) */
.search-input-wrapper.active {
    width: 300px; /* Matches dropdown width */
    background: #141414;
    border-color: #333;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    overflow: visible; /* Keep visible so dropdown shows */
}

.search-input {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: #fff;
    padding: 0 40px 0 16px; /* Space for icons */
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.search-input-wrapper.active .search-input {
    opacity: 1;
    pointer-events: auto;
}

.search-input:focus {
    outline: none;
}

.search-icon-btn, .search-close-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s;
}

.search-icon-btn {
    right: 8px; /* Icon stays on right */
    width: 24px;
    height: 24px;
    z-index: 2;
}

.search-input-wrapper.active .search-icon-btn {
    color: #e50914; /* Red icon when active */
}

.search-close-btn {
    right: 60px; /* Moved left — mic now sits to its right */
    font-size: 18px;
    color: #aaa;
    z-index: 3;
    width: 24px;
    height: 24px;
}

.search-mic-btn {
    position: absolute;
    top: 58%;
    transform: translateY(-50%);
    right: 36px; /* Now sits between close btn and search icon */
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: #aaa;
    font-size: 20px;
    cursor: pointer;
    z-index: 3;
    display: none; /* JS will enable if supported */
    transition: color 0.2s;
}

.search-mic-btn:hover {
    color: #e50914;
}

.search-mic-btn.listening {
    color: #e50914;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: translateY(-50%) scale(1); opacity: 1; }
    50% { transform: translateY(-50%) scale(1.2); opacity: 0.8; }
    100% { transform: translateY(-50%) scale(1); opacity: 1; }
}

.search-close-btn:hover {
    color: #fff;
}

/* Suggestions Dropdown */
.search-suggestions {
    position: absolute;
    top: 100%;
    right: 0;
    width: 280px; /* Matches Expanded Input */
    background: #141414;
    border: 1px solid #333;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    z-index: 1000;
    margin-top: 4px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
}

.premium-search-header {
    padding: 10px 16px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #e50914;
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
}

.premium-search-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #222;
    text-decoration: none !important;
    transition: background 0.2s;
}

.premium-search-item:hover {
    background: #2a2a2a;
}

.search-poster {
    width: 32px;
    height: 44px;
    border-radius: 3px;
    object-fit: cover;
    margin-right: 12px;
    background: #333;
}

.search-info h6 {
    font-size: 13px;
    margin: 0;
    color: #fff;
    line-height: 1.2;
}

.search-info span {
    font-size: 11px;
    color: #999;
}

.search-empty {
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: #777;
}
/* 🎬 Cinejoy Master Studio Search Overlay & Dropdown */
#cinejoySearchOverlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(8, 8, 10, 0.95) !important;
    backdrop-filter: blur(36px) !important;
    -webkit-backdrop-filter: blur(36px) !important;
    z-index: 999999 !important;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease;
    overflow-y: auto !important;
}

.cinejoy-search-box-modal {
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
    animation: searchModalSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes searchModalSlideDown {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Search Input Bar */
.cinejoy-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #141418 !important;
    border: 1.5px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 50rem !important;
    padding: 10px 22px !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.65), 0 0 20px rgba(245, 158, 11, 0.05) !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.cinejoy-search-input-wrapper:focus-within {
    border-color: #f59e0b !important;
    background: #18181f !important;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.8), 0 0 32px rgba(245, 158, 11, 0.25) !important;
    transform: translateY(-1px);
}

#search-query {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: #ffffff !important;
    font-size: 17px !important;
    font-weight: 500 !important;
    padding: 6px 12px !important;
    height: auto !important;
    width: 100% !important;
}

#search-query::placeholder {
    color: #71717a !important;
    font-size: 16px !important;
}

#search-query:focus {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: #ffffff !important;
}

/* Quick Search Chip Pills */
.search-chip-pill {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.search-chip-pill:hover {
    background: #f59e0b;
    color: #0c0c0c !important;
    border-color: #f59e0b;
    transform: translateY(-2px);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
}

/* Results Container */
#search-suggestions {
    background: #111116 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 20px !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(245, 158, 11, 0.08) !important;
    width: 100% !important;
    max-width: 100% !important;
    position: static !important;
    left: auto !important;
    right: auto !important;
    margin-top: 10px !important;
    max-height: 75vh !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}

.search-results-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(75vh - 70px);
    padding: 10px 12px 20px 12px;
    scrollbar-width: thin;
    scrollbar-color: #f59e0b #18181b;
}

.search-results-scroll::-webkit-scrollbar {
    width: 6px;
}
.search-results-scroll::-webkit-scrollbar-track {
    background: #141416;
}
.search-results-scroll::-webkit-scrollbar-thumb {
    background: #f59e0b;
    border-radius: 4px;
}

/* 🎬 Modern OTT Search Cards Grid */
.search-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 6px 2px 14px 2px;
}

@media (min-width: 576px) {
    .search-cards-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }
}

@media (min-width: 768px) {
    .search-cards-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
}

@media (min-width: 992px) {
    .search-cards-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 18px;
    }
}

/* 🎴 Modern OTT Movie Card */
.search-movie-card {
    display: flex;
    flex-direction: column;
    background: rgba(20, 20, 26, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none !important;
    color: inherit;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.search-movie-card:hover {
    transform: translateY(-4px);
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(28, 28, 38, 0.9);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.65), 0 0 20px rgba(245, 158, 11, 0.2);
}

.search-movie-card:active {
    transform: scale(0.97);
}

/* Poster Container */
.search-card-poster-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: #141418;
    border-radius: 10px 10px 0 0;
}

.search-card-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-movie-card:hover .search-card-poster {
    transform: scale(1.06);
}

/* Gradient Vignette at bottom of poster */
.search-card-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(180deg, transparent 0%, rgba(12, 12, 14, 0.88) 100%);
    pointer-events: none;
}

/* Floating Badges */
.search-card-badge-top-left {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
}

.search-card-star {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(10, 10, 12, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.search-card-star i {
    color: #f59e0b;
    font-size: 10px;
}

.search-card-badge-top-right {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
}

.search-card-badge-quality {
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.3px;
    padding: 2px 6px;
    border-radius: 5px;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.search-card-badge-quality.quality-4k {
    background: #f59e0b;
    color: #0c0c0c;
}

.search-card-badge-quality.quality-series {
    background: rgba(12, 12, 16, 0.85);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.search-card-badge-quality.quality-hd {
    background: rgba(12, 12, 16, 0.85);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Center Play Hover Button */
.search-card-play-hover {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f59e0b;
    color: #0c0c0c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
    z-index: 3;
    pointer-events: none;
}
.search-card-play-hover i {
    margin-left: 2px;
}

.search-movie-card:hover .search-card-play-hover {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Card Info Block */
.search-card-info {
    padding: 8px 8px 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: transparent;
}

.search-card-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 31px;
}

.search-movie-card:hover .search-card-title {
    color: #f59e0b;
}

.search-card-sub {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-card-year {
    color: #cbd5e1;
    font-weight: 600;
}

.search-card-dot {
    color: #475569;
    font-size: 9px;
}

.search-card-type {
    color: #94a3b8;
}

.search-card-genre {
    color: #64748b;
    max-width: 80px;
}

/* Search View All Footer Button */
.search-view-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 9999px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b !important;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.search-view-all-btn:hover {
    background: #f59e0b;
    color: #09090b !important;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
}

/* 📱 Mobile Specific Refinements */
@media (max-width: 640px) {
    #cinejoySearchOverlay {
        padding: 12px 10px calc(24px + env(safe-area-inset-bottom, 20px)) 10px !important;
    }
    .cinejoy-search-box-modal {
        max-width: 100% !important;
    }
    .cinejoy-search-input-wrapper {
        padding: 8px 16px !important;
        border-radius: 14px !important;
    }
    #search-query {
        font-size: 15px !important;
        padding: 4px 6px !important;
    }
    #search-suggestions {
        max-height: calc(100vh - 165px) !important;
        border-radius: 16px !important;
        background: rgba(14, 14, 18, 0.88) !important;
        backdrop-filter: blur(24px) !important;
        -webkit-backdrop-filter: blur(24px) !important;
    }
    .search-results-scroll {
        max-height: calc(100vh - 215px) !important;
        padding: 8px 6px 36px 6px !important;
    }
    .search-cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .search-card-title {
        font-size: 12px !important;
        min-height: 29px !important;
    }
    .search-card-sub {
        font-size: 10px !important;
    }
}
