/* All Around — estilos (negro / naranja / blanco) */
:root {
  /* Tema claro estilo Elevien */
  --bg:        #F5F6F8;            /* fondo de la página */
  --bg-2:      #FFFFFF;             /* cards / superficies */
  --bg-3:      #F3F4F6;             /* hover / secundario */
  --line:      #E5E7EB;             /* bordes */
  --text:      #15161B;             /* texto principal */
  --muted:     #7C7E8B;             /* texto secundario */
  --accent:    #EF4458;             /* coral/rosa */
  --accent-2:  #D93649;             /* hover del acento */
  --accent-bg: #FFE9EC;             /* fondo suave (hover, badges) */
  --danger:    #EF4444;
  --ok:        #10B981;
  --warn:      #F59E0B;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 1px 3px rgba(15,17,23,.06), 0 1px 2px rgba(15,17,23,.04);
  --shadow-lg: 0 10px 30px rgba(15,17,23,.08);
  --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
*       { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 8px;
  transition: transform .05s ease, background .15s ease;
}
button:hover  { background: var(--accent-2); }
button:active { transform: translateY(1px); }
button.ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}
button.ghost:hover { background: var(--bg-3); border-color: #D1D5DB; }
button.danger { background: var(--danger); color: #fff; }

input, select, textarea {
  width: 100%;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 11px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0 6px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- LOGIN ---------- */
.auth-wrap {
  display: grid; place-items: center;
  min-height: 100vh; padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, var(--accent-bg), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(239,68,88,.04), transparent 40%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.brand-dot {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--accent);
  display: grid; place-items: center;
  font-weight: 800; color: #fff; font-size: 14px;
}
.brand-name { font-weight: 700; letter-spacing: .02em; }
.brand-tag  { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.auth-card .sub { color: var(--muted); margin-bottom: 8px; }
.auth-card button.primary { width: 100%; margin-top: 18px; }

.alert {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
  padding: 10px 12px;
  border-radius: 8px;
  margin-top: 14px; font-size: 13px;
  display: none; word-break: break-word;
}
.alert.show { display: block; }

.demo-creds {
  margin-top: 18px; font-size: 11px;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}
.demo-creds code {
  background: var(--bg-3); padding: 1px 6px;
  border-radius: 4px; color: var(--accent);
}

/* ---------- TOPBAR ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.topbar .left { display: flex; align-items: center; gap: 14px; }
.user-chip    { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.role-pill {
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em;
}
.role-pill.role-atleta   { background: #DBEAFE; color: #1E40AF; }
.role-pill.role-gimnasio { background: #FEF3C7; color: #92400E; }
.role-pill.role-padre    { background: #DBEAFE; color: #1E40AF; }
.role-pill.role-usuario  { background: var(--bg-3); color: var(--muted); }

/* ---------- DASHBOARD ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; width: 100%; }
h2.page-title { margin: 0 0 6px; font-size: 20px; }
.subtitle { color: var(--muted); margin: 0 0 22px; font-size: 13px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s ease;
}
.card:hover { border-color: var(--accent); }
.card h3 { margin: 0; font-size: 15px; }
.card .meta { color: var(--muted); font-size: 12px; }
.card .status {
  align-self: flex-start; margin-top: 6px;
  font-size: 10px; padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase; font-weight: 700; letter-spacing: .05em;
}
.status.live     { background: var(--danger); color: #fff; }
.status.draft    { background: var(--bg-3);   color: var(--muted); }
.status.finished { background: var(--line);   color: var(--muted); }

.live-dot {
  display: inline-block; width: 8px; height: 8px;
  background: var(--danger); border-radius: 50%;
  margin-right: 6px; animation: pulse 1.2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ---------- SWITCHER ---------- */
.switcher-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
}
@media (max-width: 1000px) { .switcher-layout { grid-template-columns: 1fr; } }

.monitor {
  background: #000; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16/9; position: relative;
  display: grid; place-items: center;
}
.monitor video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.monitor .placeholder { text-align: center; color: var(--muted); padding: 20px; }
.monitor .overlay {
  position: absolute; top: 12px; left: 12px;
  background: rgba(0,0,0,.65);
  border: 1px solid var(--line);
  padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: 12px;
  display: flex; align-items: center; gap: 8px;
}

.sidebar-section {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.sidebar-section h4 {
  margin: 0 0 12px;
  font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
}

.branch-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.branch-tabs button {
  flex: 1; background: var(--bg-3); color: var(--text);
  padding: 8px 0; font-size: 12px;
}
.branch-tabs button.active { background: var(--accent); color: #fff; }

.preview-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.preview {
  background: #000; border: 2px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden;
  aspect-ratio: 16/9; position: relative; cursor: pointer;
  transition: border-color .15s ease, transform .1s ease;
}
.preview:hover  { border-color: var(--accent-2); transform: translateY(-1px); }
.preview.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,106,26,.2); }
.preview .pv-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,.85), transparent);
  padding: 12px 8px 5px;
  font-size: 11px; font-weight: 600;
}
.preview .pv-slot {
  position: absolute; top: 4px; right: 4px;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 4px;
}
.preview video { width: 100%; height: 100%; object-fit: cover; background:#000; }
.preview .pv-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--muted); font-size: 11px;
  text-align: center; padding: 6px;
}

.foot { text-align: center; color: var(--muted); font-size: 11px; padding: 16px 0 24px; }

/* ---------- TEST PAGE ---------- */
.test-row {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
}
.test-row h4 { margin: 0 0 4px; font-size: 14px; }
.test-row .u { font-family: monospace; font-size: 11px; color: var(--accent); word-break: break-all; }
.test-row .res {
  margin-top: 8px;
  font-family: monospace; font-size: 11px;
  color: var(--muted); white-space: pre-wrap;
  max-height: 200px; overflow: auto;
  background: var(--bg); padding: 8px; border-radius: 4px;
}
.pass { color: #22C55E; font-weight: 600; }
.fail { color: #EF4444; font-weight: 600; }
.wait { color: var(--muted); }
