/* DaviFlix 1.0 — Fim de Inverno
   Uma camada visual enxuta carregada por último para preservar a compatibilidade
   das telas legadas e do player sem repetir toda a folha histórica. */

:root {
  --bg: #0a0d12;
  --bg-soft: #0f141c;
  --panel: #131922;
  --panel2: #19212c;
  --text: #f5f7fb;
  --muted: #939eac;
  --line: rgba(213, 222, 235, .12);
  --line-strong: rgba(213, 222, 235, .2);
  --accent: #8b7cf6;
  --accent2: #b9b0ff;
  --accent-warm: #e7b878;
  --danger: #ff7187;
  --success: #62d5a5;
  --warning: #efc36f;
  --radius: 18px;
  --radius-lg: 26px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .32);
  --ease: cubic-bezier(.2, .72, .2, 1);
}

html { background: var(--bg); scroll-behavior: smooth; }
body {
  background:
    radial-gradient(900px 500px at 82% -180px, rgba(113, 95, 214, .18), transparent 68%),
    radial-gradient(700px 460px at -10% 38%, rgba(67, 108, 126, .1), transparent 72%),
    var(--bg);
  color: var(--text);
  font-family: Inter, Aptos, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -.006em;
  overflow-x: clip;
}

::selection { background: rgba(139, 124, 246, .35); color: #fff; }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 3px; }

.topbar {
  height: 68px;
  padding: 0 clamp(18px, 4vw, 58px);
  border-bottom: 1px solid transparent;
  background: linear-gradient(to bottom, rgba(8, 11, 16, .92), rgba(8, 11, 16, .55));
  backdrop-filter: blur(10px) saturate(1.1);
  transition: background .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.topbar.is-scrolled {
  background: rgba(9, 12, 17, .94);
  border-bottom-color: var(--line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
}
.brand { min-width: 136px; height: 42px; }
.brand-logo { width: 148px; height: 36px; max-width: 30vw; }
.main-nav { gap: clamp(12px, 1.7vw, 24px); }
.main-nav a, .link-button {
  color: #a7b0bd;
  font-size: 13px;
  font-weight: 650;
  transition: color .18s ease;
}
.main-nav a:hover, .link-button:hover { color: #fff; }
.main-nav a.active { color: #fff; }
.main-nav a.active::after {
  bottom: -9px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-warm), var(--accent));
}
.profile-nav-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px 4px 5px !important;
  background: rgba(255, 255, 255, .035);
}
.profile-mini-avatar { width: 28px; height: 28px; border-radius: 50%; }

.page { width: min(1540px, calc(100% - clamp(28px, 6vw, 92px))); padding: 34px 0 76px; }
.footer {
  min-height: 62px;
  align-items: center;
  color: #66717f;
  border-top-color: rgba(255, 255, 255, .055);
  background: rgba(7, 9, 13, .45);
}
.footer strong { color: #8f99a8; }

.eyebrow {
  color: var(--accent-warm);
  font-size: 10px;
  letter-spacing: .22em;
}
.hero.compact { padding: 32px 0 38px; margin: 0; align-items: end; }
.hero.compact h1 { margin-top: 10px; font-size: clamp(42px, 5.5vw, 72px); }
.hero.compact p { max-width: 650px; color: #8e99a8; }

input, select, textarea {
  min-height: 44px;
  border-color: var(--line);
  border-radius: 12px;
  background: rgba(6, 9, 14, .72);
  color: #f8f9fb;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
input::placeholder, textarea::placeholder { color: #646f7e; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  border-color: rgba(154, 140, 251, .75);
  background: rgba(8, 11, 17, .95);
  box-shadow: 0 0 0 4px rgba(139, 124, 246, .1);
}
.filters { gap: 8px; }
.filters input { min-width: min(320px, 76vw); }
.button {
  min-height: 42px;
  border-color: var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .065);
  padding: 10px 17px;
  font-size: 13px;
  font-weight: 760;
  box-shadow: none;
  transition: transform .18s var(--ease), background .18s ease, border-color .18s ease, opacity .18s ease;
}
.button:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, .1); transform: translateY(-1px); }
.button.primary {
  color: #11131a;
  background: #f4f1e9;
  border-color: #f4f1e9;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .22);
}
.button.primary:hover { background: #fff; border-color: #fff; }
.button.large { min-height: 50px; padding: 13px 22px; }
.button-play { font-size: .8em; color: #191b22; }
.button.is-loading { pointer-events: none; opacity: .68; }
.button.is-loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: season-spin .65s linear infinite;
}
@keyframes season-spin { to { transform: rotate(360deg); } }

/* Login: uma composição mais curta, legível e sem rolagem em notebooks. */
.login-page .page { width: 100%; max-width: none; padding: 0; }
.login-page .footer { position: relative; z-index: 2; }
.login-cinematic {
  min-height: calc(100svh - 130px);
  margin: 0;
  grid-template-columns: minmax(0, 1.18fr) minmax(330px, 430px);
  gap: clamp(34px, 6vw, 88px);
  padding: clamp(30px, 6vh, 64px) clamp(24px, 7vw, 110px);
  background:
    radial-gradient(700px 520px at 16% 40%, rgba(116, 91, 212, .22), transparent 72%),
    linear-gradient(120deg, #0b0e14, #0c1118 55%, #11131a);
}
.login-cinematic::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .42;
  background-image:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(90deg, #000, transparent 72%);
}
.login-cinematic-backdrop { opacity: .12; transform: rotate(-6deg) scale(1.06); }
.login-tile {
  border-color: rgba(185, 176, 255, .28);
  background: linear-gradient(135deg, rgba(77, 62, 132, .5), rgba(15, 21, 31, .7));
  color: rgba(221, 217, 255, .72);
  box-shadow: 0 25px 70px rgba(0, 0, 0, .3);
}
.login-cinematic-copy { max-width: 720px; }
.login-cinematic-copy img { width: min(220px, 58%); margin-bottom: 28px; }
.login-cinematic-copy h1 {
  margin: 18px 0 20px;
  max-width: 680px;
  font-size: clamp(48px, 6.4vw, 86px);
  line-height: .96;
  letter-spacing: -.065em;
  text-wrap: balance;
}
.login-cinematic-copy p { max-width: 610px; margin: 0; font-size: clamp(16px, 1.5vw, 19px); color: #aab4c2; }
.login-feature-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.login-feature-list span {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .035);
  color: #aab3c0;
  font-size: 11px;
}
.modern-login-card {
  width: 100%;
  padding: clamp(26px, 4vw, 38px);
  border: 1px solid rgba(220, 226, 238, .14);
  border-radius: var(--radius-lg);
  background: rgba(15, 20, 28, .9);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
.modern-login-card::before { background: rgba(139, 124, 246, .14); filter: blur(50px); }
.modern-login-card .login-brand-logo { width: 58px; margin: 0 0 24px; }
.modern-login-card .eyebrow { display: block; margin-bottom: 9px; }
.modern-login-card h2 { margin: 0; text-align: left; font-size: clamp(27px, 3vw, 34px); }
.modern-login-card > p { margin: 7px 0 24px; text-align: left; }
.modern-login-card label { color: #b4bdc9; font-size: 12px; }
.modern-login-card .button { width: 100%; margin-top: 3px; justify-content: space-between; }

/* Home cinematográfica, com o conteúdo acima da arte e sem altura excessiva. */
.streaming-hero {
  min-height: clamp(460px, 65svh, 660px);
  margin: -34px calc(50% - 50vw) 16px;
  border-bottom: 1px solid var(--line);
  background: #080b10;
}
.streaming-hero-backdrop {
  background-image:
    linear-gradient(90deg, rgba(7, 10, 15, .98) 0%, rgba(7, 10, 15, .82) 34%, rgba(7, 10, 15, .2) 70%),
    linear-gradient(0deg, var(--bg) 0%, transparent 42%),
    var(--featured-image);
  filter: saturate(.84) contrast(1.04);
}
.streaming-hero-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(99, 82, 184, .08), transparent 50%, rgba(230, 184, 120, .05));
}
.streaming-hero-content { width: min(720px, 92%); padding: clamp(100px, 15vw, 180px) clamp(28px, 6vw, 92px) 70px; }
.streaming-hero h1 { margin: 13px 0 14px; max-width: 840px; font-size: clamp(45px, 6.5vw, 84px); letter-spacing: -.062em; }
.featured-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d9dce3;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.featured-kicker i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-warm); box-shadow: 0 0 18px rgba(231, 184, 120, .65); }
.featured-meta { color: #bcc4d0; font-size: 13px; }
.featured-overview { max-width: 650px; color: #c6ced9; font-size: clamp(14px, 1.35vw, 18px); line-height: 1.55; }
.hero-actions { margin-top: 25px; }

.catalog-section { margin: 44px 0 62px; }
.section-heading { margin-bottom: 13px; }
.section-heading h2 { font-size: clamp(25px, 2.6vw, 34px); letter-spacing: -.045em; }
.view-all { color: #9e9aaf; padding: 8px 0; }
.view-all:hover { color: #fff; }
.horizontal-row { gap: 15px; margin-inline: -4px; padding: 9px 4px 25px; scrollbar-width: none; }
.horizontal-row::-webkit-scrollbar { display: none; }
.poster-row > .media-card { flex-basis: clamp(162px, 14vw, 218px); }

/* Cartões: menos moldura, informação mais nítida, ação previsível. */
.media-grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 28px 16px; }
.media-card { border-radius: 16px; }
.poster-wrap {
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 14px;
  background: linear-gradient(145deg, #171e29, #0d1118);
  box-shadow: 0 16px 42px rgba(0, 0, 0, .2);
  transition: transform .28s var(--ease), border-color .25s ease, box-shadow .28s ease;
}
.poster-wrap::before {
  content: "D";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(185, 176, 255, .24);
  font-size: 48px;
  font-weight: 900;
}
.poster-wrap img, .poster-fallback { position: relative; z-index: 1; }
.poster-wrap img { transition: transform .45s var(--ease), filter .3s ease; }
.poster-wrap:hover { transform: translateY(-5px); border-color: rgba(185, 176, 255, .38); box-shadow: 0 24px 52px rgba(0, 0, 0, .38); }
.poster-wrap:hover img { transform: scale(1.025); filter: saturate(1.06); }
.poster-fallback { background: linear-gradient(145deg, #1b2230, #0e1219); }
.generated-cover { text-shadow: 0 2px 18px rgba(0, 0, 0, .5); }
.play-badge {
  z-index: 7;
  right: 11px;
  bottom: 11px;
  width: 40px;
  height: 40px;
  background: rgba(249, 247, 241, .96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
.media-info { padding: 11px 2px 0; }
.media-info h2 { margin-bottom: 4px; font-size: 14px; font-weight: 720; }
.media-info p { color: #7f8a99; font-size: 11px; }
.source-badge, .compat-badge, .resume-badge { backdrop-filter: none; }
.watchlist-icon-button {
  width: 31px;
  height: 31px;
  border-color: var(--line);
  background: rgba(255, 255, 255, .045);
  font-size: 17px;
}
.watchlist-icon-button:hover, .watchlist-icon-button:focus, .watchlist-icon-button.active, .watchlist-active {
  border-color: rgba(185, 176, 255, .6);
  background: var(--accent);
}
.image-unavailable { background: linear-gradient(145deg, #1c2330, #0b1017); }
.image-unavailable::after {
  content: "Imagem indisponível";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22%;
  z-index: 2;
  text-align: center;
  color: #6f7a88;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.continue-card {
  border-color: var(--line);
  border-radius: 15px;
  background: rgba(18, 24, 33, .82);
}
.continue-art { min-height: 78px; }
.continue-grid.horizontal-row > .continue-card { flex-basis: clamp(320px, 30vw, 450px); }

/* Séries, episódios e TV ao vivo. */
.series-hero { min-height: 390px; padding: 54px 0 32px; }
.series-backdrop, .watch-page-backdrop { filter: saturate(.75); opacity: .42; }
.series-copy h1 { font-size: clamp(40px, 5.2vw, 72px); }
.series-poster { border-radius: 15px; box-shadow: var(--shadow); }
.season-tabs a { border-color: var(--line); background: rgba(255, 255, 255, .045); }
.season-tabs a.active { background: #f3f0e9; border-color: #f3f0e9; color: #15171d; }
.episode-card, .channel-card, .series-load-state {
  border-color: var(--line);
  background: rgba(18, 24, 33, .78);
  box-shadow: none;
}
.episode-card { border-radius: 15px; }
.episode-card:hover, .channel-card:hover { border-color: var(--line-strong); background: rgba(24, 31, 42, .9); }
.channel-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.channel-logo { border-color: var(--line); background: #090c11; }
.live-dot { color: #ff7187; }

/* Player e painéis: preserva o comportamento, atualiza apenas a superfície. */
.cinema-shell {
  border-color: rgba(255, 255, 255, .14);
  border-radius: 18px;
  box-shadow: 0 34px 100px rgba(0, 0, 0, .52);
}
.player-quickbar, .watch-sidecard, .panel, .status-card, .iptv-source-card, .user-admin-card, .subscription-card {
  border-color: var(--line);
  background: rgba(18, 24, 33, .84);
  box-shadow: none;
}
.panel, .status-card { border-radius: 16px; }
.status-card strong { color: #d9dee6; }
.list-row, .folder-browser, .toggle-card, .library-row, .subscription-fields {
  border-color: var(--line);
  background: rgba(6, 9, 14, .46);
}
.alert { border-radius: 13px; }
.alert.success { background: rgba(25, 72, 54, .48); border-color: rgba(98, 213, 165, .32); }
.alert.error { background: rgba(79, 28, 40, .5); border-color: rgba(255, 113, 135, .34); }

/* Perfis e estados vazios. */
.profiles-page { padding-top: 42px; }
.profiles-heading > img { width: 165px; }
.profiles-heading h1 { font-size: clamp(40px, 5vw, 66px); }
.profile-grid { gap: 22px; margin-top: 36px; }
.profile-card { width: 190px; }
.profile-avatar { width: 116px; height: 116px; border-radius: 50%; font-size: 48px; transition: transform .22s var(--ease), outline-color .22s ease; }
.profile-select-button:hover .profile-avatar, .profile-select-button:focus .profile-avatar { outline-width: 3px; transform: translateY(-4px) scale(1.02); }
.add-profile-card { border-color: var(--line); background: rgba(18, 24, 33, .72); }
.empty { min-height: 46vh; }
.hero-icon { border-color: var(--line); background: rgba(255, 255, 255, .045); color: var(--accent2); }

/* Tabelas e administração continuam densas, mas ficam mais fáceis de ler. */
.admin-grid { gap: 18px; }
.status-grid { gap: 12px; }
.source-meta dt, .technical-line span { color: #7e8997; }
.source-meta dd { color: #d8dde5; }
.pagination .button { min-width: 110px; }

@media (hover: hover) {
  .horizontal-row .media-card:hover { transform: none; z-index: 4; }
}

@media (max-width: 980px) {
  .topbar { height: auto; min-height: 68px; }
  .main-nav { width: 100%; }
  .login-cinematic { grid-template-columns: minmax(0, 1fr) minmax(320px, 410px); gap: 30px; padding-inline: 34px; }
  .login-cinematic-copy h1 { font-size: 54px; }
  .login-feature-list span:last-child { display: none; }
}

@media (max-width: 900px) {
  .topbar { padding: 9px 16px 8px; gap: 7px; }
  .brand { height: 38px; }
  .brand-logo { width: 130px; height: 34px; }
  .topbar .main-nav { max-width: 100%; padding-top: 3px; gap: 17px; }
  .main-nav a { padding: 8px 2px; }
  .main-nav a.active::after { bottom: -7px; }
  .page { width: min(100% - 30px, 780px); padding-top: 24px; }
  .login-page .topbar { min-height: 60px; }
  .login-page .page { width: 100%; padding: 0; }
  .login-cinematic { min-height: calc(100svh - 122px); grid-template-columns: 1fr; padding: 32px 20px; }
  .login-cinematic-copy { display: none; }
  .modern-login-card { width: min(430px, 100%); margin: auto; }
  .streaming-hero { margin-top: -24px; min-height: 570px; }
  .streaming-hero-backdrop {
    background-image: linear-gradient(0deg, var(--bg) 0%, rgba(7, 10, 15, .68) 54%, rgba(7, 10, 15, .12)), var(--featured-image);
  }
  .streaming-hero-content { padding: 260px 24px 48px; }
  .streaming-hero h1 { font-size: clamp(42px, 10vw, 68px); }
  .featured-overview { font-size: 15px; }
  .hero.compact { gap: 24px; }
}

@media (max-width: 650px) {
  .page { width: calc(100% - 24px); padding-bottom: 54px; }
  .footer { padding-inline: 18px; }
  .footer span + span { display: none; }
  .hero.compact { padding: 22px 0 28px; }
  .hero.compact h1 { font-size: 42px; }
  .filters { width: 100%; display: grid; grid-template-columns: 1fr auto; }
  .filters input, .filters select { min-width: 0; }
  .live-filters { grid-template-columns: 1fr; }
  .streaming-hero { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); min-height: 530px; }
  .streaming-hero-content { padding: 230px 20px 40px; width: 100%; }
  .streaming-hero h1 { font-size: 45px; }
  .featured-overview { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .catalog-section { margin: 34px 0 48px; }
  .section-heading h2 { font-size: 25px; }
  .horizontal-row { margin-right: calc(50% - 50vw); padding-right: 18px; }
  .poster-row > .media-card { flex-basis: 148px; }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 23px 10px; }
  .media-info h2 { font-size: 13px; }
  .play-badge { opacity: 1; transform: scale(.85); }
  .continue-grid.horizontal-row > .continue-card { flex-basis: min(320px, 86vw); }
  .profiles-page { padding: 30px 6px; }
  .profile-grid { gap: 16px 8px; }
  .profile-card { width: min(44vw, 170px); }
  .profile-avatar { width: 96px; height: 96px; }
  .cinema-shell { border-radius: 0; }
}

@media (max-width: 430px) {
  .brand-logo { width: 116px; }
  .login-cinematic { padding: 20px 14px; }
  .modern-login-card { padding: 25px 20px; border-radius: 22px; }
  .modern-login-card .login-brand-logo { width: 52px; margin-bottom: 20px; }
  .modern-login-card h2 { font-size: 27px; }
  .streaming-hero h1 { font-size: 39px; }
  .hero-actions .button { min-height: 46px; }
  .poster-row > .media-card { flex-basis: 140px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(255, 255, 255, .28); --muted: #b8c0cb; }
  .button.primary { outline: 2px solid #fff; }
}
