/* ==========================================================================
   Beat-FlixVision pillars — polish layer on top of the mobile UX pass.
   CSS-first, no dependencies. Global rules are additive (focus glow,
   transitions, shimmer) and safe on TV; layout changes stay phone-only.
   ========================================================================== */

:root {
  --aw-accent: #f4b942; /* StreamVerse warm accent: focus rings, buttons, badges */
  --aw-accent-soft: rgba(244, 185, 66, 0.35);
}

/* ---- Pillar 5: branded boot splash (near-black, wordmark, <600ms) -------- */
#aw-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f0f0f;
  pointer-events: none; /* never blocks interaction */
  animation: aw-splash-out 0.25s ease 0.45s forwards;
}

#aw-splash img {
  width: min(46vw, 220px);
  height: auto;
  opacity: 0;
  animation: aw-splash-in 0.3s ease-out 0.05s forwards;
}

@keyframes aw-splash-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes aw-splash-out {
  to { opacity: 0; visibility: hidden; }
}

/* ---- Pillar 3: motion & polish (TV + phone) ------------------------------ */

/* 150-250ms ease-in on primary view containers */
.home-screen-shell,
.detail-hero-section,
.settings-workspace,
.search-shell,
[class*="catalog-see-all"],
[class*="folder-detail"] {
  animation: aw-view-in 0.22s ease-out;
}

@keyframes aw-view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Poster/card focus & hover: slight scale + soft glow (D-pad .focused too) */
.home-content-card,
.home-poster-card,
.card,
.poster-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.home-content-card.focused,
.home-poster-card.focused,
.card.focused,
.poster-card.focused,
.home-content-card:hover,
.home-poster-card:hover,
.card:hover,
.poster-card:hover {
  transform: scale(1.045);
  box-shadow:
    0 0 0 2px var(--aw-accent),
    0 14px 34px rgba(0, 0, 0, 0.55),
    0 0 26px var(--aw-accent-soft);
  z-index: 2;
}

/* Skeleton shimmer wherever the app shows loading blocks — never a blank
   black box. */
.detail-loading-block,
.detail-loading-chip,
.detail-loading-line,
.detail-loading-pill,
.detail-loading-poster,
.detail-loading-shell,
[class*="skeleton"],
[class*="loading-block"] {
  position: relative;
  overflow: hidden;
  background: #1c1c1c !important;
}

.detail-loading-block::after,
.detail-loading-chip::after,
.detail-loading-line::after,
.detail-loading-pill::after,
.detail-loading-poster::after,
.detail-loading-shell::after,
[class*="skeleton"]::after,
[class*="loading-block"]::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.07),
    transparent
  );
  animation: aw-shimmer 1.4s infinite;
}

@keyframes aw-shimmer {
  to { transform: translateX(100%); }
}

/* Backdrop crossfade on details pages */
.detail-hero-section img,
.home-hero-backdrop-wrap img,
[class*="backdrop"] img {
  transition: opacity 0.25s ease;
}

/* ---- Pillar 5: consistent accent on focus rings, buttons, badges --------- */
.focusable.focused,
button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible {
  outline: none;
}

button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible {
  box-shadow: 0 0 0 2px var(--aw-accent) !important;
}

/* ---- Pillar 2 + 6: kids-ready, zero-dead-ends — friendly state styling --- */
/* (Copy changes live in source where editable — e.g. Sources.jsx now says
   "This stream needs another player". The bundled TV UI copy is minified,
   so here we guarantee every empty/error state at least LOOKS gentle and
   its retry/next-action buttons are big and obvious.) */
[class*="empty-state"],
[class*="error-state"],
[class*="error-message"],
.auth-error,
.debrid-panel__warning {
  border-radius: 16px !important;
  padding: 18px 20px !important;
  background: #1a1a1a !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #e8e2d6 !important;
  line-height: 1.5;
}

[class*="empty-state"] button,
[class*="error-state"] button,
[class*="retry" i],
.auth-simple-hero button {
  min-height: 44px;
  border-radius: 12px;
}

/* Reduced motion: respect the OS setting */
@media (prefers-reduced-motion: reduce) {
  .home-screen-shell,
  .detail-hero-section,
  .settings-workspace,
  .search-shell {
    animation: none;
  }

  .home-content-card,
  .home-poster-card,
  .card,
  .poster-card {
    transition: none;
  }
}

/* ---- Pillar 1: cross-device identity on phone ----------------------------- */
/* The TV shell keeps the profile chip in the sidebar; on phones the sidebar
   is hidden, so surface a compact avatar chip top-right that jumps to the
   profile/settings area (injected by mobile-nav.js, reusing gotoAccount). */
.aw-profile-chip {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: 10px;
  z-index: 900;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--aw-accent);
  background: #232323;
  color: var(--aw-accent);
  font: 700 15px/1 "Inter", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media (min-width: 768px) {
  .aw-profile-chip {
    display: none !important; /* TV/desktop keep the sidebar profile */
  }
}

/* ---- StreamVerse: PIN-locked Adults section (all viewports, additive) ---- */
.sv-adults-launcher {
  position: fixed;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 950;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: #232323;
  color: var(--aw-accent, #f4b942);
  font: 600 14px/1 "Inter", "Segoe UI", sans-serif;
  cursor: pointer;
  opacity: 0.85;
}
@media (max-width: 767px) {
  /* sit above the phone bottom nav */
  .sv-adults-launcher {
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }
}

.sv-adults-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 10, 10, 0.92);
  overflow-y: auto;
}

.sv-adults-card {
  width: min(460px, 100%);
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 24px 20px;
  color: #f5f2ec;
}

.sv-adults-title {
  margin: 0 0 8px;
  font-size: 22px;
}

.sv-adults-subtitle {
  margin: 0 0 16px;
  color: #a8a29a;
  font-size: 14px;
  line-height: 1.5;
}

.sv-adults-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 8px 0;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #0f0f0f;
  color: #f5f2ec;
  font-size: 16px;
}

.sv-adults-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.sv-adults-btn {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: #232323;
  color: #f5f2ec;
  font: 600 15px/1 "Inter", "Segoe UI", sans-serif;
  cursor: pointer;
}

.sv-adults-btn.is-primary {
  background: var(--aw-accent, #f4b942);
  border-color: transparent;
  color: #120c02;
}

.sv-adults-btn-small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
}

.sv-adults-error {
  margin: 10px 0 0;
  color: #ff8a80;
  font-size: 14px;
}

.sv-adults-empty {
  color: #a8a29a;
  font-size: 14px;
  line-height: 1.5;
}

.sv-adults-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sv-adults-item-link {
  color: var(--aw-accent, #f4b942);
  text-decoration: none;
  overflow-wrap: anywhere;
}

/* ---- StreamVerse: external player launcher (Android only) ---- */
.sv-ext-launcher {
  position: fixed;
  left: 10px;
  bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  z-index: 950;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(35, 35, 35, 0.95);
  color: #f5f2ec;
  font: 600 14px/1 "Inter", "Segoe UI", sans-serif;
  cursor: pointer;
}

.sv-ext-menu {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 2100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
  padding: 12px;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
}

.sv-ext-menu-btn {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: #232323;
  color: #f5f2ec;
  font: 600 15px/1 "Inter", "Segoe UI", sans-serif;
  cursor: pointer;
}

.sv-ext-menu-btn.is-cancel {
  background: transparent;
  color: #a8a29a;
}

/* ---- StreamVerse a11y: restore visible focus ------------------------------
   components.css globally suppresses outlines; give keyboard users a clear
   focus ring and D-pad (.focused) users a visible indicator everywhere. ---- */
.focusable.focused,
.card.focused,
a:focus-visible,
button:focus-visible,
input:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--aw-accent, #f4b942) !important;
  outline-offset: 2px;
}

