/* ===========================================================================
   Tamasha — Global / Shared styles
   ---------------------------------------------------------------------------
   Loaded on every screen *before* the page-specific stylesheet so all pages
   share the same:
     • CSS reset
     • Color tokens (CSS custom properties)
     • Typography baseline
     • Button system (.btn / .btn-primary / .btn-secondary / .btn-ghost
                     + .btn-icon / .btn-icon--badge)
     • Common loading / error / spinner states

   Page-specific CSS files can override any of these tokens or rules where a
   single screen genuinely needs to differ — but the defaults below match the
   latest Figma so most screens shouldn't need to override anything.
   =========================================================================== */

/* ===========================
   Typography — Museo Sans (same family Android Tamasha uses for every
   screen). The four weights map 1:1 to Android's @font/museosans_*:
     100 → Thin     (museosans_100.ttf)
     300 → Light    (museosans_300.ttf — used for descriptions / body)
     500 → Medium   (museosans_500.ttf — the default for almost all text)
     700 → Bold     (museosans_700.ttf — titles, button labels)
   The TTFs live in /fonts and are referenced relatively from this file
   (`../fonts/...`) so any screen that links global.css gets them.
   =========================== */
@font-face {
    font-family: 'Museo Sans';
    src: url('../fonts/museosans_100.ttf') format('truetype');
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Museo Sans';
    src: url('../fonts/museosans_300.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Museo Sans';
    src: url('../fonts/museosans_500.ttf') format('truetype');
    font-weight: 400 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Museo Sans';
    src: url('../fonts/museosans_700.ttf') format('truetype');
    font-weight: 700 900;
    font-style: normal;
    font-display: swap;
}

/* ===========================
   CSS variables (design tokens)
   =========================== */
:root {
    --bg:                 #04060B;
    --bg-soft:            rgba(255, 255, 255, 0.06);
    --bg-soft-hover:      rgba(255, 255, 255, 0.12);
    --bg-overlay:         rgba(4, 6, 11, 0.95);

    --text-primary:       #FFFFFF;
    --text-strong:        #F5F6FA;
    --text-secondary:     #C4C7C5;
    --text-muted:         #88898D;
    --text-disabled:      rgba(217, 217, 217, 0.6);

    --primary:            #0066FF;
    --primary-strong:     #007AFF;
    --primary-soft:       #5b86e5;
    --primary-gradient:   linear-gradient(90deg, #0066FF 0%, #5b86e5 100%);
    --focus-ring:         #FFFFFF;

    --accent-rating:      #FFD24A;
    --danger:             #FF5252;
    --success:            #4ADE80;

    --radius-pill:        999px;
    --radius-md:          10px;
    --radius-sm:          6px;

    /* Museo Sans first — same font Android Tamasha uses everywhere.
       Inter remains as a quick-loading fallback while the TTFs are
       being fetched on first paint. */
    --font-stack:         'Museo Sans', 'Inter', system-ui, -apple-system,
                          Segoe UI, Roboto, sans-serif;
}

/* ===========================
   Reset
   =========================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    /* Chromium (webOS) shows scrollbars by default; Samsung WebView does not */
    scrollbar-width: none;
}
*::-webkit-scrollbar {
    display: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: rgba(0, 0, 0, 0);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Force Museo Sans across the whole tree. Tizen TV's webview ships a
   user-agent stylesheet that pins `body` to SamsungOne with high
   specificity — without !important the Tizen rule wins over ours.
   Spelling out the family on `body` *and* `*` covers any descendant
   that resets font-family back to inherit/initial. */
html, body, body * {
    font-family: 'Museo Sans', 'Inter', system-ui, -apple-system,
                 Segoe UI, Roboto, sans-serif !important;
}
.main{
    margin-left: 15px;
}
button {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-family: inherit;
}

img { display: block; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }

/* ===========================
   Button system
   ---------------------------
   Solid 8px-rounded action buttons matching the latest Figma. Three flavours:
     .btn-primary    solid blue fill (Watch, primary CTAs)
     .btn-secondary  semi-transparent gray fill
     .btn-ghost      fully transparent — icon + label only
   The icon container is .btn-icon; SVGs use fill="currentColor" so they
   pick up the button's text colour automatically.
   =========================== */
.btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 8px 18px;
    border: none;
    border-radius: 20px;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    line-height: 20px;
    letter-spacing: -0.2px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.btn[hidden] { display: none; }

.btn .btn-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.btn .btn-icon svg { width: 100%; height: 100%; }

.btn-primary {
    background: var(--primary-strong);
    color: var(--text-primary);
}
.btn-primary:hover { background: #1a8aff; }

.btn-secondary {
    background: var(--bg-soft);
    color: var(--text-secondary);
}
.btn-secondary:hover {
    background: var(--bg-soft-hover);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding-left: 6px;
}
.btn-ghost:hover { color: var(--text-primary); }

/* Focus state — uniform across button variants. Ghost suppresses the ring
   in favour of a soft fill so the focus doesn't look detached. */
.btn.is-focused,
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--focus-ring);
    transform: scale(1.03);
}
.btn-ghost.is-focused,
.btn-ghost:focus-visible {
    box-shadow: none;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}
.btn:active { transform: scale(0.97); }

/* ===========================
   Lock overlay — mirrors Android imgLock + svodOverlay drawables.
   Stamped on locked content thumbnails by TamashaSubscribeDialog.
   createLockBadge(). Sits absolutely over the thumbnail so the host
   element needs position:relative (cards already do).
   =========================== */
.lock-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.6));
    pointer-events: none;
    border-radius: inherit;
    z-index: 3;
}
.lock-overlay-icon {
    width: 26px;
    height: 26px;
    color: #E3E3E3;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}
@media (min-width: 1280px) {
    .lock-overlay-icon { width: 32px; height: 32px; }
}
@media (min-width: 1900px) {
    .lock-overlay-icon {width: 50px;height: 50px;}
}

/* ===========================
   Pro tag — uses the same Android pro_badge.png raster (blue rounded
   badge with a white crown + "PRO" letters), placed by createLockBadge().
   Square cards (default): top-right corner — matches imgProSquare in
   home_carousal_thumbnail.xml.
   Round cards: bottom-centre over the logo — matches proTagRound.
   =========================== */
.pro-tag,
.pro-tag--round {
    position: absolute;
    top: 0;
    right: 0;
    width: 46px;
    height: auto;
    pointer-events: none;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}
/* By default the square (PNG) PRO badge is shown; the rounded
   (SVG) variant is hidden. Round-card surfaces flip this. */
.pro-tag--round { display: none; }

/* Round cards (home live rail) — use the rounded pill SVG and pin it
   to the bottom-centre to match Android `proTagRound`. */
.card.card--round .pro-tag        { display: none; }
.card.card--round .pro-tag--round {
    display: block;
    top: 116px;
    right: auto;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

@media (min-width: 1280px) {
    .pro-tag, .pro-tag--round { width: 60px; }
}
@media (min-width: 1900px) {
    .pro-tag, .pro-tag--round {width: 85px;}
}

/* ===========================
   Reusable pill / tag
   =========================== */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--bg-soft);
    color: #D9D9D9;
    font-size: 11px;
    line-height: 16px;
    letter-spacing: 0.2px;
}

/* Live badge — red pill with white indicator dot. Mirrors Android's
   `live_rounded_container` drawable (error_red #B3261E, fully rounded)
   and the `liveText` TextView (museosans 500, weight 600, white). Stamp
   one wherever a live stream is showing. */
.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #B3261E;
    color: #FFFFFF;
    padding: 3px 10px;
    border-radius: 999px;
    font-family: inherit;
    font-weight: 600;
    font-size: 11px;
    line-height: 14px;
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.live-pill[hidden] { display: none; }
.live-pill .live-dot {
    width: 6px;
    height: 6px;
    background: #FFFFFF;
    border-radius: 50%;
}
@media (min-width: 1280px) {
    .live-pill { font-size: 13px; padding: 4px 12px; gap: 5px; }
    .live-pill .live-dot { width: 7px; height: 7px; }
}
@media (min-width: 1900px) {
    .live-pill { font-size: 24px; padding: 20px 28px; gap: 6px; }
    .live-pill .live-dot { width: 9px; height: 9px; }
}

/* ===========================
   Common page states
   =========================== */
.page-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg-overlay);
    z-index: 50;
}
.page-state[hidden] { display: none; }
.state-msg {
    color: rgba(217, 217, 217, 0.85);
    font-size: 15px;
    line-height: 22px;
    max-width: 480px;
    text-align: center;
}

/* ===========================
   Spinner (used by loading states across pages)
   1:1 port of Android `progress_background.xml`: sweep-gradient ring
   (transparent → #1A1293FB → #1293FB) rotating 0° → 1080° continuously.
   Same visual as the shared TamashaLoader so every in-page spinner
   reads identical to the overlay loader.
   =========================== */
.spinner {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
        rgba(18, 147, 251, 0)   0deg,
        rgba(18, 147, 251, 0.1) 180deg,
        #1293FB                 360deg);
    -webkit-mask: radial-gradient(circle, transparent 43px, #000 46px);
            mask: radial-gradient(circle, transparent 43px, #000 46px);
    animation: tamasha-spin 3s linear infinite;
}
@keyframes tamasha-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(1080deg); }
}

/* ===========================
   Responsive scale-up (FHD / 4K)
   =========================== */
@media (min-width: 1280px) {
    .btn { height: 48px; font-size: 16px; padding: 10px 22px; }
    .btn .btn-icon { width: 22px; height: 22px; }
    .pill { font-size: 13px; padding: 4px 12px; }
}

@media (min-width: 1900px) {
    .btn { height: 64px; font-size: 19px; padding: 14px 30px; gap: 14px; }
    .btn .btn-icon { width: 40px; height: 40px; }
    .pill { font-size: 15px; padding: 5px 14px; }
}
