/* =====================================================================
   SIMPLY — PREMIUM POLISH LAYER
   Loaded after style.css. Token-driven: every accent flows through
   var(--primary) so admin color/brand overrides remain authoritative.
   Goal: elevate the stock tube to a best-in-class, flagship feel without
   touching the base stylesheet or the admin appearance machinery.
   ===================================================================== */

:root {
    /* Motion */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --t-fast: 0.16s;
    --t-med: 0.28s;

    /* Layered, premium shadow scale (softer + tinted depth) */
    --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.05);
    --shadow-pop: 0 6px 16px rgba(15, 23, 42, 0.10), 0 14px 40px rgba(15, 23, 42, 0.12);
    --ring: 0 0 0 3px rgba(var(--primary-rgb), 0.28);
}

/* Smooth, intentional motion globally (respects reduced-motion below) */
html { scroll-behavior: smooth; }

/* Premium text selection + focus ring */
::selection { background: rgba(var(--primary-rgb), 0.22); color: var(--text); }
:focus-visible {
    /* Transparent outline anchors the ring and stays visible under forced-colors. */
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: var(--ring);
}
@media (forced-colors: active) {
    :focus-visible { outline-color: Highlight; }
}

/* Refined scrollbar (desktop) */
@media (hover: hover) {
    * { scrollbar-width: thin; scrollbar-color: rgba(var(--primary-rgb), 0.35) transparent; }
    ::-webkit-scrollbar { width: 11px; height: 11px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb {
        background: rgba(100, 116, 139, 0.35);
        border: 3px solid transparent;
        border-radius: 999px;
        background-clip: content-box;
    }
    ::-webkit-scrollbar-thumb:hover { background: rgba(var(--primary-rgb), 0.55); background-clip: content-box; }
}

/* =====================================================================
   HEADER — frosted glass, confident spacing, accent search
   ===================================================================== */
.header {
    transition: box-shadow var(--t-med), background var(--t-med);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    backdrop-filter: saturate(140%) blur(14px);
}
@supports (background: color-mix(in srgb, red, blue)) {
    .header { background: color-mix(in srgb, var(--bg) 82%, transparent); }
}
.header--scrolled {
    box-shadow: 0 1px 0 var(--border), var(--shadow-soft);
}

/* Nav links: animated accent underline, crisp active state */
.header-nav__inner > a,
.header__nav-dropdown > a {
    position: relative;
    font-weight: 600;
    transition: color var(--t-fast), background var(--t-fast);
}
.header-nav__inner > a::after,
.header__nav-dropdown > a::after {
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 3px;
    height: 2px;
    border-radius: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transform-origin: left;
    opacity: 0;
    transition: transform var(--t-med) var(--ease-out), opacity var(--t-fast);
}
@media (hover: hover) {
    .header-nav__inner > a:hover::after,
    .header__nav-dropdown > a:hover::after { transform: scaleX(1); opacity: 0.55; }
}
.header-nav__inner > a.active::after,
.header__nav-dropdown > a.active::after { transform: scaleX(1); opacity: 1; }

/* Search — pill with an inset accent submit button */
.header__search input {
    padding-inline-end: 50px;
    border-radius: 999px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.header__search input:focus { box-shadow: var(--ring); }
/* RTL: keep the decorative glyph at the inline-start so it never collides
   with the submit button (which flips to inline-end automatically). */
[dir="rtl"] .header__search svg,
[dir="rtl"] .header__search > i { left: auto; right: 14px; }
[dir="rtl"] .header__search input { padding-inline-start: 38px; }
.header__search-btn {
    position: absolute;
    top: 4px;
    inset-inline-end: 4px;
    bottom: 4px;
    width: 42px;
    border: none;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 0;
    transition: filter var(--t-fast), transform var(--t-fast);
}
.header__search-btn:hover { filter: brightness(1.07) saturate(1.05); }
.header__search-btn:active { transform: scale(0.94); }
.header__search:focus-within .header__search-btn { box-shadow: 0 2px 10px rgba(var(--primary-rgb), 0.45); }

/* Account trigger polish */
.udd__trigger {
    transition: color var(--t-fast), background var(--t-fast), transform var(--t-fast);
    border-radius: 999px;
}
.udd__trigger:hover { color: var(--primary); }
.udd__trigger:active { transform: scale(0.95); }

/* =====================================================================
   VIDEO CARDS — the flagship surface
   Borderless, thumb-led, gradient scrim, frosted duration, smooth hover
   ===================================================================== */
.video-card {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
    /* Grid items get an automatic min-size of their min-content; the base theme
       relied on overflow:hidden to zero it. We keep overflow visible for the
       hover-lift shadow, so restore the shrink explicitly or nowrap titles
       blow out the 1fr tracks and the column count collapses. */
    min-width: 0;
    transition: transform var(--t-med) var(--ease-out);
}
.video-card__info, .video-card__title { min-width: 0; max-width: 100%; }
.video-card__thumb {
    border-radius: var(--card-radius, 8px);
    box-shadow: var(--shadow-soft);
    background: #0d1220;
    transition: box-shadow var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out);
}

/* Bottom scrim so duration/badges stay legible on bright thumbs */
.video-card__thumb::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(to top, rgba(8, 10, 18, 0.55) 0%, rgba(8, 10, 18, 0.12) 22%, rgba(8, 10, 18, 0) 42%);
    opacity: 0.85;
    transition: opacity var(--t-med);
}

/* Resting play affordance — fades out as the hover preview takes over */
.video-card__thumb::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 52px;
    height: 52px;
    transform: translate(-50%, -50%) scale(1);
    border-radius: 50%;
    z-index: 3;
    pointer-events: none;
    background: rgba(12, 14, 22, 0.42) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z' fill='white'/%3E%3C/svg%3E") center / 20px no-repeat;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity var(--t-med), transform var(--t-med) var(--ease-spring);
}
@media (hover: hover) {
    .video-card:hover .video-card__thumb {
        transform: translateY(-4px);
        box-shadow: var(--shadow-pop), 0 0 0 1px rgba(var(--primary-rgb), 0.35);
    }
    .video-card:hover .video-card__thumb::before { opacity: 1; }
    /* Show play hint at rest, hide it the moment a preview plays */
    .video-card .video-card__thumb::after { opacity: 0; }
    .video-card:hover .video-card__thumb:not(.is-previewing)::after { opacity: 0.95; transform: translate(-50%, -50%) scale(1.04); }
    .video-card__thumb.is-previewing::after { opacity: 0 !important; }
}

/* Frosted, premium duration pill */
.video-card__duration {
    z-index: 4;
    pointer-events: none;
    bottom: 7px;
    right: 7px;
    background: rgba(8, 10, 18, 0.72);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Graceful fallback when a thumbnail file is missing on disk: never show a
   broken-image glyph — degrade to a neutral framed-play placeholder. */
.video-card__thumb--noimg {
    background: #0d1220 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='1.4'%3E%3Crect x='3' y='5' width='18' height='14' rx='2.5'/%3E%3Cpath d='M10 9l5 3-5 3z' fill='%23475569' stroke='none'/%3E%3C/svg%3E") center / 42px no-repeat;
}
.video-card__thumb--noimg::after { opacity: 0 !important; }

/* Keep preview/scrub above the scrim */
.video-card__preview, .video-card__sprite { z-index: 2; border-radius: var(--card-radius, 8px); }
.video-card__preview-progress { z-index: 5; height: 4px; box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.5); }

/* Info block — tighter, sharper typography */
.video-card__info { padding: 9px 2px 4px; }
.video-card__title {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.1px;
    margin-bottom: 5px;
}
.video-card__title a { transition: color var(--t-fast); }
.video-card__meta {
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.1px;
}
.video-card__meta span:first-child { color: var(--text-muted); font-weight: 600; }
.video-card__meta span:last-child { color: var(--text-light); }

/* =====================================================================
   SECTION HEADERS — accent rail + tick, premium "More" pill
   ===================================================================== */
.section-title-row .section-title {
    position: relative;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding-inline-start: 14px;
    border-bottom-width: 3px;
}
.section-title-row .section-title::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 2px;
    bottom: 10px;
    width: 4px;
    border-radius: 3px;
    background: var(--primary);
}
.section-more {
    border-bottom-width: 3px;
    transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
    border-radius: 6px 6px 0 0;
}
@media (hover: hover) {
    .section-more:hover { background: rgba(var(--primary-rgb), 0.08); color: var(--primary); }
}

/* =====================================================================
   PAGINATION — premium pills
   ===================================================================== */
.pagination__link {
    transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
@media (hover: hover) {
    .pagination__link:hover { transform: translateY(-1px); background: rgba(var(--primary-rgb), 0.08); }
}
.pagination__link--active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.35);
}

/* =====================================================================
   WATCH PAGE — cinematic player, premium actions
   ===================================================================== */
.video-player {
    box-shadow: var(--shadow-pop);
    border-radius: var(--radius-lg);
}
.video-info__title { letter-spacing: -0.3px; }

.vote-btn, .btn-icon {
    transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.vote-btn:active, .btn-icon:active { transform: scale(0.96); }
.vote-btn.active.like {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

/* Related/recommended cards inherit the premium card treatment automatically */
.recommended-more__btn {
    transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
@media (hover: hover) {
    .recommended-more__btn:hover {
        background: var(--primary);
        border-color: var(--primary);
        color: #fff;
        transform: translateY(-1px);
        box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.3);
    }
}

/* =====================================================================
   ENTITY CARDS (categories / performers / studios) — consistent polish
   ===================================================================== */
.category-card, .performer-card, .studio-card { transition: transform var(--t-med) var(--ease-out); }
@media (hover: hover) {
    .category-card:hover, .performer-card:hover, .studio-card:hover { transform: translateY(-3px); }
}

/* =====================================================================
   RESPONSIVE REFINEMENTS
   ===================================================================== */
/* Touch devices: no hover to reveal the play hint, so show it — but subtly,
   so a dense grid stays clean rather than peppered with bright glyphs. */
@media (hover: none) {
    .video-card__thumb::after { opacity: 0.5; }
}

@media (max-width: 768px) {
    .section-title-row .section-title { font-size: 15px; padding-inline-start: 11px; letter-spacing: 0.3px; }
    .section-title-row .section-title::before { width: 3px; }
    .video-card__thumb::after { width: 44px; height: 44px; background-size: 17px; }
    .video-card__info { padding: 7px 2px 2px; }
    .video-card__title { font-size: 12.5px; }
    .header__search-btn { width: 38px; }
}

@media (max-width: 480px) {
    .video-card__thumb { box-shadow: 0 1px 4px rgba(15, 23, 42, 0.10); }
}

/* Ultra-wide: keep the grid breathing inside max-width, denser feel */
@media (min-width: 1700px) {
    .video-card__info { padding: 11px 3px 5px; }
    .video-card__title { font-size: 14px; }
}

/* =====================================================================
   MOTION SAFETY
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
    .video-card:hover .video-card__thumb { transform: none; }
}
