/* =========================================
   1. RESET Y ESTILOS GLOBALES
   ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

body {
  background: #e2e8f0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* =========================================
   2. NAVBAR (Barra superior)
   ========================================= */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e293b;
  color: #fff;
  padding: 0 16px;
  height: 60px;
  flex-shrink: 0;
  z-index: 100;
}

.navbar .logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

/* =========================================
   3. BOTÓN HAMBURGUESA
   ========================================= */
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 110;
}

.hamburger span {
  display: block;
  width: 26px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Animación a "X" */
.hamburger.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* =========================================
   4. MENÚ LATERAL Y SUBMENÚ
   ========================================= */
.menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  height: 100vh;
  background: #0f172a;
  padding: 80px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform: translateX(100%);
  transition: transform 0.35s ease;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  z-index: 105;
  overflow-y: auto;
}

.menu.open {
  transform: translateX(0);
}

.menu a,
.menu .menu-item {
  color: #e2e8f0;
  text-decoration: none;
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, color 0.2s;
}

.menu a:hover,
.menu .menu-item:hover {
  background: #1e293b;
  color: #fff;
}

.menu .icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.menu .arrow {
  margin-left: auto;
  transition: transform 0.3s ease;
  font-size: 0.8rem;
}

.menu-item.open .arrow {
  transform: rotate(180deg);
}

/* --- Submenú de Caja --- */
.submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.submenu.open {
  max-height: 500px;
}

.submenu a {
  padding: 10px 16px 10px 56px;
  font-size: 0.92rem;
  color: #cbd5e1;
  position: relative;
}

.submenu a::before {
  content: '';
  position: absolute;
  left: 32px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #475569;
  transition: background 0.2s;
}

.submenu a:hover::before {
  background: #38bdf8;
}

/* =========================================
   5. OVERLAY (Fondo oscuro al abrir menú)
   ========================================= */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 104;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* =========================================
   6. ÁREA DE CONTENIDO PRINCIPAL
   ========================================= */
#app {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  justify-content: center;
}

/* =========================================
   7. ESTRUCTURA DE LA PANTALLA DEL MÓDULO
   ========================================= */
.modulo-screen {
  background: #fff;
  border: 1px solid #64748b;
  padding: 10px;
  width: 100%;
  max-width: 900px;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modulo-header {
  text-align: center;
  background: #e2e8f0;
  border: 1px solid #94a3b8;
  padding: 6px;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 2px;
  font-family: 'Arial Black', sans-serif;
  color: #000;
}

/* =========================================
   8. SECCIONES Y GRILLAS (Tamaños fijos)
   ========================================= */
.seccion {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.seccion-titulo {
  font-size: 0.85rem;
  font-weight: 900;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 2px;
  border-bottom: 2px solid #94a3b8; /* Línea divisoria más marcada */
  padding-bottom: 2px;
}

.grilla {
  display: grid;
  gap: 10px;
  /* Esto permite que si la pantalla es chica, se pueda hacer scroll horizontal */
  overflow-x: auto; 
  padding-bottom: 5px;
}

/* CHICAS: Botones de 45px */
.grilla-chicas {
  grid-template-columns: repeat(8, 45px);
}

/* MEDIANAS: Botones de 70px (Notablemente más grandes) */
.grilla-medianas {
  grid-template-columns: repeat(8, 70px);
}

/* GRANDES: Botones de 100px (Enormes) */
.grilla-grandes {
  grid-template-columns: repeat(8, 100px);
}

/* =========================================
   9. CASILLEROS (Tamaños fijos)
   ========================================= */
.casillero {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s, filter 0.2s;
  user-select: none;
  border: 1px solid #64748b;
}

.casillero:hover {
  filter: brightness(0.9);
  transform: scale(1.05);
  z-index: 2;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* --- Tamaño CHICA --- */
.chica .casillero {
  width: 50px;
  height: 40px; /* Un poco más anchas que altas */
  font-size: 0.85rem;
}

/* --- Tamaño MEDIANA --- */
.mediana .casillero {
  width: 70px;
  height: 70px; /* Cuadradas */
  font-size: 1.5rem;
  border: 2px solid #334155;
}

/* --- Tamaño GRANDE --- */
.grande .casillero {
  width: 100px;
  height: 100px; /* Cuadradas y grandes */
  font-size: 2.5rem;
  border: 3px solid #000;
}

/* =========================================
   10. LEYENDA Y BOTÓN DE SALIR (Footer)
   ========================================= */
.footer-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  border-top: 1px dashed #cbd5e1;
  padding-top: 10px;
}

.leyenda {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  font-size: 0.75rem;
  font-weight: bold;
  color: #334155;
}

.leyenda-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.color-box {
  width: 20px;
  height: 12px;
  border: 1px solid #64748b;
}

/* --- Colores de estado de los casilleros --- */
.bg-libre {
  background: #bae6fd; /* Azul claro */
}

.bg-reparacion {
  background: #cbd5e1; /* Gris */
}

.bg-ocupada {
  background: #fef08a; /* Amarillo */
}

.bg-interna {
  background: #fed7aa; /* Naranja */
}

/* --- Botón Salir --- */
.btn-salir {
  background: #f1f5f9;
  border: 2px solid #94a3b8;
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: bold;
  color: #334155;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn-salir:hover {
  background: #e2e8f0;
}

/* =========================================
   11. RESPONSIVE (Pantallas móviles/tablets)
   ========================================= */
@media (max-width: 768px) {
  /* Reducimos las columnas a 4 para que quepan en el celular */
  .grilla-chicas,
  .grilla-medianas,
  .grilla-grandes {
    grid-template-columns: repeat(4, 1fr);
  }

  .modulo-header {
    font-size: 1.3rem;
  }

  .mediana .casillero {
    font-size: 1rem;
    padding: 8px 0;
  }

  .grande .casillero {
    font-size: 2.5rem;
    padding: 10px 0;
  }

  .footer-panel {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
}