/* ============================================
   VARIABLES Y TEMA (Modo Oscuro)
   ============================================ */
:root {
  /* Paleta de Colores Estilo GitHub Dark */
  --bg-body: #0d1117;
  --bg-card: #1e1e1e;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  
  /* Colores de Acento */
  --accent-blue: #58a6ff;
  --accent-green: #7ee787;
  --accent-red: #f85149;
  
  /* Elementos de UI */
  --border-color: #30363d;
  --input-bg: #0d1117;
  
  /* Tipografía y Bordes */
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'Roboto Mono', monospace;
  --radius-lg: 12px;
  --radius-md: 8px;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
body {
  margin: 0;
  padding: 1rem;
  min-height: 100vh;
  font-family: var(--font-main);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-body);
  position: relative;
  overflow-x: hidden;
}

/* Contenedor para el fondo Three.js */
#canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-color: var(--bg-body);
}

/* Reset Básico */
*, *::before, *::after { box-sizing: border-box; }

/* Scrollbar Personalizado */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 5px; }

/* ============================================
   COMPONENTES DE TARJETA
   ============================================ */
.container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.main-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  animation: fadeInUp .6s ease-out; /* Animación de entrada */
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

header {
  text-align: center;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

h1 {
  font-size: 1.8rem;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

.subtitle { color: var(--text-secondary); font-size: .9rem; }

/* ============================================
   FORMULARIO E INPUTS
   ============================================ */
.field { margin-bottom: 1.5rem; position: relative; }

label {
  display: block;
  margin-bottom: .5rem;
  color: var(--text-secondary);
  font-size: .9rem;
  font-weight: 600;
}

/* Estilos unificados para inputs */
input, textarea, select {
  width: 100%;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: .75rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: .95rem;
  transition: all .2s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(88,166,255,.2);
}

textarea::placeholder { color: var(--border-color); }

/* Botones de incremento/decremento (César) */
.btn-stepper {
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: .2s;
}
.btn-stepper:hover { border-color: var(--accent-blue); color: var(--accent-blue); }

.input-group { display: flex; gap: .5rem; }

/* Radio Buttons Personalizados */
.radio-group {
  display: flex;
  gap: 1rem;
  background: var(--input-bg);
  padding: .5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.radio-item { flex: 1; position: relative; }
.radio-item input { opacity: 0; position: absolute; width: 0; }

.radio-item label {
  display: block;
  text-align: center;
  padding: .75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  color: var(--text-secondary);
  transition: .3s;
}

/* Estado activo del radio button */
.radio-item input:checked + label {
  background-color: var(--accent-blue);
  color: #fff;
}

/* ============================================
   BOTONES DE ACCIÓN
   ============================================ */
.form-actions { display: flex; gap: 1rem; margin-top: 2rem; }

.btn {
  flex: 1;
  padding: .8rem;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-main);
  transition: .2s;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary { background-color: var(--accent-green); color: #000; }
.btn-secondary { background: 0 0; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-secondary:hover { background: rgba(255,255,255,.05); }

/* ============================================
   TERMINAL DE RESULTADOS (Estilo Retro)
   ============================================ */
.result-container {
  margin-top: 2rem;
  background-color: #0a0a0a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 1.5rem;
  min-height: 120px;
  max-height: 300px;
  overflow-y: auto;
  
  /* Fuente Hacker */
  font-family: 'Roboto Mono', monospace;
  font-size: 1rem;
  color: #00ff41;
  letter-spacing: 2px;
  text-shadow: 0 0 5px rgba(0,255,65,.5);
  
  position: relative;
  box-shadow: inset 0 0 20px rgba(0,0,0,.8);
}

.result-placeholder {
  color: #005f15;
  font-style: normal;
  text-shadow: none;
  opacity: .7;
}

/* Cursor parpadeante */
.terminal-cursor {
  display: inline-block;
  width: 10px;
  height: 1.2em;
  background-color: #00ff41;
  vertical-align: bottom;
  animation: blink 1s step-end infinite;
  margin-left: 2px;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* ============================================
   SECCIÓN DE INFORMACIÓN Y EXTRAS
   ============================================ */
.info-section { margin-top: 3rem; border-top: 1px solid var(--border-color); padding-top: 2rem; }
.algo-header { margin-bottom: 1.5rem; }
.algo-summary { color: var(--text-secondary); line-height: 1.6; }

.example-chip {
  display: inline-block;
  background: rgba(88,166,255,.1);
  color: var(--accent-blue);
  padding: .2rem .6rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: .85rem;
  margin-top: .5rem;
}

/* Advertencia de Seguridad */
.security-warning {
  background: rgba(248,81,73,.1);
  border: 1px solid rgba(248,81,73,.4);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.warning-header { display: flex; align-items: center; gap: .5rem; color: var(--accent-red); margin-bottom: .5rem; }
.warning-header svg { stroke: var(--accent-red); }
.security-warning p { margin: 0; font-size: .9rem; color: var(--text-secondary); }

/* Panel Expandible (Details/Summary) */
.modern-panel {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.modern-panel summary {
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  transition: .2s;
}
.modern-panel summary:hover { background: rgba(255,255,255,.02); }
.panel-content { padding: 1rem; border-top: 1px solid var(--border-color); }

.modern-list { list-style: none; padding: 0; margin: 0; }
.modern-list li { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; }
.modern-list li:last-child { margin-bottom: 0; }

.modern-tag {
  display: inline-block;
  background: rgba(126,231,135,.1);
  color: var(--accent-green);
  padding: .2rem .5rem;
  border-radius: 4px;
  font-size: .8rem;
  font-weight: 600;
  width: fit-content;
}
.modern-list span:not(.modern-tag) { font-size: .9rem; color: var(--text-secondary); }

footer { text-align: center; margin-top: 3rem; color: var(--text-secondary); font-size: .85rem; }
footer span { color: var(--text-primary); }

/* Utilidades */
.hidden { display: none !important; }
.error-msg { color: var(--accent-red); font-size: .85rem; margin-top: .5rem; display: block; min-height: 1.2em; }

/* Responsive */
@media (max-width: 600px) {
  .main-card { padding: 1.5rem; }
  .form-actions { flex-direction: column; }
}
