/* =====================================================================
   Tema base da área de membros.
   As cores vêm de variáveis — o admin sobrescreve em tempo de execução
   (settings.branding) sem precisar recompilar nada.
   ===================================================================== */
:root {
  --bg: #0b0b0d;
  --surface: #141418;
  --surface-2: #1c1c22;
  --border: #26262e;
  --text: #f4f4f5;
  --muted: #8e8e99;
  --accent: #e11d48;
  --accent-soft: rgba(225, 29, 72, .14);
  --radius: 12px;
  --font: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --header-h: 60px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c2c35; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a45; }

/* ---------- Componentes básicos ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { background: #26262e; border-color: #33333d; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); background: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: #f87171; border-color: #4a2530; background: rgba(248, 113, 113, .08); }
.btn-danger:hover { background: rgba(248, 113, 113, .16); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--border); background: #0f0f13; color: var(--text);
  font-size: 13px; font-family: inherit; outline: none; transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e99' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 32px; }

.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field-hint { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge-ok { background: rgba(34, 197, 94, .12); color: #4ade80; border-color: rgba(34, 197, 94, .25); }
.badge-warn { background: rgba(234, 179, 8, .12); color: #facc15; border-color: rgba(234, 179, 8, .25); }
.badge-err { background: rgba(248, 113, 113, .12); color: #f87171; border-color: rgba(248, 113, 113, .25); }
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 13px; }

.spinner {
  width: 18px; height: 18px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Avisos (toast) ---------- */
#toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 9px; font-size: 13px; max-width: 340px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: toastIn .2s ease-out;
}
.toast.ok { border-left-color: #4ade80; }
.toast.err { border-left-color: #f87171; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .72); z-index: 900;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 560px; max-height: 88vh; display: flex; flex-direction: column;
  animation: modalIn .18s ease-out;
}
.modal-lg { max-width: 860px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.99); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--border);
}
.icon-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; transition: .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------- Barra de progresso ---------- */
.bar { height: 3px; background: rgba(255, 255, 255, .1); border-radius: 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width .3s; }

/* ---------- Player chromeless (compartilhado) ---------- */
.cplayer {
  position: relative; width: 100%; aspect-ratio: 16/9; background: #000;
  border-radius: var(--radius); overflow: hidden; user-select: none;
}
.cplayer .cp-frame { position: absolute; inset: 0; z-index: 1; }
.cplayer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; }
/* Escudo permanente sobre o iframe: mata o hover-UI do YouTube e captura o clique. */
.cplayer .cp-hit { position: absolute; inset: 0; z-index: 2; cursor: pointer; }
.cplayer .cp-cover {
  position: absolute; inset: 0; z-index: 3; background: #000 center/cover no-repeat;
  display: grid; place-items: center; cursor: pointer; transition: opacity .25s;
}
.cplayer.playing .cp-cover { opacity: 0; pointer-events: none; }
/* Cartela de fim: entra antes do video acabar, no lugar das sugestoes do YouTube. */
.cplayer .cp-end {
  position: absolute; inset: 0; z-index: 4; background: rgba(0, 0, 0, .88);
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.cplayer.ended .cp-end { display: flex; }
.cplayer.ended .cp-cover { opacity: 0; }
.cp-end p { margin: 0; font-size: 14px; color: #d4d4d8; }
.cp-end .cp-end-btns { display: flex; gap: 10px; }
.cp-bigplay {
  width: 72px; height: 72px; border-radius: 50%; background: var(--accent);
  display: grid; place-items: center; box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
  transition: transform .18s;
}
.cp-cover:hover .cp-bigplay { transform: scale(1.07); }
.cp-bigplay svg { width: 30px; height: 30px; fill: #fff; margin-left: 4px; }

.cp-bar {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 14px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .85));
  display: flex; align-items: center; gap: 12px;
  opacity: 0; transition: opacity .2s; z-index: 5;
}
.cplayer:hover .cp-bar, .cplayer.paused .cp-bar { opacity: 1; }
.cplayer:not(.started) .cp-bar { opacity: 0 !important; }
.cp-bar button { background: none; border: 0; color: #fff; cursor: pointer; display: grid; place-items: center; padding: 3px; }
.cp-bar button svg { width: 19px; height: 19px; fill: currentColor; }
.cp-time { font-size: 12px; color: #d4d4d8; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cp-seek { flex: 1; }
.cp-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 3px;
  background: rgba(255, 255, 255, .28); outline: none; cursor: pointer;
}
.cp-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
}
.cp-range::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--accent); }
.cp-vol { width: 74px; }
.cp-spin { position: absolute; inset: 0; display: grid; place-items: center; z-index: 4; pointer-events: none; }
.cplayer:not(.loading) .cp-spin { display: none; }

@media (max-width: 720px) {
  .cp-vol { display: none; }
  .cp-bigplay { width: 56px; height: 56px; }
}
