/* ============================================================
   PANADERÍA CMS – HOJA DE ESTILOS PRINCIPAL
   Móvil primero → Tablet → Escritorio
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --primario:    #8B4513;
  --secundario:  #D2691E;
  --acento:      #F4A460;
  --fondo:       #FFF8F0;
  --blanco:      #FFFFFF;
  --texto:       #333333;
  --gris-claro:  #F5F5F5;
  --gris:        #999999;
  --rojo:        #E53935;
  --verde:       #43A047;
  --sombra:      0 2px 12px rgba(0,0,0,.10);
  --sombra-lg:   0 6px 24px rgba(0,0,0,.15);
  --radio:       10px;
  --radio-sm:    6px;
  --transicion:  .25s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--fondo); color: var(--texto); line-height: 1.6; }
img  { max-width: 100%; display: block; }
a    { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Contenedor ─────────────────────────────────────────────── */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 0; }

/* ── Botones generales ──────────────────────────────────────── */
.btn { display: inline-block; padding: 10px 20px; border: none; border-radius: var(--radio-sm); font-size: .95rem; font-weight: 600; transition: all var(--transicion); }
.btn-primario   { background: var(--primario);   color: #fff; }
.btn-primario:hover   { background: var(--secundario); }
.btn-secundario { background: var(--gris-claro); color: var(--texto); }
.btn-secundario:hover { background: #e0e0e0; }
.btn-peligro    { background: var(--rojo);    color: #fff; }
.btn-peligro:hover    { background: #b71c1c; }
.btn-verde      { background: var(--verde);   color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-full { width: 100%; display: block; text-align: center; }

/* ── Formularios ────────────────────────────────────────────── */
.form-grupo { margin-bottom: 14px; }
.form-grupo label { display: block; font-weight: 600; margin-bottom: 5px; font-size: .9rem; color: var(--primario); }
.form-grupo input,
.form-grupo textarea,
.form-grupo select {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd;
  border-radius: var(--radio-sm); font-size: .95rem; transition: border var(--transicion);
}
.form-grupo input:focus,
.form-grupo textarea:focus,
.form-grupo select:focus { outline: none; border-color: var(--primario); }
.form-grupo small { color: var(--gris); font-size: .8rem; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Alertas ────────────────────────────────────────────────── */
.alerta { padding: 12px 16px; border-radius: var(--radio-sm); margin-bottom: 14px; font-size: .9rem; }
.alerta-error   { background: #ffebee; color: #b71c1c; border-left: 4px solid var(--rojo); }
.alerta-exito   { background: #e8f5e9; color: #1b5e20; border-left: 4px solid var(--verde); }
.alerta-info    { background: #e3f2fd; color: #0d47a1; border-left: 4px solid #1565c0; }

/* ============================================================
   HEADER TIENDA PÚBLICA
   ============================================================ */
.header {
  background: var(--primario);
  color: #fff;
  position: sticky; top: 0; z-index: 1000;
  box-shadow: var(--sombra);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 64px;
}
.logo-texto { font-size: 1.3rem; font-weight: 700; letter-spacing: .5px; }
.logo-texto span { color: var(--acento); }

/* Ícono carrito */
.btn-carrito {
  position: relative; background: rgba(255,255,255,.15);
  border: none; color: #fff; font-size: 1.5rem;
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transicion);
}
.btn-carrito:hover { background: rgba(255,255,255,.3); }
.carrito-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--rojo); color: #fff;
  font-size: .7rem; font-weight: 700;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* Animación brillo al agregar */
@keyframes brillo {
  0%   { box-shadow: 0 0 0 0 gold; }
  50%  { box-shadow: 0 0 18px 8px gold; }
  100% { box-shadow: 0 0 0 0 gold; }
}
.brillo { animation: brillo .5s ease; }

/* ============================================================
   SLIDER DOBLE
   ============================================================ */
.slider-doble-wrap { padding: 16px 16px 0; }
.slider-doble {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; border-radius: var(--radio); overflow: hidden;
}
.slider-mitad {
  position: relative; height: 180px; overflow: hidden;
  cursor: pointer; border-radius: var(--radio);
}
.slider-mitad img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s ease;
}
.slider-mitad:hover img { transform: scale(1.05); }
.slider-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.65) 0%, transparent 55%);
  display: flex; flex-direction: column;
  justify-content: flex-end; padding: 14px;
}
.slider-etiqueta {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--acento); margin-bottom: 4px;
}
.slider-titulo { font-size: 1rem; font-weight: 700; color: #fff; line-height: 1.3; }
.slider-hint { font-size: .75rem; color: rgba(255,255,255,.8); margin-top: 4px; }

/* ============================================================
   SECCIÓN OFERTAS
   ============================================================ */
.seccion { padding: 28px 16px; }
.seccion-titulo {
  font-size: 1.3rem; font-weight: 700; color: var(--primario);
  margin-bottom: 18px; display: flex; align-items: center; gap: 8px;
}
.seccion-titulo::after {
  content: ''; flex: 1; height: 2px;
  background: linear-gradient(to right, var(--acento), transparent);
}

/* ============================================================
   FILTROS
   ============================================================ */
.filtros-wrap {
  background: var(--blanco); border-radius: var(--radio);
  padding: 18px; box-shadow: var(--sombra); margin-bottom: 20px;
}
.filtros-grid { display: grid; gap: 14px; }
.rango-precio-vals { display: flex; justify-content: space-between; font-size: .85rem; color: var(--gris); margin-top: 4px; }
input[type=range] { width: 100%; accent-color: var(--primario); }
.tags-lista { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag-btn {
  padding: 4px 12px; border: 1.5px solid var(--gris);
  border-radius: 20px; font-size: .8rem; background: transparent;
  color: var(--texto); transition: all var(--transicion);
}
.tag-btn:hover, .tag-btn.activo {
  background: var(--primario); border-color: var(--primario); color: #fff;
}

/* ============================================================
   CATÁLOGO DE PRODUCTOS
   ============================================================ */
/* Móvil: 2 columnas SIN márgenes laterales */
.productos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0; /* sin padding lateral en móvil */
}

.producto-card {
  background: var(--blanco); border-radius: var(--radio);
  box-shadow: var(--sombra); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform var(--transicion), box-shadow var(--transicion);
  position: relative;
}
.producto-card:hover { transform: translateY(-4px); box-shadow: var(--sombra-lg); }

.producto-img-wrap { position: relative; overflow: hidden; }
.producto-img-wrap img {
  width: 100%; height: 140px; object-fit: cover;
  transition: transform .4s ease;
}
.producto-card:hover .producto-img-wrap img { transform: scale(1.06); }

.badge-oferta {
  position: absolute; top: 8px; left: 8px;
  background: var(--rojo); color: #fff;
  font-size: .7rem; font-weight: 700; padding: 3px 8px;
  border-radius: 20px; z-index: 2;
}

.producto-body { padding: 10px; flex: 1; display: flex; flex-direction: column; }
.producto-nombre { font-size: .9rem; font-weight: 700; color: var(--primario); margin-bottom: 4px; }
.producto-desc { font-size: .78rem; color: var(--gris); line-height: 1.4; flex: 1; }

.precio-wrap { margin: 8px 0; }
.precio-normal { font-size: 1rem; font-weight: 700; color: var(--primario); }
.precio-tachado { font-size: .82rem; color: var(--gris); text-decoration: line-through; }
.precio-oferta-val { font-size: 1rem; font-weight: 700; color: var(--rojo); }

.btn-agregar {
  width: 100%; padding: 8px; border: none; border-radius: var(--radio-sm);
  background: var(--primario); color: #fff; font-size: .85rem; font-weight: 600;
  transition: background var(--transicion);
}
.btn-agregar:hover { background: var(--secundario); }

/* ============================================================
   MODAL GENÉRICO
   ============================================================ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 2000;
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.abierto { display: flex; }
.modal-caja {
  background: var(--blanco); border-radius: var(--radio);
  width: 100%; max-width: 540px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--sombra-lg);
  animation: slideDown .25s ease;
}
@keyframes slideDown {
  from { transform: translateY(-30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid #eee;
  position: sticky; top: 0; background: var(--blanco); z-index: 1;
}
.modal-header h3 { font-size: 1.1rem; color: var(--primario); }
.modal-cerrar { background: none; border: none; font-size: 1.5rem; color: var(--gris); line-height: 1; }
.modal-cerrar:hover { color: var(--rojo); }
.modal-body { padding: 20px; }

/* ============================================================
   CARRITO – DENTRO DEL MODAL
   ============================================================ */
.carrito-vacio { text-align: center; padding: 40px 20px; color: var(--gris); }
.carrito-vacio .icono { font-size: 3rem; margin-bottom: 10px; }

.carrito-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid #f0f0f0; align-items: flex-start;
}
.carrito-item img { width: 70px; height: 70px; object-fit: cover; border-radius: var(--radio-sm); flex-shrink: 0; }
.carrito-item-info { flex: 1; }
.carrito-item-nombre { font-weight: 700; font-size: .95rem; color: var(--primario); }
.carrito-item-precio { font-size: .85rem; color: var(--gris); margin-bottom: 8px; }

.cantidad-controles { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btn-cantidad {
  width: 30px; height: 30px; border: 1.5px solid var(--primario);
  border-radius: 50%; background: transparent; color: var(--primario);
  font-size: 1rem; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.btn-cantidad:hover { background: var(--primario); color: #fff; }
.cantidad-num { min-width: 30px; text-align: center; font-weight: 700; }

.btn-por-cantidad {
  padding: 4px 10px; font-size: .78rem;
  border: 1px dashed var(--secundario); border-radius: 20px;
  background: transparent; color: var(--secundario);
}
.btn-por-cantidad:hover { background: var(--secundario); color: #fff; }

.input-cantidad-manual {
  display: none; width: 80px; padding: 4px 8px;
  border: 1px solid var(--primario); border-radius: var(--radio-sm);
  font-size: .9rem;
}
.input-cantidad-manual.visible { display: inline-block; }

.carrito-item-subtotal { font-weight: 700; color: var(--primario); font-size: .9rem; margin-top: 4px; }
.btn-eliminar-item { background: none; border: none; color: var(--rojo); font-size: 1.1rem; padding: 4px; }

.carrito-footer { padding-top: 16px; }
.carrito-total-linea { display: flex; justify-content: space-between; font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }

/* ============================================================
   CHECKOUT
   ============================================================ */
.checkout-wrap {
  display: grid; gap: 24px;
  padding: 24px 16px; max-width: 900px; margin: 0 auto;
}
.checkout-caja { background: var(--blanco); border-radius: var(--radio); padding: 24px; box-shadow: var(--sombra); }
.checkout-caja h2 { font-size: 1.2rem; color: var(--primario); margin-bottom: 18px; padding-bottom: 10px; border-bottom: 2px solid var(--acento); }
.resumen-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: .95rem; }
.resumen-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 1.1rem; padding-top: 12px; color: var(--primario); }

/* ============================================================
   MODAL GRACIAS
   ============================================================ */
.modal-gracias-caja {
  background: var(--blanco); border-radius: var(--radio);
  padding: 40px 24px; text-align: center; max-width: 420px; width: 100%;
  box-shadow: var(--sombra-lg); animation: slideDown .3s ease;
}
.modal-gracias-caja .emoji-grande { font-size: 4rem; margin-bottom: 12px; }
.modal-gracias-caja h2 { color: var(--primario); margin-bottom: 8px; }
.modal-gracias-caja p  { color: var(--gris); margin-bottom: 20px; }
.modal-gracias-caja .barra-tiempo {
  height: 4px; background: #eee; border-radius: 2px; overflow: hidden;
}
.modal-gracias-caja .barra-tiempo-fill {
  height: 100%; background: var(--verde);
  animation: cerrar-timer 10s linear forwards;
}
@keyframes cerrar-timer { from { width: 100%; } to { width: 0%; } }

/* ============================================================
   FOOTER
   ============================================================ */
.footer { background: var(--primario); color: rgba(255,255,255,.9); margin-top: 40px; }
.footer-widgets { display: grid; gap: 24px; padding: 32px 16px; }
.footer-widget h4 { color: var(--acento); margin-bottom: 10px; font-size: 1rem; }
.footer-widget p, .footer-widget a { font-size: .88rem; color: rgba(255,255,255,.8); line-height: 1.8; }
.footer-widget a:hover { color: var(--acento); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.15); padding: 14px 16px; text-align: center; font-size: .82rem; color: rgba(255,255,255,.6); }

/* ============================================================
   LOGIN
   ============================================================ */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primario), var(--secundario)); }
.login-caja { background: var(--blanco); border-radius: var(--radio); padding: 40px 32px; width: 100%; max-width: 380px; box-shadow: var(--sombra-lg); }
.login-caja .login-icono { font-size: 3rem; text-align: center; margin-bottom: 8px; }
.login-caja h2 { text-align: center; color: var(--primario); margin-bottom: 4px; }
.login-caja .login-sub { text-align: center; color: var(--gris); font-size: .88rem; margin-bottom: 24px; }
.login-caja .login-pista { margin-top: 16px; padding: 10px 14px; background: #f5f5f5; border-radius: var(--radio-sm); font-size: .82rem; color: var(--gris); text-align: center; }

/* ============================================================
   ADMIN – HEADER Y NAV
   ============================================================ */
.admin-header { background: var(--primario); color: #fff; padding: 0 16px; }
.admin-header-top { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.admin-logo { font-weight: 700; font-size: 1.1rem; }
.admin-links { display: flex; gap: 12px; font-size: .85rem; }
.admin-links a { color: rgba(255,255,255,.8); }
.admin-links a:hover { color: #fff; }

.admin-nav { display: flex; gap: 4px; padding: 0 0 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.admin-nav a {
  white-space: nowrap; padding: 10px 16px; font-size: .88rem; font-weight: 600;
  color: rgba(255,255,255,.75); border-bottom: 3px solid transparent;
  transition: all var(--transicion);
}
.admin-nav a:hover, .admin-nav a.activo { color: #fff; border-bottom-color: var(--acento); }

.admin-main { padding: 24px 16px; }
.admin-seccion { background: var(--blanco); border-radius: var(--radio); padding: 22px; box-shadow: var(--sombra); margin-bottom: 24px; }
.admin-seccion h2 { font-size: 1.1rem; color: var(--primario); margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--acento); display: flex; align-items: center; gap: 8px; }
.admin-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.admin-toolbar input[type=text] { flex: 1; min-width: 160px; padding: 8px 12px; border: 1px solid #ddd; border-radius: var(--radio-sm); }

/* ============================================================
   TABLAS ADMIN
   ============================================================ */
.tabla-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead th {
  background: var(--fondo); color: var(--primario);
  padding: 10px 12px; text-align: left; white-space: nowrap;
  border-bottom: 2px solid var(--acento);
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { background: #ffe8d0; }
tbody tr { border-bottom: 1px solid #f0f0f0; }
tbody tr:hover { background: #fffaf5; }
tbody td { padding: 10px 12px; vertical-align: middle; }
.img-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: var(--radio-sm); }

/* Columnas personalizables */
.col-toggle-wrap { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; background: #fafafa; padding: 10px 14px; border-radius: var(--radio-sm); }
.col-toggle-wrap label { font-size: .82rem; display: flex; align-items: center; gap: 4px; cursor: pointer; }

/* ============================================================
   CALENDARIO
   ============================================================ */
.cal-controles { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.cal-controles h3 { font-size: 1.15rem; color: var(--primario); font-weight: 700; }
.cal-nav-btns { display: flex; gap: 6px; }
.cal-nav-btns button { padding: 6px 12px; border: 1px solid var(--primario); border-radius: var(--radio-sm); background: transparent; color: var(--primario); font-weight: 600; }
.cal-nav-btns button:hover { background: var(--primario); color: #fff; }
.cal-select { display: flex; gap: 8px; }
.cal-select select { padding: 6px 10px; border: 1px solid #ddd; border-radius: var(--radio-sm); }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dia-head { text-align: center; font-size: .78rem; font-weight: 700; color: var(--gris); padding: 6px 0; }
.cal-dia {
  min-height: 52px; padding: 4px; border: 1px solid #eee;
  border-radius: var(--radio-sm); cursor: pointer; position: relative;
  transition: background var(--transicion);
}
.cal-dia:hover { background: #ffe8d0; border-color: var(--acento); }
.cal-dia.vacio { background: transparent; border: none; cursor: default; }
.cal-dia.hoy { border-color: var(--primario); }
.cal-dia.seleccionado { background: var(--primario) !important; color: #fff; }
.cal-dia.tiene-pedido { background: #fff3e0; border-color: var(--secundario); }
.cal-dia-num { font-size: .88rem; font-weight: 600; }
.cal-punto { width: 6px; height: 6px; background: var(--secundario); border-radius: 50%; position: absolute; bottom: 4px; right: 4px; }
.cal-dia.seleccionado .cal-punto { background: var(--acento); }

/* Semana clicable */
.cal-semana-fila { display: contents; }
.cal-semana-num { display: flex; align-items: center; justify-content: center; font-size: .72rem; color: var(--gris); cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.cal-semana-num:hover { background: var(--fondo); color: var(--primario); font-weight: 700; }

/* Grid semanas: 8 col (semana + 7 días) */
.cal-grid-semanas { display: grid; grid-template-columns: 28px repeat(7, 1fr); gap: 4px; }
.cal-grid-semanas .cal-dia-head-sem { /* encabezado semana vacío */ display: flex; align-items: center; justify-content: center; font-size: .65rem; color: var(--gris); }

/* Barra de progreso entregas */
.barra-progreso-wrap { margin: 12px 0; }
.barra-progreso-etiqueta { display: flex; justify-content: space-between; font-size: .82rem; color: var(--gris); margin-bottom: 4px; }
.barra-progreso-fondo { height: 10px; background: #eee; border-radius: 5px; overflow: hidden; }
.barra-progreso-fill { height: 100%; background: var(--verde); border-radius: 5px; transition: width .4s ease; }

/* Lista detallada pedidos/entregas */
.lista-detallada-titulo { font-size: 1.1rem; font-weight: 700; color: var(--primario); margin: 20px 0 10px; }

/* Estado badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 700; }
.badge-pendiente { background: #fff3e0; color: #e65100; }
.badge-entregado { background: #e8f5e9; color: #2e7d32; }

/* Barra vista entregas */
.vista-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.vista-tab { padding: 8px 18px; border: 2px solid var(--primario); border-radius: 20px; background: transparent; color: var(--primario); font-weight: 600; font-size: .88rem; }
.vista-tab.activo { background: var(--primario); color: #fff; }

/* ============================================================
   RESPONSIVE – TABLET (≥ 640px)
   ============================================================ */
@media (min-width: 640px) {
  .container { padding: 0 24px; }
  .seccion { padding: 32px 24px; }
  .slider-mitad { height: 240px; }
  .productos-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 0; }
  .productos-grid .producto-img-wrap img { height: 180px; }
  .filtros-grid { grid-template-columns: 1fr 1fr; }
  .checkout-wrap { grid-template-columns: 1fr 1fr; }
  .footer-widgets { grid-template-columns: repeat(3, 1fr); padding: 32px 24px; }
  .admin-main { padding: 28px 24px; }
  .slider-doble-wrap { padding: 20px 24px 0; }
}

/* ============================================================
   RESPONSIVE – ESCRITORIO (≥ 1024px)
   ============================================================ */
@media (min-width: 1024px) {
  .container { padding: 0 32px; }
  .logo-texto { font-size: 1.5rem; }
  .slider-mitad { height: 340px; }
  .slider-titulo { font-size: 1.3rem; }

  /* 4 columnas en escritorio */
  .productos-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 0 32px;
  }
  .seccion { padding: 40px 32px; }
  .slider-doble-wrap { padding: 24px 32px 0; }

  .filtros-grid { grid-template-columns: repeat(3, 1fr); align-items: end; }

  .admin-nav a { padding: 12px 20px; font-size: .9rem; }
  .admin-main { padding: 32px; }
  .form-grid-2 { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   UTILIDADES
   ============================================================ */
.oculto { display: none !important; }
.text-center { text-align: center; }
.text-gris { color: var(--gris); }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex  { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }

/* ============================================================
   ADMIN MOBILE – diseño ajustado para teléfono
   ============================================================ */

/* Header admin compacto en móvil */
@media (max-width: 639px) {
  .admin-header-top {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    padding: 10px 16px 6px;
    gap: 4px;
  }
  .admin-logo { font-size: 1rem; }
  .admin-links { font-size: .8rem; gap: 10px; }
  .admin-links a { color: rgba(255,255,255,.85); }

  /* Nav scrollable horizontal sin texto partido */
  .admin-nav {
    gap: 0;
    padding-bottom: 0;
    border-bottom: none;
  }
  .admin-nav a {
    padding: 9px 13px;
    font-size: .8rem;
    border-bottom-width: 3px;
  }

  /* Secciones admin sin padding excesivo */
  .admin-seccion {
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 14px;
  }
  .admin-seccion h2 { font-size: 1rem; margin-bottom: 12px; }

  /* Toolbar apilado en columna */
  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-toolbar input[type=text],
  .admin-toolbar button { width: 100%; }

  /* Tablas: scroll horizontal visible */
  .tabla-wrap { -webkit-overflow-scrolling: touch; }
  table { font-size: .8rem; }
  thead th, tbody td { padding: 8px 8px; }
  .img-thumb { width: 40px; height: 40px; }

  /* Grid formularios 1 col en móvil */
  .form-grid-2 { grid-template-columns: 1fr; }

  /* Calendarios más compactos */
  .cal-controles { flex-direction: column; align-items: stretch; gap: 8px; }
  .cal-controles h3 { text-align: center; font-size: 1rem; }
  .cal-nav-btns { justify-content: center; flex-wrap: wrap; }
  .cal-nav-btns button { font-size: .78rem; padding: 5px 9px; }
  .cal-select { justify-content: center; }
  .cal-dia { min-height: 38px; padding: 2px; }
  .cal-dia-num { font-size: .78rem; }
  .cal-dia-head { font-size: .7rem; padding: 4px 0; }
  .cal-semana-num { font-size: .65rem; width: 22px; }
  .cal-grid-semanas { grid-template-columns: 22px repeat(7,1fr); gap: 2px; }

  /* Modal full-width en móvil */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-caja {
    max-width: 100% !important;
    width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
  }

  /* Col-toggle checkboxes apilados */
  .col-toggle-wrap { gap: 6px; padding: 8px 10px; }
  .col-toggle-wrap label { font-size: .78rem; }

  /* Vista tabs en móvil */
  .vista-tabs { gap: 6px; }
  .vista-tab { padding: 7px 14px; font-size: .82rem; }

  /* Admin main padding mínimo */
  .admin-main { padding: 10px 8px; }
}

/* ============================================================
   CHECKBOXES ELEGANTES (col-toggle)
   Reemplaza los checkboxes normales con toggle switches
   ============================================================ */

/* Contenedor col-toggle mejorado */
.col-toggle-wrap {
  background: linear-gradient(135deg, #fdf5ec, #fff8f2);
  border: 1px solid #eddbc7;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

/* Ocultar el checkbox nativo */
.col-toggle-wrap input[type=checkbox] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Label como pill toggle */
.col-toggle-wrap label {
  display: inline-flex;
  align-items: center;
  gap: 0;
  cursor: pointer;
  user-select: none;
  font-size: .82rem;
  font-weight: 600;
  padding: 5px 12px 5px 36px;
  border-radius: 20px;
  border: 1.5px solid var(--primario);
  color: var(--primario);
  background: white;
  position: relative;
  transition: all .2s ease;
  line-height: 1.4;
}

/* Círculo del switch (parte izquierda) */
.col-toggle-wrap label::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primario);
  transition: all .2s ease;
}

/* Tick cuando está activo */
.col-toggle-wrap label::after {
  content: '✓';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  color: white;
  font-weight: 900;
  transition: all .2s ease;
}

/* Estado ACTIVO (checked) */
.col-toggle-wrap input[type=checkbox]:checked + label,
.col-toggle-wrap label:has(input[type=checkbox]:checked) {
  background: var(--primario);
  color: white;
  border-color: var(--primario);
}
.col-toggle-wrap input[type=checkbox]:checked + label::before {
  background: rgba(255,255,255,.3);
}
.col-toggle-wrap label:has(input[type=checkbox]:checked)::before {
  background: rgba(255,255,255,.3);
}

/* Estado INACTIVO (unchecked) — tachado visual */
.col-toggle-wrap input[type=checkbox]:not(:checked) + label,
.col-toggle-wrap label:has(input[type=checkbox]:not(:checked)) {
  background: #f5f5f5;
  color: #aaa;
  border-color: #ddd;
  text-decoration: line-through;
  text-decoration-color: #bbb;
}
.col-toggle-wrap input[type=checkbox]:not(:checked) + label::before {
  background: #ccc;
}
.col-toggle-wrap label:has(input[type=checkbox]:not(:checked))::before {
  background: #ccc;
}
.col-toggle-wrap input[type=checkbox]:not(:checked) + label::after,
.col-toggle-wrap label:has(input[type=checkbox]:not(:checked))::after {
  content: '✕';
  color: #aaa;
}

/* Hover en ambos estados */
.col-toggle-wrap label:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(139,69,19,.15);
}

/* ── Fallback para navegadores sin :has() ───────────────────── */
/* El JS en admin.js gestiona las clases activo/inactivo */
.col-toggle-wrap label.toggle-activo {
  background: var(--primario) !important;
  color: white !important;
  border-color: var(--primario) !important;
  text-decoration: none !important;
}
.col-toggle-wrap label.toggle-activo::before { background: rgba(255,255,255,.3) !important; }
.col-toggle-wrap label.toggle-activo::after  { content: '✓' !important; color: white !important; }

.col-toggle-wrap label.toggle-inactivo {
  background: #f5f5f5 !important;
  color: #aaa !important;
  border-color: #ddd !important;
  text-decoration: line-through !important;
  text-decoration-color: #bbb !important;
}
.col-toggle-wrap label.toggle-inactivo::before { background: #ccc !important; }
.col-toggle-wrap label.toggle-inactivo::after  { content: '✕' !important; color: #aaa !important; }
