/* VÉRTICE — interface do assinante (Web + PWA). Mobile-first, tema escuro. */
@import url('/shared/ui.css');

body { overflow-x: hidden; min-width: 0; }
/* Em WebViews antigos o <meta viewport> pode ser ignorado: travar a largura em 100%
   evita que a interface fique "espremida" num canto da tela. */
#app { min-height: 100vh; width: 100%; max-width: 100%; min-width: 0; padding-bottom: 78px; position: relative; z-index: 1; }
.topbar-web, .view, .install-banner { width: 100%; max-width: 100%; }
.view { margin-left: auto; margin-right: auto; }
img, video { max-width: 100%; height: auto; }

/* -------------------------------- Topbar --------------------------------- */
.topbar-web {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 18px;
  padding: 14px 22px; background: rgba(8, 9, 13, 0.82); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.logo-sm { height: 24px; }
.nav-desktop { display: flex; gap: 4px; flex: 1; }
.nav-link { background: none; border: none; color: var(--muted); font-weight: 600; font-size: 13.5px; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav-link.active { color: #fff; background: rgba(124, 77, 255, 0.18); }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--brand-grad); color: #08090d; font-weight: 800; cursor: pointer;
}
.dot { position: absolute; top: 6px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

/* ---------------------------- Banner de instalação ----------------------- */
.install-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin: 12px 22px 0; padding: 12px 16px; border-radius: 12px; font-size: 13px;
  background: linear-gradient(100deg, rgba(124, 77, 255, 0.16), rgba(0, 224, 184, 0.1));
  border: 1px solid rgba(124, 77, 255, 0.32);
}

.view { padding: 0 22px; max-width: 1500px; margin: 0 auto; }

/* --------------------------------- Auth ---------------------------------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; }
.auth-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(900px 500px at 20% 0%, rgba(124, 77, 255, 0.28), transparent 70%),
    radial-gradient(700px 500px at 85% 20%, rgba(0, 224, 184, 0.16), transparent 72%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.02) 0 2px, transparent 2px 9px);
}
.auth-panel {
  position: relative; width: min(420px, 100%); padding: 30px; border-radius: 22px;
  background: rgba(12, 14, 20, 0.86); border: 1px solid var(--line-strong); box-shadow: var(--shadow-2);
  backdrop-filter: blur(18px);
}
.auth-logo { height: 32px; margin-bottom: 20px; }

/* --------------------------------- Hero ---------------------------------- */
.hero {
  position: relative; margin-top: 18px; border-radius: 20px; overflow: hidden; min-height: 400px;
  max-height: 460px; display: flex; align-items: flex-end;
  background-size: cover; background-position: center 30%; border: 1px solid var(--line);
}
.hero-grad { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,9,13,.94) 6%, rgba(8,9,13,.72) 46%, rgba(8,9,13,.25) 100%), linear-gradient(0deg, rgba(8,9,13,.95), transparent 55%); }
.hero-body { position: relative; padding: 46px 40px 34px; max-width: 660px; }
.hero-title { font-size: clamp(28px, 4vw, 46px); margin: 12px 0 10px; }
.hero-synopsis { color: #cfd3e0; font-size: 14.5px; line-height: 1.6; max-width: 56ch; }
.hero-meta { margin-top: 12px; font-size: 12.5px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.hero-actions .btn { flex: 0 1 auto; }

/* ------------------------------- Carrosséis ------------------------------ */
.shelf-section { margin-top: 30px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.shelf-head h2 { font-size: 18px; }
.shelf { display: flex; flex-direction: row; gap: 14px; padding-bottom: 8px; }
.shelf > .media-card { flex: 0 0 172px; min-width: 0; }
.shelf > .media-card .poster,
.grid-cards > .media-card .poster { width: 100%; }

/* ------------------------------- Cards ----------------------------------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-top: 16px; }
.media-card { cursor: pointer; transition: transform 0.16s ease; }
.media-card:hover { transform: translateY(-4px); }
.poster {
  position: relative; aspect-ratio: 2 / 3; border-radius: 12px; background-size: cover; background-position: center;
  background-color: var(--surface-2); border: 1px solid var(--line); overflow: hidden;
}
.poster::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(8,9,13,.6), transparent 45%); }
.media-card:hover .poster { box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5); border-color: rgba(124, 77, 255, 0.5); }
.fav-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(8, 9, 13, 0.66); border: 1px solid var(--line-strong);
  color: #fff; cursor: pointer; backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.15s;
}
.media-card:hover .fav-btn, .fav-btn.on { opacity: 1; }
.fav-btn.on { background: var(--brand-primary); border-color: transparent; }
.live-tag {
  position: absolute; top: 8px; left: 8px; z-index: 2; font-size: 9.5px; font-weight: 800; letter-spacing: .08em;
  padding: 3px 7px; border-radius: 5px; background: var(--danger); color: #fff;
}
.card-progress { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.24); z-index: 2; }
.card-progress span { display: block; height: 100%; border-radius: 99px; background: var(--brand-accent); }
.media-meta { padding: 8px 2px 0; display: flex; flex-direction: column; gap: 2px; }
.media-meta h4 { font-size: 13.5px; font-weight: 650; }

/* ------------------------------- Detalhe --------------------------------- */
.detail-hero { position: relative; border-radius: 20px; overflow: hidden; margin-top: 16px; background-size: cover; background-position: center; border: 1px solid var(--line); }
.detail-body { position: relative; display: flex; gap: 26px; padding: 32px; }
.detail-poster { width: 190px; border-radius: 14px; box-shadow: var(--shadow-2); flex: 0 0 auto; }
.season-block { margin-top: 18px; }
.episode-list { display: grid; gap: 8px; margin-top: 10px; }
.episode {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer; color: var(--text); text-align: left;
}
.episode:hover { border-color: rgba(124, 77, 255, 0.5); background: var(--surface-2); }
.ep-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(124,77,255,.2); font-size: 12px; font-weight: 700; }

/* ------------------------------- Cabeçalhos ------------------------------ */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 26px 0 6px; }
.search-bar { display: flex; gap: 10px; margin-top: 14px; max-width: 620px; }
.search-bar .input { flex: 1; }

/* ------------------------------- Player ---------------------------------- */
.player-shell {
  position: fixed; inset: 0; background: #000; z-index: 200; display: flex; flex-direction: column;
}
.player-shell video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: linear-gradient(180deg, rgba(0,0,0,.75), transparent); }
.player-status { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.player-status .card { pointer-events: auto; }

/* ------------------------------- Conta ----------------------------------- */
.selected-plan { border-color: var(--brand-primary); box-shadow: 0 0 0 1px var(--brand-primary); }
.btn-pay.active { background: rgba(124, 77, 255, 0.2); border-color: var(--brand-primary); color: #fff; }
.unread { border-left: 3px solid var(--brand-primary); }
.row-skeleton { display: grid; gap: 14px; margin-top: 20px; }

/* ------------------------------- Mobile nav ------------------------------ */
.nav-mobile { display: none; }
@media (max-width: 860px) {
  .topbar-web { padding: 10px 14px; }
  .nav-desktop { display: none; }
  .view { padding: 0 14px; }
  .hero { min-height: 0; max-height: none; }
  .hero-body { padding: 22px 18px 24px; }
  .hero-title { font-size: 30px; }
  .hero-synopsis { font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .hero-actions .btn { font-size: 13px; padding: 10px 14px; }
  .detail-body { flex-direction: column; padding: 20px; }
  .detail-poster { width: 128px; }
  /* Celular/tablet pequeno: prateleira vira grade — cabe mais título sem rolagem lateral */
  .shelf {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px; overflow-x: visible; padding-bottom: 0;
  }
  .shelf > .media-card { flex: none; width: 100%; min-width: 0; }
  .grid-cards { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 12px; }
  .nav-mobile {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: rgba(10, 11, 16, 0.94); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .nav-mobile-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px;
    background: none; border: none; color: var(--muted-2); font-size: 10.5px; font-weight: 620; cursor: pointer;
  }
  .nav-mobile-item.active { color: var(--brand-accent); }
  #app { padding-bottom: 76px; }
}

/* ------------------------------- TV / telas grandes ---------------------- */
@media (min-width: 1600px) {
  .view { max-width: 1700px; }
  .shelf > .media-card { flex: 0 0 196px; }
}

/* ------------------------------- Acessibilidade -------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* -------- Limite de dispositivos (tela de escolha) -------- */
.stack-12 { display: flex; flex-direction: column; gap: 10px; }
.gap-8 { gap: 8px; }
.device-option {
  display: flex; align-items: center; gap: 12px; padding: 13px 15px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
  cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.device-option:hover { border-color: rgba(255, 255, 255, .22); }
.device-option input { accent-color: var(--brand-primary); width: 16px; height: 16px; }
.device-option:has(input:checked) { border-color: var(--brand-primary); background: rgba(124, 77, 255, .12); }
.device-option-body { display: flex; flex-direction: column; gap: 3px; }
.device-option-name { font-weight: 640; font-size: 14px; }

/* ========================= Telas pequenas: proporção ========================= */
/* Celulares estreitos (a maioria em retrato) */
@media (max-width: 480px) {
  .view { padding: 0 12px; }
  .install-banner { margin: 10px 12px 0; font-size: 12.5px; }
  .hero-title { font-size: 26px; }
  .hero-synopsis { -webkit-line-clamp: 2; }
  .shelf { gap: 10px; }
  .media-meta h4 { font-size: 12.5px; }
  .pill-tabs button { padding: 6px 11px; font-size: 12px; }
  .topbar-web { gap: 10px; padding: 10px 12px; }
}
/* Celulares muito estreitos (≤340px): 3 colunas continua legível; 2 só no limite */
@media (max-width: 340px) {
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-title { font-size: 23px; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
}
/* Celulares estreitos (341–480px): pôsteres um pouco maiores, 3 colunas */
@media (min-width: 341px) and (max-width: 480px) {
  .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .hero { min-height: 0; }
}

/* ========================= Telas grandes: celular deitado / tablet ========== */
/* Paisagem em celular: usa 4-5 colunas e hero mais baixo, para não "estourar" a altura */
@media (min-width: 481px) and (max-width: 1024px) {
  .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .hero { min-height: 0; max-height: 340px; }
  .hero-body { padding: 24px 22px 26px; }
  .hero-title { font-size: 32px; }
}
@media (min-width: 1025px) and (max-width: 1366px) {
  .shelf { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
}

/* ========================= Tablet / TV por toque ============================= */
/* Tablet em retrato: 4 colunas, cards maiores */
@media (min-width: 700px) and (max-width: 860px) {
  .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ========================= Modelos específicos ============================== */
/* iPhone com notch/island: respeita a área segura em cima e embaixo */
@supports (padding: max(0px)) {
  .topbar-web { padding-top: max(14px, env(safe-area-inset-top)); }
  .nav-mobile { padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  #app { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
}
/* Telas muito altas e estreitas (21:9, dobráveis fechados): evita hero gigante */
@media (max-height: 700px) and (max-width: 900px) {
  .hero-body { padding-top: 16px; padding-bottom: 18px; }
  .hero-synopsis { -webkit-line-clamp: 2; }
}
/* Modo paisagem curto (celular deitado): some com texto secundário do hero */
@media (max-height: 480px) and (orientation: landscape) {
  .hero { min-height: 0; max-height: 260px; }
  .hero-synopsis { display: none; }
  .hero-meta { margin-top: 6px; }
}

/* --------------------------- Catálogo sem fonte ---------------------------- */
/* Títulos importados de metadados: aparecem, informam que ainda não reproduzem. */
.soon-tag {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  font-size: 9px; font-weight: 800; letter-spacing: .08em;
  padding: 3px 6px; border-radius: 5px;
  background: rgba(8, 9, 13, .72); color: #cfd3e0; border: 1px solid var(--line-strong);
  backdrop-filter: blur(6px);
}
.media-card.sem-fonte .poster { filter: saturate(.85); }
.media-card.sem-fonte .media-meta h4 { color: var(--muted); }
