@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;600;700&family=Orbitron:wght@700;900&display=swap');

/* ============================================
   VARIABLES Y RESET - GAMING EDITION
============================================ */

:root {
  /* Colores gaming RGB */
  --neon-cyan: #00f0ff;
  --neon-magenta: #ff00ff;
  --neon-purple: #b700ff;
  --electric-blue: #0066ff;
  --toxic-green: #00ff88;
  --hot-pink: #ff0080;
  --laser-red: #ff2a6d;
  --gold-neon: #ffcc00;
  
  /* Fondos oscuros tech */
  --fondo: #0a0e1a;
  --fondo-card: #14182b;
  --fondo-nav: #0d1120;
  
  /* Texto */
  --texto: #ffffff;
  --texto-suave: #8b92b8;
  --texto-dim: #5a5f7d;
  
  /* Efectos */
  --sombra: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 1px rgba(0, 240, 255, 0.3);
  --sombra-hover: 0 12px 48px rgba(0, 240, 255, 0.4), 0 0 20px rgba(255, 0, 255, 0.3);
  --glow-cyan: 0 0 20px rgba(0, 240, 255, 0.5), 0 0 40px rgba(0, 240, 255, 0.3);
  --glow-magenta: 0 0 20px rgba(255, 0, 255, 0.5), 0 0 40px rgba(255, 0, 255, 0.3);
  --glow-green: 0 0 20px rgba(0, 255, 136, 0.5), 0 0 40px rgba(0, 255, 136, 0.3);
  --glow-red: 0 0 20px rgba(255, 42, 109, 0.5), 0 0 40px rgba(255, 42, 109, 0.3);
  --radio: 12px;
  --transicion: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ============================================
   PÁGINA DE LOGIN
============================================ */

body.login-page {
  background: var(--fondo);
  font-family: 'Rajdhani', sans-serif;
  color: var(--texto);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Grid de fondo tech */
body.login-page::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

/* Efectos de luz de fondo */
body.login-page::after {
  content: '';
  position: fixed;
  top: -200px;
  right: -200px;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.1), transparent 70%);
  pointer-events: none;
  animation: pulse-glow 6s ease-in-out infinite;
  z-index: 0;
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.2); opacity: 0.6; }
}

/* ============================================
   CAJA DE LOGIN
============================================ */

.login-box {
  background: var(--fondo-card);
  border-radius: var(--radio);
  padding: 60px 50px;
  width: 90%;
  max-width: 480px;
  box-shadow: var(--sombra-hover);
  border: 2px solid rgba(0, 240, 255, 0.2);
  position: relative;
  z-index: 1;
}

.login-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta), var(--neon-purple), var(--toxic-green));
  animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.login-box h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta), var(--toxic-green));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 15px rgba(0, 240, 255, 0.6));
  margin-bottom: 40px;
  text-align: center;
}

.login-box input {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid rgba(0, 240, 255, 0.3);
  border-radius: 10px;
  background: rgba(20, 24, 43, 0.6);
  color: white;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  outline: none;
  transition: var(--transicion);
  margin-bottom: 20px;
}

.login-box input::placeholder {
  color: var(--texto-dim);
  font-weight: 600;
}

.login-box input:focus {
  background: rgba(20, 24, 43, 0.9);
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

.login-box button {
  width: 100%;
  padding: 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  color: white;
  border: 2px solid var(--neon-cyan);
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transicion);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.3);
  margin-top: 10px;
}

.login-box button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.login-box button:hover::before {
  width: 300px;
  height: 300px;
}

.login-box button:hover {
  background: linear-gradient(135deg, var(--toxic-green), var(--neon-cyan));
  border-color: var(--toxic-green);
  box-shadow: var(--glow-green);
  transform: translateY(-2px);
}

.login-box button:active {
  transform: translateY(0) scale(0.98);
}

/* Mensaje de error */
#error {
  color: var(--laser-red);
  font-size: 1rem;
  font-weight: 700;
  margin-top: 20px;
  text-align: center;
  min-height: 24px;
  letter-spacing: 0.5px;
  text-shadow: 0 0 10px rgba(255, 42, 109, 0.5);
}

/* ============================================
   PÁGINA DE ADMINISTRACIÓN
============================================ */

body:not(.login-page) {
  background: var(--fondo);
  font-family: 'Rajdhani', sans-serif;
  color: var(--texto);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Grid de fondo tech para admin */
body:not(.login-page)::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

/* ============================================
   HEADER
============================================ */

header {
  background: linear-gradient(135deg, #0d1120 0%, #14182b 50%, #0d1120 100%);
  color: white;
  padding: 48px 30px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta), var(--neon-purple), var(--toxic-green)) 1;
  z-index: 1;
}

/* Efectos de luz animados */
header::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.15), transparent 70%);
  pointer-events: none;
  animation: pulse-glow-header 4s ease-in-out infinite;
}

header::after {
  content: '';
  position: absolute;
  bottom: -80px;
  left: 5%;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 0, 255, 0.12), transparent 70%);
  pointer-events: none;
  animation: pulse-glow-header 4s ease-in-out infinite 2s;
}

@keyframes pulse-glow-header {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.15); opacity: 0.7; }
}

/* Contenedor del header - Logo posicionado absoluto */
.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* Logo */
.logo-container {
  position: absolute;
  left: 30px;
  top: 5px;
}

.logo {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--neon-cyan);
  box-shadow: var(--glow-cyan);
  transition: var(--transicion);
}

.logo:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.8), 0 0 50px rgba(255, 0, 255, 0.4);
  border-color: var(--neon-magenta);
}

/* Info del header CENTRADA */
.header-info {
  text-align: center;
  flex: 1;
}

.header-info h1 {
  margin: 0;
}

.header-info p {
  margin: 0.25rem 0 0 0;
}

header h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 900;
  letter-spacing: 3px;
  position: relative;
  z-index: 1;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta), var(--toxic-green));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 15px rgba(0, 240, 255, 0.6));
  margin-bottom: 8px;
}

header h1 span {
  background: linear-gradient(135deg, var(--gold-neon), var(--hot-pink));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(255, 204, 0, 0.6));
}

header p {
  margin-top: 12px;
  font-size: 1.1rem;
  color: var(--texto-suave);
  font-weight: 600;
  letter-spacing: 2px;
  position: relative;
  z-index: 1;
  text-transform: uppercase;
}

/* Botón cerrar sesión en header */
header button {
  margin-top: 20px;
  padding: 12px 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--laser-red), var(--hot-pink));
  color: white;
  border: 2px solid var(--laser-red);
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transicion);
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 15px rgba(255, 42, 109, 0.3);
}

header button:hover {
  background: linear-gradient(135deg, var(--hot-pink), var(--laser-red));
  box-shadow: var(--glow-red);
  transform: translateY(-2px);
}

/* ============================================
   CONTENEDOR PRINCIPAL
============================================ */

.contenedor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 1400px;
  margin: 32px auto;
  padding: 0 24px 40px;
  position: relative;
  z-index: 1;
}

/* ============================================
   SECCIONES (TARJETAS)
============================================ */

section {
  background: var(--fondo-card);
  border-radius: var(--radio);
  padding: 28px;
  box-shadow: var(--sombra);
  border: 2px solid rgba(0, 240, 255, 0.2);
  position: relative;
}

section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta), var(--neon-purple));
}

section h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--neon-cyan);
  margin-bottom: 24px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 12px;
}

section h2::after {
  content: "";
  flex: 1;
  height: 2px;
  background: linear-gradient(to right, var(--neon-cyan), transparent);
  border-radius: 2px;
}

/* ============================================
   INPUTS Y FORMULARIOS
============================================ */

input,
textarea,
select {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid rgba(0, 240, 255, 0.3);
  border-radius: 10px;
  background: rgba(20, 24, 43, 0.6);
  color: white;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  transition: var(--transicion);
  margin-bottom: 14px;
}

input::placeholder,
textarea::placeholder {
  color: var(--texto-dim);
  font-weight: 600;
}

input:focus,
textarea:focus,
select:focus {
  background: rgba(20, 24, 43, 0.9);
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath stroke='%238b92b8' stroke-width='2' stroke-linecap='round' fill='none' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  padding-right: 40px;
}

/* ============================================
   BOTONES
============================================ */

.formulario button,
button[type="submit"] {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  color: white;
  border: 2px solid var(--neon-cyan);
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transicion);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.3);
  margin-top: 6px;
}

.formulario button::before,
button[type="submit"]::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.formulario button:hover::before,
button[type="submit"]:hover::before {
  width: 300px;
  height: 300px;
}

.formulario button:hover,
button[type="submit"]:hover {
  background: linear-gradient(135deg, var(--toxic-green), var(--neon-cyan));
  border-color: var(--toxic-green);
  box-shadow: var(--glow-green);
  transform: translateY(-2px);
}

.formulario button:active,
button[type="submit"]:active {
  transform: translateY(0) scale(0.98);
}

/* ============================================
   LISTAS DE ITEMS
============================================ */

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 10px;
  border: 2px solid rgba(0, 240, 255, 0.2);
  margin-bottom: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: var(--transicion);
  background: rgba(20, 24, 43, 0.4);
}

.item:hover {
  border-color: var(--neon-cyan);
  background: rgba(20, 24, 43, 0.6);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.item span {
  color: var(--texto);
  flex: 1;
  margin-right: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item div {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Botón editar */
.item .btn-editar,
.item button:first-child {
  background: transparent;
  color: var(--neon-cyan);
  border: 2px solid var(--neon-cyan);
  border-radius: 8px;
  padding: 6px 14px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transicion);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.item .btn-editar:hover,
.item button:first-child:hover {
  background: var(--neon-cyan);
  color: var(--fondo);
  box-shadow: var(--glow-cyan);
}

/* Botón eliminar */
.item .btn-eliminar,
.item .btn-eliminar-usuario,
.item .btn-eliminar-categoria,
.item button:last-child {
  background: transparent;
  color: var(--laser-red);
  border: 2px solid var(--laser-red);
  border-radius: 8px;
  padding: 6px 14px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transicion);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.item .btn-eliminar:hover,
.item .btn-eliminar-usuario:hover,
.item .btn-eliminar-categoria:hover,
.item button:last-child:hover {
  background: var(--laser-red);
  color: white;
  box-shadow: var(--glow-red);
}

/* Mensaje vacío */
.lista p {
  color: var(--texto-suave);
  font-size: 0.95rem;
  padding: 10px 0;
  text-align: center;
}

/* ============================================
   MODAL DE EDICIÓN
============================================ */

#modalEditar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 14, 26, 0.95);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.modal-contenido {
  background: #ffffff;
  border-radius: var(--radio);
  padding: 36px;
  width: 90%;
  max-width: 550px;
  box-shadow: var(--sombra-hover);
  border: 2px solid rgba(0, 240, 255, 0.3);
  position: relative;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-contenido::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta), var(--neon-purple));
}

.modal-contenido h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: #0a7a7a;
  margin-bottom: 24px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
}

/* Labels del modal */
.modal-contenido label {
  display: block;
  color: #2c3e50;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 6px;
  margin-top: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modal-contenido label:first-of-type {
  margin-top: 0;
}

/* Inputs del modal - FONDO CLARO CON TEXTO OSCURO */
#modalEditar input,
#modalEditar textarea,
#modalEditar select {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  background: #f3f4f6;
  color: #1f2937;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  transition: var(--transicion);
  margin-bottom: 0;
}

#modalEditar input::placeholder,
#modalEditar textarea::placeholder {
  color: #9ca3af;
  font-weight: 600;
}

#modalEditar input:focus,
#modalEditar textarea:focus,
#modalEditar select:focus {
  background: #ffffff;
  border-color: #0a7a7a;
  box-shadow: 0 0 0 3px rgba(10, 122, 122, 0.1);
}

#modalEditar select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath stroke='%239ca3af' stroke-width='2' stroke-linecap='round' fill='none' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  padding-right: 40px;
}

/* Contenedor de botones del modal */
.modal-botones {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.modal-botones button {
  flex: 1;
  padding: 14px;
  border-radius: 10px;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transicion);
  border: 2px solid;
}

/* Botón Guardar */
#btnGuardarEdicion {
  background: #0a7a7a;
  color: white;
  border-color: #0a7a7a;
  box-shadow: 0 4px 15px rgba(10, 122, 122, 0.3);
}

#btnGuardarEdicion:hover {
  background: #086464;
  border-color: #086464;
  box-shadow: 0 6px 20px rgba(10, 122, 122, 0.4);
  transform: translateY(-2px);
}

/* Botón Cancelar */
#btnCancelarEdicion {
  background: transparent;
  color: #dc2626;
  border-color: #dc2626;
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.2);
}

#btnCancelarEdicion:hover {
  background: #dc2626;
  color: white;
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
  transform: translateY(-2px);
}

/* ============================================
   RESPONSIVE
============================================ */

@media (max-width: 768px) {
  .login-box {
    max-width: 90%;
    padding: 50px 40px;
  }

  .login-box h2 {
    font-size: 2rem;
    margin-bottom: 32px;
  }

  header {
    padding: 36px 20px 32px;
  }

  .logo-container {
    display: none;
  }

  header h1 {
    font-size: 1.8rem;
    letter-spacing: 1.5px;
  }

  header p {
    font-size: 0.85rem;
  }

  .contenedor {
    grid-template-columns: 1fr;
    padding: 0 16px 32px;
    margin-top: 20px;
  }

  section {
    padding: 22px 18px;
  }

  .modal-contenido {
    width: 95%;
    padding: 28px 20px;
  }

  .modal-contenido h3 {
    font-size: 1.3rem;
  }

  .modal-botones {
    flex-direction: column;
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  .logo {
    width: 100px;
    height: 100px;
  }

  .logo-container {
    left: 20px;
    top: 5px;
  }
}

@media (min-width: 901px) and (max-width: 1200px) {
  .logo {
    width: 130px;
    height: 130px;
  }

  .logo-container {
    left: 25px;
    top: 5px;
  }
}