/* ============================================================
   OPERACIÓN ENIGMA 2.0 — styles.css
   Estética Táctica Cyberpunk / Terminal Militar de La Orden
   ============================================================ */

:root {
  --bg-color: #050608;
  --bg-panel: rgba(10, 15, 25, 0.88);
  --bg-panel-solid: #0d121d;
  --text-main: #e2e8f0;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  
  /* Paleta Cibernética / Táctica */
  --cyan: #00ffcc;
  --cyan-bright: #00f3ff;
  --cyan-glow: rgba(0, 255, 204, 0.25);
  --green: #10b981;
  --green-neon: #33ff33;
  --green-glow: rgba(51, 255, 51, 0.25);
  --red: #ef4444;
  --red-neon: #ff3333;
  --red-glow: rgba(255, 51, 51, 0.35);
  --amber: #f59e0b;
  --amber-neon: #ffaa00;
  
  --border-color: rgba(0, 255, 204, 0.25);
  --border-glow: 0 0 15px rgba(0, 255, 204, 0.2);
  --font-mono: 'Courier New', Courier, Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Efecto de Líneas de Escaneo CRT (Scanlines Analógicas) */
body::after {
  content: " ";
  display: block;
  position: fixed;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.3) 50%),
              linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
  z-index: 9999;
  background-size: 100% 3px, 3px 100%;
  pointer-events: none;
}

/* ============================================================
   1. PANTALLAS Y CONTENEDORES
   ============================================================ */

.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  padding: 20px 15px;
}

.screen.active {
  display: block;
}

.container-narrow {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.container-wide {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

.glass-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--border-glow);
}

/* ============================================================
   2. ESTILO TERMINAL DOS (LOGIN DE TARJETA FÍSICA)
   ============================================================ */

.dos-terminal-box {
  width: 100%;
  max-width: 750px;
  margin: 40px auto 20px;
  padding: 25px 20px;
  border: 1px solid var(--cyan);
  background: rgba(0, 0, 0, 0.85);
  box-shadow: 0 0 25px rgba(0, 255, 204, 0.15);
  border-radius: 4px;
}

.dos-header-text {
  font-weight: bold;
  color: var(--cyan);
  margin-bottom: 15px;
  font-size: 1.1rem;
  letter-spacing: 1px;
}

.dos-instruction {
  color: var(--text-main);
  margin-bottom: 20px;
  min-height: 24px;
}

.dos-input-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 15px;
}

.dos-input {
  background: #000;
  border: 2px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: bold;
  padding: 10px 14px;
  width: 220px;
  outline: none;
  text-transform: uppercase;
  letter-spacing: 2px;
  border-radius: 4px;
}

.dos-input:focus {
  border-color: var(--green-neon);
  box-shadow: 0 0 10px rgba(51, 255, 51, 0.4);
}

.dos-btn {
  font-family: var(--font-mono);
  font-weight: bold;
  font-size: 1rem;
  padding: 12px 24px;
  cursor: pointer;
  border: 2px solid var(--cyan);
  background: rgba(0, 255, 204, 0.1);
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.dos-btn:hover {
  background: var(--cyan);
  color: #000;
  box-shadow: 0 0 15px var(--cyan);
}

.dos-btn-primary {
  border-color: var(--green-neon);
  background: rgba(51, 255, 51, 0.15);
  color: var(--green-neon);
}

.dos-btn-primary:hover {
  background: var(--green-neon);
  color: #000;
  box-shadow: 0 0 15px var(--green-neon);
}

.dos-message {
  min-height: 24px;
  font-weight: bold;
  font-size: 0.95rem;
  margin-top: 10px;
  letter-spacing: 1px;
}

/* ============================================================
   3. PANTALLA DE CITA Y RENDEZVOUS
   ============================================================ */

.rendezvous-card {
  border-left: 4px solid var(--cyan);
  padding: 20px;
  margin-top: 20px;
  background: rgba(0, 255, 204, 0.03);
  border-radius: 4px;
}

.rendezvous-coords {
  color: var(--amber-neon);
  font-size: 1.4rem;
  font-weight: bold;
  letter-spacing: 2px;
  margin: 12px 0;
}

.sync-counter-box {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-color);
  padding: 15px;
  border-radius: 6px;
  text-align: center;
  margin: 20px 0;
}

.sync-count {
  font-size: 2.2rem;
  font-weight: bold;
  color: var(--green-neon);
  text-shadow: 0 0 10px var(--green-glow);
  display: block;
}

/* ============================================================
   4. CONSOLA CENTRAL TÁCTICA (AGENCY UI)
   ============================================================ */

.agency-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.9);
  border-bottom: 2px solid var(--cyan);
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.agency-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agency-logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px var(--cyan));
}

.agency-brand-title {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--cyan);
  letter-spacing: 2px;
}

/* Cronómetro Neón Táctico */
.timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.neon-timer {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--red-neon);
  text-shadow: 0 0 10px var(--red-glow);
  letter-spacing: 2px;
}

.neon-timer.warning {
  animation: pulse 1s infinite alternate;
}

/* Barra de Navegación por Pestañas */
.agency-nav-bar {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 10px 15px;
  background: rgba(0, 0, 0, 0.6);
  border-bottom: 1px solid var(--border-color);
}

.nav-tab-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.nav-tab-btn.active {
  background: rgba(0, 255, 204, 0.15);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 255, 204, 0.2);
}

/* Layout Principal de la Consola */
.agency-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  padding: 20px 15px;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 850px) {
  .agency-layout {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   5. RADAR TÁCTICO MILITAR
   ============================================================ */

.radar-panel {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-color);
  padding: 15px;
  border-radius: 6px;
  text-align: center;
}

.radar-box {
  width: 160px;
  height: 160px;
  margin: 0 auto 12px;
  position: relative;
  border-radius: 50%;
  border: 2px solid var(--green-neon);
  box-shadow: inset 0 0 15px rgba(51, 255, 51, 0.2), 0 0 10px rgba(51, 255, 51, 0.3);
  overflow: hidden;
  background: radial-gradient(circle, rgba(0, 255, 51, 0.05) 0%, rgba(0, 0, 0, 0.9) 80%);
}

.radar-grid {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-image: 
    radial-gradient(circle, transparent 35%, rgba(51, 255, 51, 0.2) 36%, transparent 37%),
    radial-gradient(circle, transparent 65%, rgba(51, 255, 51, 0.2) 66%, transparent 67%),
    linear-gradient(to right, transparent 49%, rgba(51, 255, 51, 0.25) 50%, transparent 51%),
    linear-gradient(to bottom, transparent 49%, rgba(51, 255, 51, 0.25) 50%, transparent 51%);
}

.radar-sweep {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: conic-gradient(from 0deg at 50% 50%, rgba(51, 255, 51, 0.5) 0deg, rgba(51, 255, 51, 0) 60deg);
  border-radius: 50%;
  animation: sweep 3s linear infinite;
  transform-origin: center center;
}

.radar-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: pulse 1.5s infinite alternate;
}

.radar-dot.target {
  top: 35%;
  left: 65%;
  background: var(--red-neon);
  box-shadow: 0 0 8px var(--red-neon);
}

@keyframes sweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.agent-stats {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-dim);
  text-align: left;
  padding: 10px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
}

/* ============================================================
   6. TARJETAS DE MISIÓN EN LA CONSOLA
   ============================================================ */

.missions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
}

.mission-card {
  background: rgba(13, 18, 29, 0.85);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.mission-card.unlocked {
  border-color: var(--cyan);
  box-shadow: 0 0 15px rgba(0, 255, 204, 0.15);
}

.mission-card.unlocked:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(0, 255, 204, 0.25);
}

.mission-card.completed {
  border-color: var(--green);
  opacity: 0.75;
}

.mission-card.locked {
  border-color: rgba(255, 255, 255, 0.1);
  opacity: 0.45;
  filter: grayscale(80%);
}

.mission-card-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.badge-unlocked { background: rgba(0, 255, 204, 0.2); color: var(--cyan); border: 1px solid var(--cyan); }
.badge-completed { background: rgba(16, 185, 129, 0.2); color: var(--green); border: 1px solid var(--green); }
.badge-locked { background: rgba(255, 255, 255, 0.05); color: var(--text-muted); border: 1px solid #444; }

.mission-card-title {
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: 8px;
}

.mission-card-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 15px;
}

/* ============================================================
   7. CHAT HQ ENCRIPTADO
   ============================================================ */

.chat-box {
  display: flex;
  flex-direction: column;
  height: 480px;
}

.chat-messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.chat-bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  line-height: 1.4;
  word-break: break-word;
}

.chat-bubble.hq {
  align-self: flex-start;
  background: rgba(0, 255, 204, 0.1);
  border: 1px solid var(--cyan);
  color: var(--cyan);
}

.chat-bubble.agent {
  align-self: flex-end;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--green);
  color: #fff;
}

.chat-bubble.sys {
  align-self: center;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: italic;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.chat-input-field {
  flex: 1;
  background: #000;
  border: 1px solid var(--border-color);
  color: #fff;
  font-family: var(--font-mono);
  padding: 10px 12px;
  border-radius: 4px;
  outline: none;
}

.chat-input-field:focus {
  border-color: var(--cyan);
}

/* ============================================================
   8. EFECTOS GLITCH Y ANIMACIONES
   ============================================================ */

@keyframes pulse {
  0% { transform: scale(0.96); opacity: 0.7; }
  100% { transform: scale(1.04); opacity: 1; }
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-neon);
  box-shadow: 0 0 8px var(--green-neon);
  animation: pulse 1.2s infinite;
  margin-right: 6px;
}

/* Glitch de Alerta Final */
@keyframes glitch-anim {
  0% { transform: translate(0); }
  20% { transform: translate(-3px, 3px); filter: hue-rotate(90deg) saturate(200%); }
  40% { transform: translate(-3px, -3px); }
  60% { transform: translate(3px, 3px); filter: hue-rotate(-90deg) saturate(200%); }
  80% { transform: translate(3px, -3px); }
  100% { transform: translate(0); }
}

.glitch-effect {
  animation: glitch-anim 0.2s infinite;
}

/* ============================================================
   9. CARNET DE AGENTE Y DIPLOMA (CANVAS / WEBRTC)
   ============================================================ */

.camera-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 99999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.camera-preview {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  border: 2px solid var(--cyan);
  background: #000;
  object-fit: cover;
}

.agent-id-card-preview {
  width: 100%;
  max-width: 480px;
  border-radius: 12px;
  border: 2px solid var(--cyan);
  box-shadow: 0 0 30px rgba(0, 255, 204, 0.3);
  margin: 15px auto;
  display: block;
}
