/* =====================================================
   SEARCH.CSS
   Page-specific styles for search.asp
   ===================================================== */

:root {
    --search-max-width: 1300px;
    --transition-fast: 0.15s ease;
    --transition-standard: 0.2s ease;
}

.search-hero,
.results-grid,
.alt-browse,
.sponsors {
    max-width: var(--search-max-width);
    margin-inline: auto;
}

.search-bar input,
.search-bar button,
.filter-chip select,
.page-btn {
    font-family: inherit;
}

/* ===================== SEARCH HERO ===================== */
.search-hero {
    padding: 80px 60px 0;
}

.search-hero h1 {
    margin-bottom: 8px;
    font-size: 44px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.search-hero .subtitle {
    margin-bottom: 32px;
    color: #fff;
    font-size: 15px;
}

/* ===================== SEARCH BAR ===================== */
.search-bar {
    display: flex;
    margin-bottom: 28px;
}

.search-bar input {
    flex: 1;
    padding: 16px 20px;
    border: 1px solid rgba(255,255,255,0.08);
    border-right: 0;
    border-radius: 10px 0 0 10px;
    outline: 0;
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-size: 15px;
    transition: border-color var(--transition-standard), background var(--transition-standard);
}

.search-bar input::placeholder {
    color: #777;
}

.search-bar input:focus {
    border-color: rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.07);
}

.search-bar button {
    padding: 16px 28px;
    border: 0;
    border-radius: 0 10px 10px 0;
    background: #fff;
    color: #000;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.search-bar button:hover {
    background: #e0e0e0;
}

/* ===================== FILTER CHIPS ===================== */
.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 36px;
}

.filter-chip {
    position: relative;
}

/* The State chip is rendered on every search page and revealed only
   when Australia is the selected country, so it relies on [hidden]
   actually hiding it. Nothing here sets display on .filter-chip today,
   which means the UA stylesheet's [hidden]{display:none} wins - but a
   later `display:flex` on .filter-chip would silently beat it and strand
   the dropdown visible under every country. Stated explicitly so that
   change cannot happen by accident. */
.filter-chip[hidden] {
    display: none !important;
}

.filter-chip select {
    appearance: none;
    -webkit-appearance: none;
    padding: 10px 36px 10px 16px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 999px;
    outline: 0;
    background: rgba(255,255,255,0.05);
    color: #aaa;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.filter-chip select:hover,
.filter-chip select:focus {
    border-color: rgba(255,255,255,0.18);
    color: #fff;
}

.filter-chip::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;
    width: 0;
    height: 0;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
    border-top: 5px solid #888;
    pointer-events: none;
    transform: translateY(-50%);
}

.filter-chip select option {
    background: #1a1a1a;
    color: #ddd;
}

.filter-chip select.active {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.filter-count {
    margin-left: 8px;
    color: #888;
    font-size: 13px;
}

/* ===================== LOADING / EMPTY STATES ===================== */
.search-loading,
.search-empty {
    grid-column: 1 / -1;
    padding: 80px 20px;
}

.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-empty {
    color: #777;
    text-align: center;
}

.search-empty p {
    margin-bottom: 8px;
    font-size: 16px;
}

.search-empty-sub {
    color: #777;
    font-size: 13px;
}

/* ===================== RESULTS GRID ===================== */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 0 60px 40px;
}

/* ===================== FILM CARD ===================== */
.film-card {
    position: relative;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.film-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 14px 30px rgba(0,0,0,0.28), 0 4px 10px rgba(0,0,0,0.18);
}

.film-card .thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #111;
}

.film-card .thumb img.poster-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.film-card:hover .thumb img.poster-img {
    transform: scale(1.06);
}

.film-card .preview-host,
.film-card .preview-loader,
.film-card .play-overlay {
    position: absolute;
    inset: 0;
}

.film-card .preview-host {
    display: none;
    background: #000;
}

.film-card .preview-host iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.film-card .play-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-standard);
}

.film-card.previewing {
    transform: translateY(-4px) scale(1.01);
}

.film-card:hover .play-overlay {
    opacity: 1;
}

.film-card.previewing .play-overlay {
    opacity: 0 !important;
}

.play-overlay .play-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    transition: transform var(--transition-standard);
}

.film-card:hover .play-icon {
    transform: scale(1.08);
}

.play-overlay svg {
    width: 18px;
    height: 18px;
    margin-left: 2px;
    fill: #000;
}

/* ===================== FILM BADGES ===================== */
.badge-winner,
.badge-rated,
.film-card .year-badge,
.film-card .flag-badge {
    position: absolute;
    top: 10px;
}

.badge-winner,
.badge-rated,
.film-card .flag-badge {
    left: 10px;
}

.badge-winner,
.badge-rated,
.year-badge {
    transition: transform var(--transition-fast);
}

.badge-winner:hover,
.badge-rated:hover,
.year-badge:hover {
    transform: scale(1.08);
}

.badge-winner,
.badge-rated {
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.badge-winner {
    padding: 5px 12px;
    border-radius: 4px;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    color: #111;
    font-size: 11px;
}

.badge-winner::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 12px;
    border-right: 6px solid transparent;
    border-left: 6px solid transparent;
    border-top: 6px solid #d97706;
}

.badge-rated {
    padding: 4px 9px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    color: #fff;
    font-size: 10px;
}

.badge-icon {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.film-card .year-badge {
    right: 10px;
    z-index: 2;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(0,0,0,0.7);
    color: #ccc;
    font-size: 11px;
    font-weight: 700;
    backdrop-filter: blur(8px);
}

.film-card .preview-loader {
    z-index: 1;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
}

.film-card.loading .preview-loader {
    display: flex;
}

.preview-loader .spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Card body */
.film-card .meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.film-card .meta-pill {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.film-card .category-pill {
    border: 1px solid rgba(212,175,55,0.25);
    background: rgba(212,175,55,0.15);
    color: #d4af37;
}

.film-card .category-pill:hover {
    border-color: rgba(212,175,55,0.45);
    background: rgba(212,175,55,0.25);
}

.film-card .flag-pill img,
.film-card .flag-badge img {
    display: block;
    object-fit: cover;
}

.film-card .flag-pill img {
    width: 22px;
    height: 16px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.1);
    transition: transform var(--transition-fast);
}

.film-card .flag-pill:hover img {
    transform: scale(1.1);
}

.film-card .flag-badge {
    z-index: 2;
}

.film-card .flag-badge img {
    width: 26px;
    height: 19px;
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* ===================== PAGINATION ===================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 60px 48px;
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    background: transparent;
    /* #777 measures 4.40:1 on the #0b0b0b page background - just under
       the 4.5:1 AA threshold, which is what PageSpeed flags on the
       pagination. #999 is 6.91:1. Nothing else about the control
       changes. */
    color: #999;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.page-btn:hover {
    border-color: rgba(255,255,255,0.15);
    color: #fff;
}

.page-btn.active {
    border-color: #fff;
    background: #fff;
    color: #000;
}

.page-btn.nav-btn {
    width: auto;
    padding: 0 16px;
    font-size: 13px;
}

/* The pagination is real links now, server-rendered and crawlable, so
   these rules have to cover <a> as well as the <button> they were
   written for. Prev/Next with nowhere to go are spans - an <a> with no
   href is not a link and should not look like one. */
.page-btn { text-decoration: none; }

/* NOT opacity. At .4 the text blends toward the background and lands at
   1.63:1 - no foreground colour can rescue that, because opacity applies
   after the colour is chosen.

   Prev/Next with nowhere to go are rendered as <span aria-hidden="true">,
   so they are already hidden from screen readers. They are still ON
   SCREEN though, and "inactive" is not a reason to make text
   unreadable for a sighted user with low vision.

   The state is now carried by a dimmer border and the cursor, with the
   label held at 5.55:1 - visibly quieter than an active button at 6.91,
   still legible. */
.page-btn.is-disabled {
    color: #888;
    border-color: rgba(255,255,255,0.03);
    cursor: default;
    pointer-events: none;
}

span.page-btn.active { cursor: default; }

.page-ellipsis {
    padding: 0 4px;
    color: #999;          /* same 4.40:1 -> 6.91:1 fix as .page-btn */
    font-size: 14px;
}

/* ===================== ALTERNATIVE BROWSE ===================== */
.alt-browse {
    padding: 20px 60px 60px;
}

.alt-browse-label {
    margin-bottom: 18px;
    color: #ddd;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.alt-browse-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.alt-card {
    display: block;
    padding: 28px 24px;
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    color: inherit;
    text-decoration: none;
    transition: border-color var(--transition-standard), background var(--transition-standard), transform var(--transition-standard);
}

.alt-card:hover {
    border-color: rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    transform: translateY(-2px);
}

.alt-card .alt-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-bottom: 14px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
}

.alt-card .alt-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #aaa;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.alt-card h4 {
    margin-bottom: 6px;
    font-size: 15px;
    font-weight: 700;
}

.alt-card p {
    color: #ccc;
    font-size: 13px;
    line-height: 1.5;
}

/* ===================== SPONSORS ===================== */
.sponsors {
    position: relative;
    padding: 0 60px 70px;
}

.sponsors-label {
    margin-bottom: 24px;
    color: #ddd;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-align: center;
    text-transform: uppercase;
}

.sponsors-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.sponsors-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.sponsors-carousel::before,
.sponsors-carousel::after {
    content: "";
    position: absolute;
    top: 0;
    z-index: 3;
    width: 80px;
    height: 100%;
    pointer-events: none;
}

.sponsors-carousel::before {
    left: 0;
    background: linear-gradient(to right, #0b0b0b 0%, rgba(11,11,11,0) 100%);
}

.sponsors-carousel::after {
    right: 0;
    background: linear-gradient(to left, #0b0b0b 0%, rgba(11,11,11,0) 100%);
}

.sponsors-track {
    display: flex;
    align-items: center;
    gap: 45px;
    width: max-content;
    animation: scrollSponsors 40s linear infinite;
}

@keyframes scrollSponsors {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.sponsors-carousel:hover .sponsors-track {
    animation-play-state: paused;
}

.sponsor-item {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    height: 70px;
}

.sponsor-item img {
    height: 80px;
    max-width: 200px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.sponsor-item:hover img {
    transform: scale(1.08);
}

.sponsor-arrow {
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: background var(--transition-standard), color var(--transition-standard);
}

.sponsor-arrow:hover {
    background: var(--accent);
    color: #fff;
}

.sponsor-arrow.left { margin-right: 14px; }
.sponsor-arrow.right { margin-left: 14px; }

/* ===================== SEO FALLBACK ===================== */
.seo-results {
    max-width: 900px;
    margin: 40px auto;
}

.seo-film-list,
.browse-group ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.seo-film-list li,
.browse-group li {
    margin: 8px 0;
}

.seo-film-list a {
    font-weight: 500;
    text-decoration: none;
}

.catalogue-browse {
    position: relative;
    max-width: 1200px;
    margin: 10px auto;
    padding: 45px 50px;
    overflow: hidden;
    border: 1px solid rgba(255,215,0,0.15);
    border-radius: 14px;
    background: linear-gradient(180deg, #111, #0a0a0a);
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.catalogue-browse::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #d4af37, transparent);
    opacity: 0.6;
}

.browse-title {
    margin-bottom: 40px;
    color: #d4af37;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: center;
}

.browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 50px;
}

.browse-group {
    padding-right: 20px;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.browse-group:last-child {
    border-right: 0;
}

.browse-group h3 {
    margin-bottom: 14px;
    color: #bfa44a;
    font-size: 16px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.browse-group a {
    display: inline-block;
    color: #e6e6e6;
    font-size: 15px;
    text-decoration: none;
    transition: color var(--transition-standard), transform var(--transition-standard);
}

.browse-group a:hover {
    color: #d4af37;
    transform: translateX(3px);
}

.film-card-title {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 980px) {
    .search-hero {
        padding: 120px 20px 0;
    }

    .search-hero h1 {
        font-size: 32px;
    }

    .results-grid {
        gap: 16px;
        padding: 0 20px 40px;
    }

    .alt-browse {
        padding: 20px 20px 48px;
    }

    .alt-browse-grid {
        grid-template-columns: 1fr;
    }

    .sponsors {
        padding: 0 20px 44px;
    }

    .pagination {
        padding: 10px 20px 40px;
    }
}

@media (max-width: 768px), (pointer: coarse) {
    .sponsor-arrow {
        display: none;
    }

    .film-card-title a,
    .filmmaker-name a {
        display: flex;
        align-items: center;
        min-height: 44px;
        padding: 6px 0;
        line-height: 1.35;
    }

    .film-card-title + .card-meta {
        margin-top: 4px;
    }

    .card-meta + .meta-row {
        margin-top: 8px;
    }
}

@media (max-width: 640px) {
    .search-hero h1 {
        font-size: 28px;
    }

    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 14px;
    }

    .search-bar button {
        padding: 16px 18px;
        font-size: 14px;
    }
}

/* Touch devices: no hover preview */
@media (hover: none) {
    .film-card:hover {
        transform: translateY(-2px);
    }

    .film-card:hover .thumb img.poster-img {
        transform: none;
    }

    .film-card .play-overlay {
        background: rgba(0,0,0,0.15);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
