/* =============================================================================
   FilmParty — Movie/Series page discovery & rating UI
   -----------------------------------------------------------------------------
   Three self-contained, namespaced pieces, loaded only on detail pages:
     • .fp-userscore-chip   — average user-rating chip in the meta row
     • .fp-rate-*           — the interactive 5-star rating widget
     • .fp-discovery-* / .fp-disc-* — the "related" and "for you" carousels
   Shares global tokens (variables.css); defines no global rules.
   ========================================================================== */

:root {
    --fp-star: #ffc451;
    --fp-disc-ease: cubic-bezier(.22, 1, .36, 1);
}

/* ============================ meta-row chip ============================ */
.fp-userscore-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.fp-userscore-chip.is-hidden { display: none; }

.fp-userscore-chip svg {
    width: 14px;
    height: 14px;
    fill: var(--fp-star);
    flex-shrink: 0;
}

.fp-userscore-chip b { font-weight: 800; letter-spacing: .2px; }
.fp-userscore-chip small { opacity: .7; font-size: .82em; }

/* ========================= 5-star rating widget ========================= */
.fp-rate-flow {
    width: min(100%, 440px);
    margin: 18px auto 6px;
    padding: 0 14px;
}

.fp-rate-panel {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    padding: 16px 18px 14px;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02)),
        rgba(12, 16, 26, .55);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 18px 40px -22px rgba(0, 0, 0, .8);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.fp-rate-panel::before {
    content: "";
    position: absolute;
    inset: -1px -1px auto -1px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 196, 81, .55), transparent);
    opacity: .8;
}

.fp-rate-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.fp-rate-label { font-size: 13.5px; font-weight: 800; color: #eef2fb; }

.fp-rate-your {
    font-size: 12.5px;
    color: var(--fp-star);
    font-weight: 700;
}
.fp-rate-your[hidden] { display: none; }
.fp-rate-your b { font-size: 15px; font-weight: 900; }

/* Ten stars have to fit a phone: the row and the stars scale with the
   viewport instead of wrapping, and never grow past the old desktop size. */
.fp-rate-stars {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 1px;
    width: 100%;
    max-width: 440px;
    margin: 2px 0 10px;
}

.fp-rate-star {
    width: clamp(19px, 6.1vw, 36px);
    height: clamp(19px, 6.1vw, 36px);
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 12px;
    -webkit-tap-highlight-color: transparent;
    transition: transform .18s var(--fp-disc-ease), background-color .18s ease;
}

.fp-rate-star svg { width: clamp(15px, 5vw, 27px); height: clamp(15px, 5vw, 27px); overflow: visible; }

.fp-rate-star svg path {
    fill: rgba(255, 255, 255, .16);
    stroke: rgba(255, 255, 255, .28);
    stroke-width: 1;
    transition: fill .16s ease, stroke .16s ease, filter .16s ease;
}

/* chosen + hover/keyboard preview (RTL: value 1 = rightmost star).
   While previewing, the chosen fill is dimmed so a lower preview reads cleanly. */
.fp-rate-star.is-on svg path {
    fill: var(--fp-star);
    stroke: #ffd27a;
    filter: drop-shadow(0 2px 8px rgba(255, 196, 81, .45));
}

.fp-rate-stars.is-previewing .fp-rate-star svg path {
    fill: rgba(255, 255, 255, .16);
    stroke: rgba(255, 255, 255, .28);
    filter: none;
}

.fp-rate-stars.is-previewing .fp-rate-star.is-hot svg path {
    fill: var(--fp-star);
    stroke: #ffd27a;
    filter: drop-shadow(0 2px 8px rgba(255, 196, 81, .45));
}

.fp-rate-star:hover { transform: translateY(-2px) scale(1.06); }
.fp-rate-star:active { transform: scale(.92); }
.fp-rate-star:focus-visible { outline: 2px solid var(--fp-star); outline-offset: 2px; }

.fp-rate-panel.is-saving { pointer-events: none; }
.fp-rate-panel.is-justsaved .fp-rate-star.is-on svg path { animation: fp-rate-pop .45s var(--fp-disc-ease); }

@keyframes fp-rate-pop {
    0% { transform: scale(1); }
    45% { transform: scale(1.22); }
    100% { transform: scale(1); }
}

.fp-rate-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-soft);
}

.fp-rate-msg { font-weight: 600; }
.fp-rate-msg.is-error { color: #ff8f9f; }
.fp-rate-msg.is-ok { color: #8ee6a8; }

.fp-rate-avg b { color: #eef2fb; font-weight: 800; }
.fp-rate-avg.is-empty { display: none; }

/* Desktop: the rating card fills the content column exactly like the collection
   and comment cards beside it, instead of floating as a narrow 440px island.
   The header/footer rows span the full width; the ten stars stay centered at a
   comfortable size. Mobile keeps the compact 440px flow above. */
@media (min-width: 900px) {
    .fp-rate-flow {
        width: 100%;
        max-width: none;
        margin: 18px 0 8px;
        padding: 0;
    }
    .fp-rate-panel { padding: 18px 24px 16px; }
    .fp-rate-stars { max-width: 560px; margin-left: auto; margin-right: auto; }
}

/* ========================= discovery carousels ========================= */
.fp-discovery {
    width: min(100%, 1120px);
    margin: 8px auto 4px;
    padding: 0 8px;
}

.fp-discovery-block { margin: 26px 0; }

.fp-discovery-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin: 0 6px 12px;
}

.fp-discovery-kicker {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .4px;
    color: #8fb4ff;
    margin-bottom: 4px;
}

.fp-discovery--foryou .fp-discovery-kicker { color: var(--fp-star); }

.fp-discovery-titles h2 {
    margin: 0;
    font-size: clamp(18px, 2.4vw, 23px);
    font-weight: 900;
    color: #fff;
    letter-spacing: -.3px;
}

.fp-discovery-titles p {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: var(--text-soft);
}

.fp-discovery-nav { display: none; gap: 8px; flex-shrink: 0; }

.fp-discovery-arrow {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    cursor: pointer;
    color: #fff;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .14);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    transition: background-color .2s ease, border-color .2s ease, opacity .2s ease, transform .14s ease;
}

.fp-discovery-arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.fp-discovery-arrow:hover { background: rgba(47, 123, 255, .26); border-color: rgba(130, 175, 255, .5); }
.fp-discovery-arrow:active { transform: scale(.93); }
.fp-discovery-arrow.is-disabled { opacity: .32; pointer-events: none; }

.fp-discovery-track {
    display: flex;
    gap: 13px;
    overflow-x: auto;
    padding: 6px 6px 10px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.fp-discovery-track::-webkit-scrollbar { display: none; }

/* ----- card ----- */
.fp-disc-card {
    position: relative;
    flex: 0 0 148px;
    width: 148px;
    scroll-snap-align: start;
}

.fp-disc-poster {
    position: relative;
    display: block;
    aspect-ratio: 2 / 3;
    border-radius: 16px;
    overflow: hidden;
    background: #0c1320;
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 14px 30px -16px rgba(0, 0, 0, .8);
    transition: transform .4s var(--fp-disc-ease), box-shadow .4s var(--fp-disc-ease), border-color .3s ease;
}

.fp-disc-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s var(--fp-disc-ease);
}

.fp-disc-shade {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 55%, rgba(5, 8, 14, .72) 100%);
}

@media (hover: hover) and (pointer: fine) {
    .fp-disc-card:hover .fp-disc-poster {
        transform: translateY(-4px);
        border-color: rgba(120, 170, 255, .4);
        box-shadow: 0 22px 44px -16px rgba(0, 0, 0, .85), 0 0 30px -12px rgba(47, 123, 255, .55);
    }
    .fp-disc-card:hover .fp-disc-poster img { transform: scale(1.06); }
}

.fp-disc-live {
    position: absolute;
    top: 9px;
    right: 9px;
    z-index: 3;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #e53245;
    box-shadow: 0 0 0 2px rgba(8, 12, 20, .6), 0 0 10px rgba(229, 50, 69, .8);
}

.fp-disc-score {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 21px;
    padding: 0 7px;
    border-radius: 7px;
    font-size: 11.5px;
    font-weight: 800;
    color: #fff;
    background: rgba(8, 11, 18, .68);
    border: 1px solid rgba(255, 196, 81, .4);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.fp-disc-score svg { width: 11px; height: 11px; fill: var(--fp-star); }

/* wishlist heart (reuses the site-wide js-wishlist-toggle; styled scoped here
   because poster-wishlist-heart.css is not loaded on detail pages) */
.fp-disc-heart.wishlist-heart {
    position: absolute;
    top: 7px;
    left: 7px;
    z-index: 4;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: rgba(255, 255, 255, .94);
    background: rgba(8, 11, 18, .5);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: color .2s ease, background-color .2s ease, transform .18s ease;
}
.fp-disc-heart.wishlist-heart:hover { color: #fff; background: rgba(8, 11, 18, .72); transform: scale(1.08); }
.fp-disc-heart.wishlist-heart:active { transform: scale(.9); }
.fp-disc-heart.wishlist-heart.active { color: #ff5f78; }
.fp-disc-heart .fp-poster-heart-icon { width: 17px; height: 17px; }
.fp-disc-heart.active .fp-poster-heart-icon .fp-poster-heart-body { fill: url(#fp-poster-heart-fill); }

/* recommendation poster hearts: NO square box / background / blur — just the
   clean animated heart (a home.css .wishlist-heart rule was drawing the box;
   this scoped rule wins). A drop-shadow keeps it readable on light posters. */
.fp-disc-card .fp-disc-heart.wishlist-heart,
.fp-disc-card .fp-disc-heart.wishlist-heart:hover,
.fp-disc-card .fp-disc-heart.wishlist-heart:focus,
.fp-disc-card .fp-disc-heart.wishlist-heart.active {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    border-radius: 0 !important;
    width: 34px !important;
    height: 34px !important;
}
.fp-disc-card .fp-disc-heart .fp-poster-heart-icon {
    width: 26px !important;
    height: 26px !important;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .65));
}

.fp-disc-meta {
    display: block;
    margin-top: 9px;
    text-decoration: none;
}

.fp-disc-meta strong {
    display: block;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fp-disc-meta span {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
}

.fp-disc-meta span i {
    font-style: normal;
    font-size: 10.5px;
    color: rgba(226, 232, 240, .72);
}

.fp-disc-meta span i.fp-disc-imdb {
    color: #f4d68a;
    font-weight: 700;
}

/* desktop: reveal paging arrows; mobile keeps native swipe */
@media (min-width: 860px) {
    .fp-discovery-nav { display: inline-flex; }
    .fp-disc-card { flex-basis: 158px; width: 158px; }
}

@media (prefers-reduced-motion: reduce) {
    .fp-disc-card:hover .fp-disc-poster,
    .fp-disc-card:hover .fp-disc-poster img,
    .fp-rate-star,
    .fp-rate-star:hover { transform: none; transition: none; }
    .fp-rate-panel.is-justsaved .fp-rate-star.is-on svg path { animation: none; }
}
