/* Reset y Estilos Globales */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary-color: #00f3ff;
  --glow-color: rgba(0, 243, 255, 0.8);
  --secondary-glow: rgba(112, 0, 255, 0.6);
  --text-size: 18vw;
  --anim-speed: 8s;
  --sweep-speed: 2.5s;
  --font-family: 'Orbitron', sans-serif;
  --light-intensity: 1;
}

body {
  background-color: #040406;
  color: #ffffff;
  font-family: 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Escenario Principal */
.display-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #0a0a12 0%, #020204 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Overlay de Malla LED (Bombillas de letrero) */
#led-grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(rgba(0, 0, 0, 0.75) 40%, transparent 41%);
  background-size: 6px 6px;
  pointer-events: none;
  z-index: 5;
  opacity: 0.9;
}

/* Contenedor del Texto */
.text-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  white-space: nowrap;
  position: relative;
  z-index: 2;
}

/* Texto LED Principal */
.led-text {
  font-family: var(--font-family);
  font-size: var(--text-size);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
  text-align: center;
  user-select: none;
  color: var(--primary-color);
  filter: brightness(var(--light-intensity)) drop-shadow(0 0 calc(20px * var(--light-intensity)) var(--glow-color));
  text-shadow: 
    0 0 calc(10px * var(--light-intensity)) var(--primary-color),
    0 0 calc(20px * var(--light-intensity)) var(--primary-color),
    0 0 calc(40px * var(--light-intensity)) var(--glow-color),
    0 0 calc(80px * var(--light-intensity)) var(--glow-color),
    0 0 calc(120px * var(--light-intensity)) var(--secondary-glow);
  transition: font-size 0.2s ease, font-family 0.3s ease, filter 0.1s ease;
}

/* ===================================================
   MODOS DE ANIMACIÓN DE LUCES
   =================================================== */

/* 1. MODO MARQUESINA (TEXTO PASANDO) */
body.mode-marquee .text-container {
  justify-content: flex-start;
}

body.mode-marquee .led-text {
  display: inline-block;
  padding-left: 100vw;
  animation: marquee var(--anim-speed) linear infinite;
  background: linear-gradient(
    90deg,
    var(--primary-color) 0%,
    #ffffff 25%,
    var(--primary-color) 50%,
    #ffffff 75%,
    var(--primary-color) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  animation: marquee var(--anim-speed) linear infinite, lightShimmer 3s ease-in-out infinite alternate;
}

@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* 2. MODO BARRIDO DE LUZ (LIGHT SWEEP ESTÁTICO) */
body.mode-sweep .led-text {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.15) 0%,
    rgba(255, 255, 255, 0.3) 30%,
    #ffffff 50%,
    rgba(255, 255, 255, 0.3) 70%,
    rgba(255, 255, 255, 0.15) 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sweepPass var(--sweep-speed) infinite linear;
  filter: drop-shadow(0 0 25px var(--glow-color));
}

@keyframes sweepPass {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 3. MODO PULSACIÓN Y DESTELLOS NEÓN */
body.mode-pulse .led-text {
  animation: neonPulse 1.2s infinite alternate ease-in-out;
}

@keyframes neonPulse {
  0% {
    opacity: 0.8;
    filter: brightness(0.9) drop-shadow(0 0 15px var(--glow-color));
    transform: scale(0.99);
  }
  100% {
    opacity: 1;
    filter: brightness(1.6) drop-shadow(0 0 45px var(--primary-color));
    transform: scale(1.01);
  }
}

/* 4. MODO CHISPEANTE / LUCES PASANDO EN ONDA */
body.mode-sparkle .led-text {
  background: linear-gradient(
    45deg,
    var(--primary-color),
    #ffffff,
    var(--primary-color),
    #ffeedd,
    var(--primary-color)
  );
  background-size: 400% 400%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sparkleWave 3s ease infinite;
  filter: drop-shadow(0 0 30px var(--glow-color));
}

@keyframes sparkleWave {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes lightShimmer {
  0% { filter: brightness(1) drop-shadow(0 0 20px var(--glow-color)); }
  100% { filter: brightness(1.4) drop-shadow(0 0 50px var(--primary-color)); }
}

/* ===================================================
   PALETAS DE COLOR DE LUCES
   =================================================== */

/* Neón Cian */
body.theme-cyan {
  --primary-color: #00f3ff;
  --glow-color: rgba(0, 243, 255, 0.85);
  --secondary-glow: rgba(0, 100, 255, 0.7);
}

/* Rojo LED Clásico */
body.theme-red {
  --primary-color: #ff003c;
  --glow-color: rgba(255, 0, 60, 0.85);
  --secondary-glow: rgba(255, 80, 0, 0.7);
}

/* Dorado / Ámbar */
body.theme-gold {
  --primary-color: #ffcc00;
  --glow-color: rgba(255, 204, 0, 0.85);
  --secondary-glow: rgba(255, 102, 0, 0.7);
}

/* Matrix Verde */
body.theme-green {
  --primary-color: #00ff66;
  --glow-color: rgba(0, 255, 102, 0.85);
  --secondary-glow: rgba(0, 150, 50, 0.7);
}

/* Neón Magenta */
body.theme-magenta {
  --primary-color: #ff00a0;
  --glow-color: rgba(255, 0, 160, 0.85);
  --secondary-glow: rgba(130, 0, 255, 0.7);
}

/* Arcoíris Neón */
body.theme-rainbow .led-text {
  background: linear-gradient(
    90deg,
    #ff0055, #ff9900, #33ff00, #00ffff, #9900ff, #ff0055
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rainbowShift 4s linear infinite;
  filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.6));
}

@keyframes rainbowShift {
  0% { background-position: 0% 0%; }
  100% { background-position: 300% 0%; }
}

/* Estilos de Fuente */
.font-orbitron { var(--font-family): 'Orbitron', sans-serif; }
.font-retro { var(--font-family): 'Press Start 2P', cursive; }
.font-bold { var(--font-family): 'Righteous', cursive; }

/* ===================================================
   PANEL DE CONTROL INTERACTIVO
   =================================================== */

.controls-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 340px;
  max-height: calc(100vh - 40px);
  background: rgba(15, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 15px rgba(0, 243, 255, 0.2);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.controls-panel.hidden {
  transform: translateX(380px);
  opacity: 0;
  pointer-events: none;
}

.panel-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: #aaaaaa;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.panel-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-group label {
  font-size: 0.82rem;
  color: #cccccc;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}

.control-group input[type="text"],
.control-group select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.control-group select option {
  background: #12121c;
  color: #ffffff;
}

.control-group input[type="text"]:focus,
.control-group select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 8px var(--glow-color);
}

.control-group input[type="range"] {
  width: 100%;
  accent-color: var(--primary-color);
  cursor: pointer;
  height: 6px;
}

.checkbox-group {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.checkbox-group input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-color);
  cursor: pointer;
}

.checkbox-group label {
  margin: 0;
  cursor: pointer;
}

.panel-actions {
  margin-top: 10px;
}

.btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, #0077ff 100%);
  color: #000000;
  box-shadow: 0 4px 15px var(--glow-color);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--glow-color);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Botón Flotante para Reabrir */
.btn-floating {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(20, 20, 35, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 10px var(--glow-color);
  z-index: 90;
  transition: all 0.3s ease;
}

.btn-floating:hover {
  transform: scale(1.05);
  border-color: var(--primary-color);
}

.btn-floating.hidden {
  display: none;
}

/* Ajustes Responsivos */
@media (max-width: 600px) {
  .controls-panel {
    width: calc(100vw - 30px);
    right: 15px;
    top: 15px;
  }
}
