/* vibeflix — estética inspirada no cobalt.tools:
   preto puro, monocromático, monoespaçado, tudo em lowercase */

:root {
  --bg: #000000;
  --panel: #0d0d0d;
  --panel-2: #141414;
  --border: #1f1f1f;
  --border-hover: #3d3d3d;
  --text: #e8e8e8;
  --text-dim: #8a8a8a;
  --accent: #ffffff;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  text-transform: lowercase;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--bg); }

a { color: var(--text); text-decoration: none; }

button { font-family: inherit; text-transform: lowercase; }

:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

/* ---------- topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.wordmark {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.5px;
  color: var(--accent);
}

/* segmented control — igual ao seletor auto/audio/mute do cobalt */
.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
}

.tab {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.tab:hover { color: var(--text); }

.tab.active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

.auth-area {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 13px;
}

.auth-user img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.auth-link {
  color: var(--text-dim);
  font-size: 13px;
  transition: color 0.15s;
}

.auth-link:hover { color: var(--text); }

/* ---------- botões ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.btn:hover { border-color: var(--border-hover); background: var(--panel-2); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

.btn.primary:hover { background: #d5d5d5; border-color: #d5d5d5; }

.btn.ghost { border-color: transparent; color: var(--text-dim); }

.btn.ghost:hover { color: var(--text); background: transparent; }

.btn.active-toggle { border-color: var(--accent); color: var(--accent); }

/* ---------- layout principal ---------- */

.main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* caixa de busca grande, estilo o campo de URL do cobalt */
.search-box {
  position: relative;
  max-width: 560px;
  margin: 8px auto 18px;
}

.search-box input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 14px 48px 14px 18px;
  transition: border-color 0.15s;
}

.search-box input::placeholder { color: var(--text-dim); }

.search-box input:focus { outline: none; border-color: var(--border-hover); }

.search-hint {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  font-weight: 700;
}

/* chips de categoria */

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  margin-bottom: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.chip {
  flex: 0 0 auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.chip:hover { color: var(--text); border-color: var(--border-hover); }

.chip.active { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 700; }

/* ---------- grid de filmes ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px 16px;
}

.card {
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  color: inherit;
}

.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel);
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover .poster { border-color: var(--border-hover); transform: translateY(-2px); }

.poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  background:
    linear-gradient(160deg,
      hsl(var(--hue, 220) 45% 22%) 0%,
      hsl(var(--hue, 220) 55% 10%) 100%);
}

.poster-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  font-size: 11px;
  padding: 2px 8px;
  color: var(--accent);
}

.poster-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  z-index: 2;
}

.poster-progress i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.card-title {
  margin: 8px 2px 0;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-group {
  margin: 1px 2px 0;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-line {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  margin: 28px 0 0;
}

.status-line a { color: var(--text); border-bottom: 1px solid var(--border-hover); }

/* ---------- modal de detalhes ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  gap: 20px;
  max-width: 760px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  animation: modal-in 0.15s ease-out;
}

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

.modal-poster {
  position: relative;
  width: 170px;
  flex: 0 0 170px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.modal-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.modal-title { margin: 2px 0 4px; padding-right: 30px; font-size: 18px; letter-spacing: -0.3px; }

.modal-group { margin: 0 0 10px; color: var(--text-dim); font-size: 12px; }

.modal-resume { margin: 0 0 14px; font-size: 12px; color: var(--text-dim); }

.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.modal-note { margin: 0 0 10px; font-size: 12px; color: var(--text-dim); }

.modal-note a { color: var(--text); border-bottom: 1px solid var(--border-hover); }

.modal-x {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.modal-x:hover { color: var(--text); background: var(--panel-2); }

.modal-watched { margin: 0 0 10px; }

.modal-watched button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  font-family: inherit;
  font-size: 11px;
  padding: 2px 10px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.modal-watched button:hover { border-color: var(--border-hover); }

.modal-synopsis {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-dim);
  max-height: 96px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ---------- seletor de episódios ---------- */

.modal-eps { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 12px; }

.eps-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.eps-label { color: var(--text-dim); font-size: 12px; }

.season-select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 5px 8px;
  max-width: 210px;
}

.season-select:focus { outline: none; border-color: var(--border-hover); }

.eps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px 10px;
  max-height: 290px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding-right: 4px;
}

.ep-card {
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

.ep-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel-2);
  transition: border-color 0.15s, transform 0.15s;
}

.ep-card:hover .ep-thumb { border-color: var(--border-hover); transform: translateY(-1px); }

.ep-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ep-num {
  position: absolute;
  left: 6px;
  bottom: 6px;
  z-index: 2;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  padding: 1px 8px;
}

.ep-check {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--bg);
  background: var(--accent);
  border-radius: 999px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ep-card.active .ep-thumb { border-color: var(--accent); }

.ep-name {
  display: block;
  margin: 6px 2px 0;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eps-loading { margin: 4px 0; grid-column: 1 / -1; }

/* ---------- carregar mais ---------- */

.load-more-box { display: flex; justify-content: center; margin-top: 22px; }

/* ---------- player ---------- */

.player {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.player-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.player-title {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-top .btn { margin-left: auto; flex: 0 0 auto; }

.player-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  background: var(--bg);
}

/* ---------- footer ---------- */

.footer {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}

/* ---------- responsivo ---------- */

@media (max-width: 640px) {
  .topbar { gap: 10px; padding: 12px 14px; }
  .auth-area { margin-left: 0; width: 100%; justify-content: flex-end; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px 10px; }
  .modal-card { flex-direction: column; }
  .modal-poster { width: 140px; flex-basis: auto; }
}

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