/* movies.css - Movie & TV randomizer */
/* === MOVIES PAGE === */

.movies-page {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding-bottom: 60px;
    box-sizing: border-box;
}

/* === Filter bar (centered) === */
.movies-filter {
    background: var(--surface-grad);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    padding: 24px 26px;
    margin-bottom: 28px;
    box-shadow: var(--surface-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.movies-filter-head {
    text-align: center;
}

    .movies-filter-head h2 {
        margin: 0;
        font-size: 1.4rem;
        font-weight: 600;
        color: #fff;
    }

    .movies-filter-head p {
        margin: 4px 0 0;
        color: #888;
        font-size: 0.92rem;
    }

/* type segmented toggle */
.movies-type-toggle {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
}

.movies-type-opt {
    padding: 9px 18px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #aaa;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 160ms ease, color 160ms ease;
}

    .movies-type-opt:hover:not(.active):not(:disabled) {
        color: #fff;
        background: rgba(255, 255, 255, 0.05);
    }

    .movies-type-opt.active {
        background: color-mix(in srgb, var(--accent) 22%, transparent);
        color: #fff;
    }

    .movies-type-opt:disabled {
        opacity: 0.55;
        cursor: not-allowed;
    }

/* genre / language / country dropdowns (genre = multi, lang/country = single) */
.movies-multi-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.movies-multi { position: relative; }

.movies-multi-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    color: #ddd;
    font-size: 0.92rem;
    font-family: inherit;
    cursor: pointer;
    min-width: 180px;
    transition: border-color 160ms ease, background 160ms ease;
}

    .movies-multi-trigger:hover:not(:disabled) {
        border-color: var(--surface-border-hover);
        background: rgba(255, 255, 255, 0.06);
    }

    .movies-multi-trigger.open {
        border-color: var(--accent);
        background: rgba(255, 255, 255, 0.06);
    }

    .movies-multi-trigger:disabled {
        opacity: 0.55;
        cursor: not-allowed;
    }

.movies-multi-label { color: #fff; font-weight: 500; flex: 1; text-align: left; }

.movies-multi-value {
    color: #aaa;
    font-size: 0.88rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.movies-multi-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    background: var(--accent);
    color: #fff;
    border-radius: 11px;
    font-size: 0.78rem;
    font-weight: 600;
}

.movies-multi-chevron {
    color: #888;
    font-size: 0.85rem;
    transition: transform 180ms ease, color 180ms ease;
}

.movies-multi-trigger.open .movies-multi-chevron {
    transform: rotate(180deg);
    color: var(--accent);
}

.movies-multi-backdrop { position: fixed; inset: 0; z-index: 25; }

.movies-multi-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    min-width: 220px;
    max-width: 300px;
    background: #14141a;
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.movies-multi-list { max-height: 320px; overflow-y: auto; padding: 6px; }

.movies-multi-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #ddd;
    font-size: 0.9rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 140ms ease;
}

    .movies-multi-option:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

    .movies-multi-option.active {
        background: color-mix(in srgb, var(--accent) 16%, transparent);
        color: #fff;
    }

    .movies-multi-option i { color: #666; font-size: 1rem; }
    .movies-multi-option.active i { color: var(--accent); }

.movies-multi-foot { border-top: 1px solid var(--surface-border); padding: 6px; }

.movies-multi-clear {
    width: 100%;
    padding: 6px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
}

    .movies-multi-clear:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }

/* min rating slider */
.movies-min-rating {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.movies-min-rating-label {
    color: #aaa;
    font-size: 0.88rem;
}

    .movies-min-rating-label strong {
        color: #fff;
        font-weight: 600;
        margin: 0 4px;
        font-variant-numeric: tabular-nums;
    }

.movies-min-rating-star {
    color: #ffc44c;
    font-size: 0.95rem;
}

.movies-min-rating input[type=range] {
    width: 100%;
    accent-color: var(--accent);
}

/* release year range - two compact number inputs */
.movies-year-range {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.movies-year-range-label {
    color: #aaa;
    font-size: 0.88rem;
}

.movies-year-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.movies-year-input {
    width: 92px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    color: #ddd;
    font-size: 0.92rem;
    font-family: inherit;
    text-align: center;
}

    .movies-year-input:focus {
        outline: none;
        border-color: var(--accent);
        background: rgba(255, 255, 255, 0.06);
    }

    .movies-year-input::-webkit-inner-spin-button,
    .movies-year-input::-webkit-outer-spin-button {
        opacity: 0.45;
    }

.movies-year-sep {
    color: #666;
    font-size: 1rem;
}

/* primary action */
.movies-randomize {
    width: 100%;
    padding: 14px 24px;
    font-size: 1.05rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.movies-spin {
    display: inline-block;
    animation: movies-spin 1s linear infinite;
}

@keyframes movies-spin {
    to { transform: rotate(360deg); }
}

.movies-error {
    width: 100%;
    margin-top: 4px;
    padding: 10px 14px;
    background: rgba(239, 111, 108, 0.12);
    border: 1px solid rgba(239, 111, 108, 0.35);
    color: #f4b9b7;
    border-radius: 10px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* pool-size hint under the randomize button */
.movies-pool {
    width: 100%;
    margin-top: 4px;
    padding: 8px 14px;
    color: #888;
    font-size: 0.84rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

    .movies-pool strong {
        color: #ddd;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
    }

    .movies-pool.tight {
        background: rgba(255, 196, 76, 0.08);
        border: 1px solid rgba(255, 196, 76, 0.25);
        border-radius: 10px;
        color: #f1cc7a;
    }

        .movies-pool.tight strong {
            color: #ffd97a;
        }

/* empty state */
.movies-empty {
    text-align: center;
    padding: 80px 20px;
    color: #777;
}

    .movies-empty i {
        display: block;
        font-size: 2.6rem;
        color: var(--accent-soft);
        opacity: 0.55;
        margin-bottom: 16px;
    }

    .movies-empty p {
        margin: 0;
        font-size: 1.05rem;
    }

/* === Result card === */
.movies-result {
    border-radius: 18px;
    overflow: hidden;
    background: var(--surface-solid);
    border: 1px solid var(--surface-border);
    box-shadow: var(--surface-shadow);
    contain: layout style paint;
    opacity: 0;
    transform: translateY(8px);
    animation: movies-fade-in 360ms ease-out forwards;
    will-change: transform, opacity;
}

@keyframes movies-fade-in {
    to { opacity: 1; transform: translateY(0); }
}

/* hero: backdrop image + cinematic dark fade */
.movies-hero {
    position: relative;
    background-size: cover;
    background-position: center 20%;
    min-height: 460px;
    padding: 48px 40px 40px;
    color: #fff;
}

.movies-hero-fade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 0.55) 0%,
        rgba(0, 0, 0, 0.82) 55%,
        var(--surface-solid) 100%);
    pointer-events: none;
}

.movies-hero-inner {
    position: relative;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 40px;
    align-items: flex-start;
    max-width: 1100px;
    margin: 0 auto;
}

.movies-poster {
    width: 320px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.65);
    display: block;
}

.movies-hero-info {
    padding-top: 8px;
}

.movies-tagline {
    font-style: italic;
    color: #c4b3ee;
    font-size: 0.96rem;
    margin-bottom: 10px;
    opacity: 0.85;
}

.movies-title {
    margin: 0 0 14px;
    font-size: 2.6rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.movies-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 18px;
    color: #c8c8c8;
    font-size: 0.94rem;
    margin-bottom: 16px;
}

    .movies-meta span:not(:last-child)::after {
        content: "·";
        margin-left: 18px;
        color: #555;
    }

.movies-genre-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}

.movies-genre-pill {
    padding: 4px 11px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    font-size: 0.76rem;
    color: #ddd;
    letter-spacing: 0.02em;
}

.movies-overview {
    color: #dadada;
    line-height: 1.6;
    font-size: 1rem;
    max-width: 720px;
    margin: 0 0 22px;
}

.movies-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.movies-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 160ms ease, border-color 160ms ease;
}

    .movies-link:hover {
        background: color-mix(in srgb, var(--accent) 20%, transparent);
        border-color: var(--accent);
    }

/* === Section common === */
.movies-section {
    padding: 26px 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.25);
}

.movies-section-title {
    margin: 0 0 16px;
    color: var(--accent-soft);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

    .movies-section-title small {
        text-transform: none;
        letter-spacing: 0;
        font-weight: 400;
        color: #888;
        margin-left: 6px;
        font-size: 0.85rem;
    }

/* === Ratings === */
.movies-ratings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

/* --rating-color is set per card via inline style */
.movies-rating {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--surface-border);
    border-top: 2px solid var(--rating-color, var(--accent-soft));
    border-radius: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.movies-rating-head {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--rating-color, var(--accent-soft));
}

    .movies-rating-head i {
        font-size: 0.95rem;
        line-height: 1;
    }

.movies-rating-source {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 600;
}

/* brand badges, CSS-drawn (no copied logo assets) */
.movies-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

/* wordmarks */
.movies-brand-tmdb,
.movies-brand-imdb,
.movies-brand-metacritic {
    padding: 3px 7px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
}

.movies-brand-tmdb {
    background: linear-gradient(90deg, #01b4e4 0%, #90cea1 100%);
    color: #032541;
}

.movies-brand-imdb {
    background: #f5c518;
    color: #000;
    letter-spacing: 0;
}

.movies-brand-metacritic {
    width: 18px;
    height: 18px;
    padding: 0;
    background: var(--rating-color, #66cc33);
    color: #000;
    border-radius: 3px;
    font-size: 0.74rem;
}

/* RT fresh */
.movies-brand-rt-fresh,
.movies-brand-rt-rotten {
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    /* uppercase text sits visually higher than geometric centre - nudge to match */
    transform: translateY(-1px);
}

.movies-brand-rt-fresh {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='13' r='7' fill='%23fa320a'/><polygon points='12,4 14.5,7.5 9.5,7.5' fill='%2333a833'/></svg>");
}

/* RT rotten - organic blob via bezier curves */
.movies-brand-rt-rotten {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2 Q14 4 16 4 Q20 4 19 8 Q22 9 21 12 Q23 15 19 16 Q21 19 17 19 Q17 22 13 20 Q12 22 11 20 Q7 22 7 19 Q3 19 5 16 Q1 15 3 12 Q1 9 4 8 Q3 4 7 4 Q10 4 12 2 Z' fill='%2333a833'/></svg>");
}

.movies-rating-score {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

    .movies-rating-score small {
        font-size: 0.9rem;
        color: #777;
        font-weight: 400;
        margin-left: 2px;
    }

.movies-rating-votes {
    font-size: 0.72rem;
    color: #888;
}

.movies-rating-tag {
    font-size: 0.7rem;
    color: var(--rating-color, var(--accent-soft));
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
}

/* === Quick stats === */
.movies-quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
}

.movies-stat-tile {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.movies-stat-tile-label {
    color: #888;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.movies-stat-tile-value {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* === Awards === */
.movies-awards-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.movies-award {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    min-width: 180px;
}

    .movies-award.win {
        background: rgba(255, 196, 76, 0.08);
        border-color: rgba(255, 196, 76, 0.3);
    }

        .movies-award.win i {
            color: #ffc44c;
        }

    .movies-award.nom i {
        color: var(--accent-soft);
    }

    .movies-award i {
        font-size: 1.5rem;
        flex-shrink: 0;
    }

.movies-award-count {
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.movies-award-label {
    color: #bbb;
    font-size: 0.78rem;
    line-height: 1.25;
}

.movies-awards-summary {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    color: #888;
    font-size: 0.82rem;
}

    .movies-awards-summary strong {
        color: #ddd;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
    }

.movies-awards-sep {
    color: #444;
}

/* === Cast === */
.movies-cast-row {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}

.movies-cast-card {
    flex: 0 0 110px;
    text-align: center;
}

.movies-cast-avatar {
    width: 96px;
    height: 96px;
    margin: 0 auto 10px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .movies-cast-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .movies-cast-avatar i {
        font-size: 2.2rem;
        color: #555;
    }

.movies-cast-name {
    color: #fff;
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.25;
    margin-bottom: 2px;
}

.movies-cast-char {
    color: #888;
    font-size: 0.74rem;
    line-height: 1.25;
}

/* === Providers === */
.movies-providers-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 12px;
}

    .movies-providers-row:last-of-type {
        margin-bottom: 0;
    }

.movies-providers-row-label {
    color: #aaa;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    min-width: 56px;
}

.movies-provider {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 5px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
}

    .movies-provider img {
        width: 30px;
        height: 30px;
        border-radius: 5px;
        object-fit: cover;
        display: block;
    }

.movies-provider-name {
    color: #ddd;
    font-size: 0.8rem;
}

.movies-providers-attr {
    margin-top: 16px;
    text-align: right;
    color: #555;
    font-size: 0.7rem;
    font-style: italic;
    letter-spacing: 0.02em;
}

/* === Gallery === */
.movies-gallery-large {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
    margin-bottom: 12px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

    .movies-gallery-large img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

.movies-gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
}

.movies-gallery-thumb {
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    background: none;
    cursor: pointer;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    transition: border-color 140ms ease, transform 140ms ease;
}

    .movies-gallery-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .movies-gallery-thumb:hover {
        transform: translateY(-1px);
        border-color: var(--accent-soft);
    }

    .movies-gallery-thumb.active {
        border-color: var(--accent);
    }

/* === Mobile === */
@media (max-width: 900px) {
    .movies-hero {
        padding: 28px 20px;
        min-height: auto;
    }

    .movies-hero-inner {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .movies-poster {
        width: min(260px, 60vw);
        margin: 0 auto;
    }

    .movies-title {
        font-size: 1.85rem;
        text-align: center;
    }

    .movies-hero-info { text-align: center; }
    .movies-meta { justify-content: center; }
    .movies-genre-pills,
    .movies-links { justify-content: center; }
    .movies-overview { text-align: left; }

    .movies-section { padding: 22px 20px; }

    .movies-filter { padding: 18px 18px; }
}

@media (max-width: 540px) {
    .movies-meta { gap: 6px 14px; font-size: 0.86rem; }
    .movies-meta span:not(:last-child)::after { margin-left: 14px; }
    .movies-title { font-size: 1.6rem; }
    .movies-rating-score { font-size: 2rem; }
    .movies-cast-card { flex-basis: 96px; }
    .movies-cast-avatar { width: 84px; height: 84px; }
}
