/*
 * v2-anime.css — the anime detail + episode page of the animeunity-v2 theme
 * (resources/themes/animeunity-v2/views/frontend/{anime,watch}.blade.php,
 * partials/anime/*, partials/watch/*). Pushed by partials/anime/scripts.
 *
 * The layout itself is animeunity.cx's Tailwind class lists in the markup
 * (css/app.css, vendored). This file holds only what those cannot say:
 * states the engine writes (.active, .au-filler, .au-seen, .expand, .show …),
 * the engine's own nodes inside #player, the md+ grid placement, and the
 * CMS-only pieces (stars, downloads table, new-tab server overlay).
 * Everything is scoped under #anime / .v2-… ; colours are the theme tokens,
 * so dark and light both follow.
 */

/* ---------- header ---------- */

/* "Aggiungi alla lista" (shared partial, `button` variant) in this page's
   32px look: animeunity.cx's `flex h-8 … rounded bg-blue-200 px-1.5 text-xs
   font-bold … sm:px-2 sm:text-sm`, no plus sign. */
#anime .v2-an-list { display: flex; }
#anime .v2-an-list > a {
    display: flex; flex: 1 1 0%; min-width: 0; height: 2rem; align-items: center; justify-content: center; gap: 0;
    padding: 0 .375rem; border-radius: .25rem; background-color: rgba(var(--tw-blue-200));
    font-size: .75rem; line-height: 1rem; font-weight: 700; color: #fff; box-shadow: none;
    transition: all .3s;
}
#anime .v2-an-list > a:hover { filter: brightness(.9); box-shadow: none; }
#anime .v2-an-list > a > svg { display: none; }
#anime .v2-an-list .au-folder-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 500px) {
    #anime .v2-an-list > a { padding: 0 .5rem; font-size: .875rem; line-height: 1.25rem; }
}
#anime .v2-an-list .v2-folders { left: 0; right: auto; z-index: 40; }

/* The heart once it is the member's "love" (animeunity-detail.js: .au-on / .au-busy). */
#anime .v2-an-heart.au-on { background-color: #fff; color: rgb(239 68 68); box-shadow: inset 0 0 0 2px rgb(239 68 68); }
#anime .v2-an-heart.au-busy { opacity: .6; pointer-events: none; }

/* "Leggi tutto" lifted (v2-anime.js). */
#anime [data-v2-plot].v2-open { max-height: none; }
#anime [data-v2-plot] { white-space: pre-line; }

/* ---------- the grid from md (800px) ---------- */

@media (min-width: 800px) {
    #anime .v2-an-grid { grid-template-rows: auto 1fr; }
    #anime .v2-an-side { grid-column: 1; grid-row: 1 / span 2; }
    #anime .v2-an-main { grid-column: 2; grid-row: 1; min-width: 0; }
    #anime .v2-an-below { grid-column: 2; grid-row: 2; }
    #anime .v2-an-rel3 { grid-column: 3; grid-row: 1 / span 2; }

    /* Espandi (main.js ExpandControl: `.expand` on #watch-main). */
    #anime .v2-an-grid:has(> .v2-an-main.expand) { grid-template-rows: auto auto 1fr; }
    #anime .v2-an-main.expand { grid-column: 1 / -1; max-width: none; }
    #anime .v2-an-grid:has(> .v2-an-main.expand) > .v2-an-side { grid-row: 2 / span 2; }
    #anime .v2-an-grid:has(> .v2-an-main.expand) > .v2-an-below { grid-row: 2; }
    #anime .v2-an-grid:has(> .v2-an-main.expand) > .v2-an-rel3 { grid-row: 2 / span 2; }
}

/* ---------- facts box ---------- */

/* main.js Rating: five bare spans in .stars (their class attribute is
   rewritten to "", "half" or "full"), a .message for the hover label. */
#anime .v2-an-stars { display: inline-flex; gap: 2px; margin-left: .375rem; cursor: pointer; }
#anime .v2-an-stars span {
    width: 12px; height: 12px; background-color: rgba(var(--tw-fore-500));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 576 512'%3E%3Cpath d='M316.9 18c-5.3-11-16.5-18-28.8-18s-23.4 7-28.8 18L195 150.3L51.4 171.5c-12 1.8-22 10.2-25.7 21.7s-.7 24.2 7.9 32.7L137.8 329l-24.6 145.7c-2 12 3 24.2 12.9 31.3s23 8 33.8 2.3l128.3-68.5l128.3 68.5c10.8 5.7 23.9 4.9 33.8-2.3s14.9-19.3 12.9-31.3L438.5 329l104.2-103.1c8.6-8.5 11.7-21.2 7.9-32.7s-13.7-19.9-25.7-21.7l-143.7-21.2z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 576 512'%3E%3Cpath d='M316.9 18c-5.3-11-16.5-18-28.8-18s-23.4 7-28.8 18L195 150.3L51.4 171.5c-12 1.8-22 10.2-25.7 21.7s-.7 24.2 7.9 32.7L137.8 329l-24.6 145.7c-2 12 3 24.2 12.9 31.3s23 8 33.8 2.3l128.3-68.5l128.3 68.5c10.8 5.7 23.9 4.9 33.8-2.3s14.9-19.3 12.9-31.3L438.5 329l104.2-103.1c8.6-8.5 11.7-21.2 7.9-32.7s-13.7-19.9-25.7-21.7l-143.7-21.2z'/%3E%3C/svg%3E") center / contain no-repeat;
}
#anime .v2-an-stars span.full { background-color: rgb(250 204 21); }
#anime .v2-an-stars span.half { background: linear-gradient(90deg, rgb(250 204 21) 50%, rgba(var(--tw-fore-500)) 50%); }
#anime .v2-an-rating-msg { flex-basis: 100%; font-size: 11px; line-height: 1.25; color: rgba(var(--tw-text-200)); }
#anime .v2-an-rating-msg:empty { display: none; }
@media (min-width: 800px) {
    #anime .v2-an-stars { margin-left: 0; margin-top: .375rem; }
    #anime .v2-an-stars span { width: 14px; height: 14px; }
    #anime .v2-an-rating-msg { font-size: .75rem; margin-top: .25rem; }
}

/* ---------- player card ---------- */

/* 16:9 from a class: main.js LightControl removes #player-wrapper's style attribute. */
#anime .v2-player-box { padding-bottom: 56.25%; }
#anime .v2-player { position: relative; }
#anime #player-wrapper { z-index: 0; }
#anime .au-cover { position: absolute; inset: 0; background: #000 center / cover no-repeat; opacity: .55; }
#anime #player { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
#anime #player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
#anime #player:has(iframe) { background: #000; }
#anime .au-play {
    display: flex; width: 68px; height: 68px; align-items: center; justify-content: center;
    border-radius: 9999px; background-color: rgba(var(--tw-blue-200)); color: #fff; font-size: 22px;
    box-shadow: 0 6px 24px rgb(0 0 0 / .45); transition: transform .2s, filter .2s;
}
#anime .au-play:hover { transform: scale(1.06); filter: brightness(1.1); }
@media (max-width: 499px) { #anime .au-play { width: 52px; height: 52px; font-size: 17px; } }
/* The engine's own states inside #player. */
#anime #player .loading {
    width: 38px; height: 38px; border: 3px solid rgb(255 255 255 / .25); border-top-color: rgba(var(--tw-blue-200));
    border-radius: 9999px; animation: v2-spin .8s linear infinite;
}
#anime #player .message {
    max-width: 80%; padding: .6rem 1rem; border-radius: .25rem; background: rgb(0 0 0 / .7);
    font-size: .875rem; font-weight: 600; color: #fff; text-align: center;
}
/* No server at all / only new-tab servers. */
#anime .au-novideo { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; padding: 0 1.5rem; font-size: .875rem; font-weight: 700; color: #fff; text-align: center; }
#anime .au-noservers .au-novideo { display: flex; }
#anime .au-noservers #player, #anime .au-extonly #player { display: none; }
#anime .au-extplay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; padding: 1rem; text-align: center; }
#anime .au-extplay[hidden] { display: none; }
#anime .au-extplay-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; }
#anime .au-extplay-note { font-size: .75rem; color: rgb(255 255 255 / .85); text-shadow: 0 1px 2px #000; }

/* The header tools (Auto Play, Visto, Guarda insieme, Segnala). */
#anime .v2-top-tool { color: rgba(var(--tw-text-100)); white-space: nowrap; }
#anime .v2-top-tool.au-on { color: rgba(var(--tw-blue-100)); }
#anime .v2-top-tool i { font-size: 13px; }
@media (max-width: 499px) { #anime .v2-top-tool { padding-left: .5rem; padding-right: .5rem; } }

/* Dead ends of Precedente / Successivo (animeunity-watch.js). main.js .show()s
   the controls at bind (inline display), hence !important. */
#anime .au-none { display: none !important; }
#anime .v2-ctl:focus-visible, #anime .v2-top-tool:focus-visible, #anime .v2-pill:focus-visible, #anime .v2-ep:focus-visible { outline: 2px solid rgba(var(--tw-blue-200)); outline-offset: 2px; }

/* ---------- Audio / Server box ---------- */

#anime .v2-pill { background-color: rgba(var(--tw-fore-600)); color: inherit; }
#anime .v2-pill:hover { background-color: rgba(var(--tw-fore-500)); }
#anime .v2-pill.active, #anime .v2-pill.au-active { background-color: rgba(var(--tw-blue-200)); color: #fff; }
#anime .au-srv-row--off { display: none; }
#anime .au-srv-list { display: contents; }
#anime .au-srv-ph { display: none; }
#anime .au-srv-btn { color: inherit; }
#anime li.v2-pill > .au-srv-btn { display: flex; align-items: center; height: 100%; }
#anime .au-srv-out { font-size: 9px; opacity: .8; }
#anime .au-srv-info .fa-solid { font-size: 9px; }
/* Another episode's server list is on its way (animeunity-watch.js). */
#anime .au-svloading .au-srv-main { opacity: .5; pointer-events: none; transition: opacity .2s; }

/* ---------- downloads ---------- */

#anime .au-dl-table th { padding: 0 .5rem .5rem; font-size: .75rem; font-weight: 700; color: rgba(var(--tw-text-200)); text-transform: uppercase; letter-spacing: .02em; }
#anime .au-dl-table td { padding: .5rem; border-top: 1px dashed rgba(var(--tw-fore-600)); vertical-align: middle; }
#anime .au-dl-table th:first-child, #anime .au-dl-table td:first-child { padding-left: 0; }
#anime .au-dl-table th:last-child, #anime .au-dl-table td:last-child { padding-right: 0; }
#anime .au-dl-empty td { color: rgba(var(--tw-text-200)); text-align: center; }

/* ---------- range tabs + episode grid ---------- */

/* The range buttons carry .dropdown-item (main.js); undo the bridge's menu-item look. */
#anime .v2-range { display: block; width: auto; padding: .25rem .5rem; font-weight: 400; color: inherit; text-align: center; white-space: nowrap; background-color: rgba(var(--tw-fore-600)); cursor: pointer; }
#anime .v2-range:hover, #anime .v2-range:focus { background-color: rgba(var(--tw-fore-500)); color: inherit; }
#anime .v2-range.active { background-color: rgba(var(--tw-blue-200)); color: #fff; }
#anime .v2-ep {
    display: flex; width: 45px; height: 30px; align-items: center; justify-content: center; padding: .25rem .5rem;
    border-radius: .375rem; font-size: .875rem; line-height: 1.25rem; font-weight: 700; cursor: pointer;
    background-color: rgba(var(--tw-fore-600)); color: inherit; transition: all .3s cubic-bezier(.4, 0, .2, 1);
}
#anime .v2-ep:hover { background-color: rgba(var(--tw-fore-500)); }
#anime .v2-ep.au-filler { background-color: rgb(127 29 29 / .3); color: #fff; }
#anime .v2-ep.au-filler:hover { background-color: rgb(127 29 29 / .5); }
.light #anime .v2-ep.au-filler { color: rgb(127 29 29); background-color: rgb(127 29 29 / .18); }
/* VISTO (animeunity-watch.js .au-seen): the number steps back. */
#anime .v2-ep.au-seen { background-color: rgba(var(--tw-fore-700)); color: rgba(var(--tw-text-300)); box-shadow: inset 0 -2px 0 rgba(var(--tw-blue-200), .55); }
#anime .v2-ep.au-filler.au-seen { background-color: rgb(127 29 29 / .16); }
#anime .v2-ep.highlight { box-shadow: 0 0 0 2px rgb(250 204 21); }
#anime .v2-ep.active, #anime .v2-ep.active:hover { background-color: rgba(var(--tw-blue-200)); color: #fff; box-shadow: none; }
#anime .v2-ep[enabled="0"] { opacity: .45; }

/* ---------- Consigliati row ---------- */

#anime [data-v2-row-track].v2-dragging { cursor: grabbing; scroll-snap-type: none; }
#anime [data-v2-row-track].v2-dragging a { pointer-events: none; }
#anime [data-v2-row-prev]:not(:disabled), #anime [data-v2-row-next]:not(:disabled) { pointer-events: auto; }
#anime [data-v2-row]:hover [data-v2-row-prev]:not(:disabled), #anime [data-v2-row]:hover [data-v2-row-next]:not(:disabled) { opacity: 1; }
#anime [data-v2-row-prev]:disabled, #anime [data-v2-row-next]:disabled { opacity: 0 !important; pointer-events: none; }

/* ---------- ad slot ---------- */
#anime .au-ad { margin-top: 1.25rem; text-align: center; }
#anime .au-ad:empty { display: none; }

/* ---------- report dialog ---------- */
.v2-report-card select.form-input { appearance: auto; cursor: pointer; }
.v2-report-card textarea.form-input { height: auto; min-height: 96px; resize: vertical; }
.v2-report-card .au-report-ep { margin-bottom: .25rem; }

/* Header tools: "Guarda insieme" spells itself out from 1040px; "Segnala" keeps the reference's px-3. */
#anime .v2-top-label { display: none; }
@media (min-width: 1040px) { #anime .v2-top-label { display: inline; } }
#anime .v2-top-report { padding-left: .75rem; padding-right: .75rem; }

/* The engine's hook for the Light control is the class `light` — which is also the theme class that
   redefines the colour tokens (app.css .light{…}). In the dark theme give the control its dark colours back. */
.dark #anime .ctrl.light { color: rgba(var(--tw-gray-200)); }
.dark #anime .ctrl.light:hover { color: #fff; }
/* "Auto Play" / "Segna come visto" spell themselves out from 600px (icons only below: the row must fit beside "Episodio N"). */
#anime .v2-top-label-sm { display: none; }
@media (min-width: 600px) { #anime .v2-top-label-sm { display: inline; } }
#anime #video-top .title { white-space: nowrap; }
