/* ============================================================
   style.css — Prueba de Turing
   Modo oscuro, fondo azul muy oscuro, acentos morado-azulado.
   ============================================================ */

/* --- Reset y base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface2:    #1f2937;
  --accent:      #6366f1;   /* morado-azulado */
  --accent2:     #3b82f6;   /* azul */
  --text:        #e2e8f0;
  --text-muted:  #64748b;
  --border:      #2d3748;
  --bubble-me:   #1e3a5f;   /* burbujas del profesor */
  --bubble-them: #1e2d3a;   /* burbujas del interlocutor */
  --error:       #f87171;
  --success:     #4ade80;
  --radius:      12px;
  --font:        system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

/* --- Pantallas --- */
.screen {
  display: none;
  min-height: 100vh;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* --- Centro card (espera, voto, resultado) --- */
.center-card {
  margin: auto;
  max-width: 480px;
  width: 100%;
  padding: 2rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.center-card h1, .center-card h2 {
  margin-bottom: 1rem;
  color: var(--text);
}

.instructions {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.muted { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.75rem; }

/* --- Spinner --- */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 1rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Chat --- */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-title { font-weight: 600; color: var(--text); }

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  color: var(--accent2);
  font-weight: 600;
}
.timer.urgent { color: var(--error); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Burbujas */
.bubble {
  max-width: 75%;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.5;
}
.bubble.me {
  align-self: flex-end;
  background: var(--bubble-me);
  border-bottom-right-radius: 3px;
}
.bubble.them {
  align-self: flex-start;
  background: var(--bubble-them);
  border-bottom-left-radius: 3px;
}

/* Indicador de escritura */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.4rem 0.9rem;
  align-self: flex-start;
}
.typing-indicator span {
  width: 7px; height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: blink 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; transform: scale(1); }
  40% { opacity: 1; transform: scale(1.2); }
}
.typing-indicator.hidden { display: none; }

/* Input */
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

textarea {
  flex: 1;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  resize: none;
  font: inherit;
  outline: none;
  max-height: 120px;
  overflow-y: auto;
}
textarea:focus { border-color: var(--accent); }
textarea::placeholder { color: var(--text-muted); }

#send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 40px; height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
#send-btn:hover { background: var(--accent2); }
#send-btn:disabled { background: var(--border); cursor: default; }

/* --- Pantalla de voto --- */
#screen-vote { align-items: center; justify-content: center; }

.vote-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.vote-btn {
  padding: 0.8rem 1.5rem;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  font: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.vote-btn:hover {
  border-color: var(--accent);
  background: #1e2137;
}

/* --- Pantalla de resultado --- */
#screen-result { align-items: center; justify-content: center; }

.result-card { max-width: 540px; }

.result-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.transcript {
  text-align: left;
  margin-top: 1rem;
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* --- Pantalla del panel (panel.html) --- */
.panel-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.panel-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.panel-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.green  { background: var(--success); }
.dot.red    { background: var(--error); }
.dot.yellow { background: #fbbf24; }

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge.ia     { background: #312e81; color: #a5b4fc; }
.badge.humano { background: #14532d; color: #86efac; }
.badge.neutral{ background: var(--surface2); color: var(--text-muted); }

.panel-btn {
  width: 100%;
  padding: 0.55rem 0.8rem;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  transition: border-color 0.15s;
}
.panel-btn:hover { border-color: var(--accent); }
.panel-btn.danger { border-color: var(--error); color: var(--error); }
.panel-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }

.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

select {
  width: 100%;
  padding: 0.4rem 0.6rem;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.85rem;
  outline: none;
}
select:focus { border-color: var(--accent); }

.typing-target {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* --- Login --- */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 340px;
}
.login-card h1 { margin-bottom: 1.5rem; font-size: 1.3rem; }
.login-card label { display: block; margin-bottom: 0.25rem; font-size: 0.85rem; color: var(--text-muted); }
.login-card input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  outline: none;
  margin-bottom: 1rem;
}
.login-card input[type="password"]:focus { border-color: var(--accent); }
.login-card button {
  width: 100%;
  padding: 0.65rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
}
.login-card button:hover { background: var(--accent2); }
.error { color: var(--error); font-size: 0.85rem; margin-top: 0.5rem; }

/* --- Responsive --- */
@media (max-width: 600px) {
  .panel-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .panel-layout { flex-direction: column; }
  .bubble { max-width: 90%; }
  .chat-container { max-width: 100%; }
}
