/* ==========================================================================
   amaPod — "Live Q&A" design system
   Familia: misma base warm-dark + fuentes; signal = teal Q&A.
   ========================================================================== */

:root {
  /* Surfaces (shared with postPod / prePod / prodPod) */
  --ink-deep:    #120e09;
  --ink:         #1a1511;
  --ink-raised:  #221c16;
  --ink-panel:   #1e1813;
  --ink-sunken:  #14100c;
  --ink-line:    #3a2f22;
  --ink-line-2:  #2a2219;
  --ink-hover:   #2e251b;

  --paper:       #efe3d0;
  --paper-soft:  #c7b894;
  --paper-dim:   #8a7d65;
  --paper-faint: #5c5240;

  /* Signal — TEAL "Q&A" */
  --signal:         #14b8a6;
  --signal-strong:  #2dd4bf;
  --signal-dim:     #0f4f47;
  --signal-hot:     #ff3b3b;
  --signal-hot-dim: #7a2224;
  --signal-cool:    #8db36a;
  --signal-cool-dim:#3d5128;
  --signal-amber:   #f4c770;
  --signal-cyan:    #6bb3c4;
  --signal-blue:    #5a8bff;

  --r-sm: 3px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-pill: 999px;

  --ease: cubic-bezier(0.4, 0.0, 0.2, 1);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);

  --glow-signal: 0 0 14px rgba(20, 184, 166, 0.55);
  --shadow-console:
    inset 0 1px 0 rgba(20,184,166,0.06),
    inset 0 -1px 0 rgba(0,0,0,0.5),
    0 1px 0 rgba(0,0,0,0.6),
    0 10px 30px -12px rgba(0,0,0,0.9);

  --font-display: 'Newsreader', 'Georgia', serif;
  --font-ui:      'Bricolage Grotesque', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.002em;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.45) 100%);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.015em;
  margin: 0;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--paper-dim); font-size: 12px; letter-spacing: 0.02em; }
.tiny { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--paper-dim); font-weight: 500; }
.spacer { flex: 1; }

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

button {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  background: var(--ink-raised);
  color: var(--paper);
  border: 1px solid var(--ink-line);
  padding: 8px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 120ms var(--ease), border-color 120ms var(--ease), transform 80ms var(--ease);
  user-select: none;
}
button:hover { background: var(--ink-hover); border-color: var(--signal-dim); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
button.primary {
  background: var(--signal);
  color: #fff;
  border-color: var(--signal);
  font-weight: 600;
}
button.primary:hover { background: var(--signal-strong); box-shadow: var(--glow-signal); }
button.ghost { background: transparent; border-color: transparent; color: var(--paper-soft); }
button.ghost:hover { background: var(--ink-raised); color: var(--paper); }
button.danger { color: var(--signal-hot); border-color: transparent; background: transparent; }
button.danger:hover { background: rgba(255,59,59,0.1); border-color: var(--signal-hot-dim); }
button.icon {
  padding: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

input[type=text], input[type=password], input[type=number], input[type=url], textarea, select {
  width: 100%;
  background: var(--ink-sunken);
  color: var(--paper);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-family: var(--font-ui);
  font-size: 14px;
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--signal);
  box-shadow: 0 0 0 3px rgba(20,184,166,0.12);
}
label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper-dim);
  margin-bottom: 6px;
  font-weight: 500;
}

.row { display: flex; gap: 10px; align-items: center; }
.row.right { justify-content: flex-end; }
.container { padding: 28px 32px; max-width: 1200px; margin: 0 auto; }

.error {
  background: linear-gradient(180deg, rgba(255,59,59,0.14), rgba(255,59,59,0.06));
  color: #ffb8b0;
  border: 1px solid var(--signal-hot-dim);
  padding: 10px 14px;
  border-radius: var(--r-md);
  margin: 10px 0;
  font-size: 13px;
  font-family: var(--font-mono);
}
.error::before { content: "\25C6 "; color: var(--signal-hot); }

/* ==========================================================================
   Login
   ========================================================================== */

.login-view { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  width: 340px;
  padding: 40px 32px;
  background: var(--ink-panel);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-lg);
  text-align: center;
  box-shadow: var(--shadow-console);
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--signal), transparent);
  opacity: 0.7;
}
.login-card h1 { margin: 0 0 4px; font-size: 32px; font-weight: 500; }
.login-subtitle { color: var(--paper-dim); font-size: 13px; margin: 0 0 24px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; }
.login-card form button { margin-top: 6px; }

/* ==========================================================================
   Dashboard
   ========================================================================== */

.dashboard-view { max-width: 960px; margin: 0 auto; padding: 32px 24px; }
.dash-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.event-card {
  padding: 20px;
  background: var(--ink-raised);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: border-color 120ms var(--ease), transform 80ms var(--ease);
  position: relative;
}
.event-card:hover { border-color: var(--signal-dim); transform: translateY(-1px); }
.event-card h3 { margin: 8px 0 4px; font-size: 16px; }
.event-desc { color: var(--paper-dim); font-size: 13px; margin: 0 0 8px; }
.event-meta { color: var(--paper-faint); font-size: 12px; }
.event-status {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-family: var(--font-mono);
}
.event-status.created { background: var(--ink-hover); color: var(--paper-soft); }
.event-status.active { background: var(--signal-dim); color: var(--signal); }
.event-status.finished { background: var(--ink-sunken); color: var(--paper-faint); }
.empty-state { text-align: center; color: var(--paper-dim); padding: 60px 20px; }
.loading { text-align: center; color: var(--paper-dim); padding: 40px; }

/* ==========================================================================
   Host Layout
   ========================================================================== */

.host-layout { display: grid; grid-template-columns: 1fr 320px; grid-template-rows: auto 1fr auto; height: 100vh; }
.video-area { grid-column: 1; grid-row: 2; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px; background: var(--ink-deep); }
.queue-sidebar { grid-column: 2; grid-row: 1 / -1; border-left: 1px solid var(--ink-line); overflow-y: auto; display: flex; flex-direction: column; }
.controls-bar { grid-column: 1; grid-row: 3; display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--ink-line); background: var(--ink-panel); }
.host-header { grid-column: 1; grid-row: 1; display: flex; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--ink-line); background: var(--ink-panel); }

/* ==========================================================================
   Video
   ========================================================================== */

.video-card { position: relative; border-radius: var(--r-lg); overflow: hidden; background: var(--ink-deep); border: 1px solid var(--ink-line); }
.video-card video { width: 100%; height: 100%; object-fit: cover; }
.video-card.host-solo { max-width: 800px; aspect-ratio: 16/9; }
.video-card.split { width: 48%; aspect-ratio: 16/9; }
.video-label { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,0.6); color: var(--paper); padding: 2px 10px; border-radius: var(--r-pill); font-size: 12px; }
.censor-overlay { position: absolute; inset: 0; background: #333; display: flex; align-items: center; justify-content: center; color: var(--paper-dim); font-size: 14px; z-index: 5; }

/* ==========================================================================
   Queue
   ========================================================================== */

.queue-section { padding: 12px; }
.queue-section h3 { font-family: var(--font-ui); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--paper-dim); margin: 0 0 8px; }
.queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  margin-bottom: 4px;
  background: var(--ink-raised);
  border: 1px solid var(--ink-line);
  transition: background 120ms var(--ease);
  cursor: grab;
}
.queue-item:hover { background: var(--ink-hover); }
.queue-item.on-air { border-color: var(--signal); background: var(--signal-dim); }
.queue-item .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--paper-soft);
  flex-shrink: 0;
}
.queue-item .name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item .actions { display: flex; gap: 4px; }
.position-badge { font-size: 12px; color: var(--paper-dim); padding: 12px; text-align: center; }
.request-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  margin-bottom: 4px;
  background: var(--ink-raised);
  border: 1px solid var(--ink-line-2);
}
.request-item .name { flex: 1; font-size: 13px; }

/* ==========================================================================
   Chat
   ========================================================================== */

.chat-panel { display: flex; flex-direction: column; border-top: 1px solid var(--ink-line); flex: 1; min-height: 200px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 8px 12px; }
.chat-msg { margin-bottom: 6px; font-size: 13px; line-height: 1.4; }
.chat-msg .sender { font-weight: 600; color: var(--signal); }
.chat-msg .sender.host { color: var(--signal-amber); }
.chat-msg .text { color: var(--paper-soft); }
.chat-input { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--ink-line-2); }
.chat-input input { flex: 1; }
.chat-input button { flex-shrink: 0; }

/* ==========================================================================
   Modals
   ========================================================================== */

.create-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 100; }
.create-modal {
  width: 420px;
  padding: 28px;
  background: var(--ink-panel);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-console);
  position: relative;
  overflow: hidden;
}
.create-modal::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--signal), transparent);
  opacity: 0.7;
}
.create-modal h2 { margin: 0 0 16px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ==========================================================================
   Templates
   ========================================================================== */

.templates-section { margin-bottom: 24px; }
.template-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.template-card {
  padding: 10px 16px;
  background: var(--ink-raised);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 13px;
  transition: border-color 120ms;
}
.template-card:hover { border-color: var(--signal-dim); }

/* ==========================================================================
   Brand
   ========================================================================== */

.brand { font-family: var(--font-display); font-weight: 600; font-size: 22px; color: var(--paper); }
.brand-accent { color: var(--signal); }

/* ==========================================================================
   Toast
   ========================================================================== */

.toast-host { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-item {
  pointer-events: auto;
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  color: #fff;
  animation: toast-in 200ms var(--ease);
  cursor: pointer;
}
.toast-item.success { background: var(--signal-cool); }
.toast-item.error { background: var(--signal-hot); }
.toast-item.info { background: var(--signal); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Error text
   ========================================================================== */

.error-text { color: var(--signal-hot); font-size: 13px; margin: 4px 0 0; }

/* ==========================================================================
   Participant View
   ========================================================================== */

.participant-view { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; text-align: center; }
.participant-status { max-width: 480px; }
.participant-status h2 { font-family: var(--font-display); margin-bottom: 8px; }
.participant-status p { color: var(--paper-dim); font-size: 14px; }
.on-air-badge { display: inline-block; background: var(--signal); color: #fff; padding: 4px 14px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* ==========================================================================
   Join View
   ========================================================================== */

.join-view { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.join-card {
  width: 400px;
  padding: 32px;
  background: var(--ink-panel);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-console);
  position: relative;
  overflow: hidden;
}
.join-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--signal), transparent);
  opacity: 0.7;
}
.join-card h2 { margin: 0 0 4px; }
.join-card .event-desc { margin-bottom: 20px; }
.join-card form { display: flex; flex-direction: column; gap: 10px; }

/* ==========================================================================
   Embed
   ========================================================================== */

.embed-host-view { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.embed-host-view .embed-header { padding: 8px 12px; border-bottom: 1px solid var(--ink-line); background: var(--ink-panel); display: flex; align-items: center; gap: 8px; font-size: 13px; }
.embed-host-view .embed-body { flex: 1; display: flex; flex-direction: column; overflow-y: auto; }

/* ==========================================================================
   Recording indicator
   ========================================================================== */

.rec-indicator { display: inline-flex; align-items: center; gap: 6px; color: var(--signal-hot); font-weight: 600; font-size: 13px; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--signal-hot); animation: pulse 1.5s infinite; }

/* ==========================================================================
   Pre-join (host device test)
   ========================================================================== */

.prejoin {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
}
.prejoin-card {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  max-width: 780px;
  width: 100%;
  background: var(--ink-panel);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-lg);
  padding: 22px;
}
.prejoin-preview {
  position: relative;
  background: #000;
  border-radius: var(--r-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  min-height: 240px;
}
.prejoin-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.prejoin-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--paper-dim);
  background: rgba(0,0,0,0.6);
}
.prejoin-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.prejoin-controls select {
  width: 100%;
}
@media (max-width: 720px) {
  .prejoin-card { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-line); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--paper-faint); }

/* ==========================================================================
   App header
   ========================================================================== */

.app-header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(180deg, var(--ink-panel), var(--ink));
  border-bottom: 1px solid var(--ink-line);
  position: relative;
  z-index: 10;
  gap: 14px;
}
.app-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--signal-dim), transparent);
  opacity: 0.7;
}

.sibling-apps { display: flex; gap: 10px; align-items: center; }
.sibling-link {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--paper-dim); text-decoration: none;
  opacity: 0.55; transition: opacity 0.2s;
}
.sibling-link:hover { opacity: 1; color: var(--signal); }
.sibling-link .ico { font-size: 13px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--paper-soft);
}
.user-chip .name {
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ==========================================================================
   Misc
   ========================================================================== */

* { box-sizing: border-box; }
