/* PedidosWeb - Diseño moderno y profesional optimizado para conversiones */

:root {
  /* Colores principales */
  /* Marca Antón: verde primario, azul profundo secundario y acento amarillo */
  --color-primary: #1b8f3a;         /* Verde Antón */
  --color-primary-dark: #146c22;    /* Verde oscuro */
  --color-primary-light: #34c759;   /* Verde claro para hovers */
  --color-secondary: #0f172a;       /* Azul profundo para elementos UI */
  --color-secondary-dark: #0b1220;  /* Azul más oscuro */
  --color-accent: #f7c600;          /* Amarillo acento del isologotipo */
  --color-accent-dark: #d6a700;     /* Amarillo oscuro */
  
  /* Colores de superficie */
  --color-bg: #ffffff;
  --color-surface: #f8fafc;
  --color-card: #ffffff;
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  
  /* Colores de texto */
  --color-text: #1e293b;
  --color-text-light: #64748b;
  --color-text-muted: #94a3b8;

  /* Colores semánticos (estados y alertas) para tema claro */
  --state-pending-bg: #fff7ed;
  --state-pending-border: #fdba74;
  --state-pending-text: #c2410c;

  --state-sent-bg: #ecfeff;
  --state-sent-border: #67e8f9;
  --state-sent-text: #0e7490;

  --state-read-bg: #f1f5f9;
  --state-read-border: #e2e8f0;
  --state-read-text: #64748b;

  --priority-high-bg: #fee2e2;
  --priority-high-border: #fca5a5;
  --priority-high-text: #b91c1c;

  --priority-medium-bg: #fff7ed;
  --priority-medium-border: #fdba74;
  --priority-medium-text: #c2410c;

  --priority-low-bg: #f0fdf4;
  --priority-low-border: #86efac;
  --priority-low-text: #166534;

  --alert-success-bg: #e9f7ef;
  --alert-success-border: #c8e6c9;
  --alert-success-text: #216c3d;

  --alert-info-bg: #eef5ff;
  --alert-info-border: #cfe2ff;
  --alert-info-text: #1e5fbf;

  /* Errores */
  --alert-error-bg: #fee2e2;
  --alert-error-border: #ef4444;
  --alert-error-text: #991b1b;
  
  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* Efectos */
  --ring: 0 0 0 3px rgba(27, 143, 58, 0.15);
  --transition: all 0.3s ease; /* transición de 300ms solicitada */

  /* Colores semánticos para botones (claro) */
  --color-success: #22c55e;        /* verde éxito */
  --color-success-dark: #15803d;
  --color-danger: #dc2626;         /* rojo peligro */
  --color-danger-dark: #b91c1c;
  --color-warning: #f59e0b;        /* ámbar advertencia */
  --color-warning-dark: #b45309;
  --color-info: #2563eb;           /* azul informativo */
  --color-info-dark: #1e40af;
}

/* Fallback sin JS: sólo aplica esquema del sistema cuando NO hay data-theme explícito */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0b1220;
    --color-surface: #0f172a;
    --color-card: #111827;
    --color-border: #1f2937;
    --color-border-light: #243244;
    --color-text: #e5e7eb;
    --color-text-light: #cbd5e1;
    --color-text-muted: #94a3b8;
    --ring: 0 0 0 3px rgba(27, 143, 58, 0.25);
  }
}

/* Tema oscuro: overrides de variables para modo dark */
:root[data-theme="dark"] {
  /* Colores principales (marca permanece igual) */
  --color-primary: #1b8f3a;
  --color-primary-dark: #146c22;
  --color-primary-light: #34c759;
  --color-secondary: #0f172a;
  --color-secondary-dark: #0b1220;
  --color-accent: #f7c600;
  --color-accent-dark: #d6a700;

  /* Superficies y texto en oscuro */
  --color-bg: #0b1220;
  --color-surface: #0f172a;
  --color-card: #111827;
  --color-border: #1f2937;
  --color-border-light: #243244;

  --color-text: #e5e7eb;
  --color-text-light: #cbd5e1;
  --color-text-muted: #94a3b8;

  --ring: 0 0 0 3px rgba(27, 143, 58, 0.25);

  /* Overrides semánticos para tema oscuro (más contraste y menos luminosidad) */
  --state-pending-bg: rgba(253, 186, 116, 0.12);
  --state-pending-border: #fdba74;
  --state-pending-text: #fdba74;

  --state-sent-bg: rgba(103, 232, 249, 0.12);
  --state-sent-border: #67e8f9;
  --state-sent-text: #67e8f9;

  --state-read-bg: rgba(226, 232, 240, 0.08);
  --state-read-border: #334155;
  --state-read-text: #cbd5e1;

  --priority-high-bg: rgba(244, 63, 94, 0.12);
  --priority-high-border: #f87171;
  --priority-high-text: #fecaca;

  --priority-medium-bg: rgba(253, 186, 116, 0.12);
  --priority-medium-border: #fdba74;
  --priority-medium-text: #fde68a;

  --priority-low-bg: rgba(134, 239, 172, 0.12);
  --priority-low-border: #86efac;
  --priority-low-text: #86efac;

  --alert-success-bg: rgba(34, 197, 94, 0.12);
  --alert-success-border: #22c55e;
  --alert-success-text: #a7f3d0;

  --alert-info-bg: rgba(59, 130, 246, 0.12);
  --alert-info-border: #60a5fa;
  --alert-info-text: #bfdbfe;

  /* Errores en modo oscuro con buen contraste */
  --alert-error-bg: rgba(244, 63, 94, 0.12);
  --alert-error-border: #f87171;
  --alert-error-text: #fecaca;

  /* Semánticos de botón en modo oscuro */
  --color-success: #22c55e;
  --color-success-dark: #16a34a;
  --color-danger: #ef4444;
  --color-danger-dark: #dc2626;
  --color-warning: #f59e0b;
  --color-warning-dark: #d97706;
  --color-info: #3b82f6;
  --color-info-dark: #2563eb;
}

/* Reset y base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  font-size: 16px;
  transition: background-color .3s ease, color .3s ease;
}

/* Transiciones suaves de tema para elementos principales */
header.header, .card, nav.primary-nav, .dropdown-menu, .mobile-overlay, .hero, footer, .table, .badge, .btn, input, select, textarea {
  transition: background-color .3s ease, color .3s ease, border-color .3s ease, box-shadow .3s ease;
}

/* Accesibilidad: enfoque visible en elementos interactivos */
a:focus-visible, button:focus-visible, .menu-toggle:focus-visible, .theme-toggle:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--ring);
}

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

.section { padding: 40px 0; }

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Grid system */
.grid { 
  display: grid; 
  gap: 24px; 
}

.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1024px) { 
  .grid.cols-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) { 
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .section { padding: 24px 0; }
}

@media (max-width: 640px) { 
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
}

/* Cart benefits: 4-column responsive grid con estilo y accesibilidad */
.cart-benefits {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.cart-benefits > * { /* Aplana wrappers como div/ul/section para que sus hijos sean items de la grilla */
  display: contents;
}
.cart-benefits .card { /* Si el HTML dinámico usa .card para cada beneficio, aplícale el estilo */
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
  transition: var(--transition);
}
.cart-benefits .benefit-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
  transition: var(--transition);
}
.cart-benefits .benefit-card:hover, .cart-benefits .card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.cart-benefits .benefit-card:focus-within, .cart-benefits .card:focus-within { box-shadow: var(--ring); }
.cart-benefits .benefit-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--color-surface);
  display: inline-flex; align-items: center; justify-content: center;
}
.cart-benefits .benefit-card.has-icon::before,
.cart-benefits .card.has-icon::before { content: none; }
.cart-benefits .benefit-svg { width: 24px; height: 24px; display: block; }
.cart-benefits .benefit-icon.is-primary { color: var(--color-primary); }
.cart-benefits .benefit-icon.is-secondary { color: var(--color-secondary); }
.cart-benefits .benefit-icon.is-accent { color: var(--color-accent); }
.cart-benefits .benefit-icon.is-info { color: var(--color-info); }
@media (max-width: 1024px) { .cart-benefits { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .cart-benefits { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .cart-benefits { grid-template-columns: 1fr; } }

/* Iconos por CSS para HTML dinámico (lock, truck, shield, headset) */
.cart-benefits .benefit-card::before,
.cart-benefits .card::before {
  content: "";
  flex: 0 0 auto;
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--color-surface);
  display: inline-block;
  margin-right: 12px;
  /* usa máscara SVG para pintar con currentColor */
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: 24px 24px; mask-size: 24px 24px;
  background-color: currentColor;
}

/* Variantes por posición: color e icono */
.cart-benefits > .benefit-card:nth-child(1),
.cart-benefits > *:nth-child(1) .card { color: var(--color-primary); }
.cart-benefits > .benefit-card:nth-child(1)::before,
.cart-benefits > *:nth-child(1) .card::before { -webkit-mask-image: url('../img/icons/lock.svg'); mask-image: url('../img/icons/lock.svg'); }

.cart-benefits > .benefit-card:nth-child(2),
.cart-benefits > *:nth-child(2) .card { color: var(--color-accent); }
.cart-benefits > .benefit-card:nth-child(2)::before,
.cart-benefits > *:nth-child(2) .card::before { -webkit-mask-image: url('../img/icons/bolt.svg'); mask-image: url('../img/icons/bolt.svg'); }

.cart-benefits > .benefit-card:nth-child(3),
.cart-benefits > *:nth-child(3) .card { color: var(--color-secondary); }
.cart-benefits > .benefit-card:nth-child(3)::before,
.cart-benefits > *:nth-child(3) .card::before { -webkit-mask-image: url('../img/icons/shield-check.svg'); mask-image: url('../img/icons/shield-check.svg'); }

.cart-benefits > .benefit-card:nth-child(4),
.cart-benefits > *:nth-child(4) .card { color: var(--color-info); }
.cart-benefits > .benefit-card:nth-child(4)::before,
.cart-benefits > *:nth-child(4) .card::before { -webkit-mask-image: url('../img/icons/clock.svg'); mask-image: url('../img/icons/clock.svg'); }

/* Tipografía breve dentro de las tarjetas */
.cart-benefits .benefit-card strong,
.cart-benefits .card strong { font-weight: 600; }
.cart-benefits .benefit-card .muted,
.cart-benefits .card .muted { color: var(--text-muted); font-size: 0.9rem; }

/* Fondos temáticos de cada tarjeta */
.cart-benefits .benefit-card.benefit-bg--secure,
.cart-benefits .card.benefit-bg--secure {
  background: color-mix(in srgb, var(--color-primary) 14%, var(--color-card));
  border-color: color-mix(in srgb, var(--color-primary) 50%, var(--color-border));
}
.cart-benefits .benefit-card.benefit-bg--fast,
.cart-benefits .card.benefit-bg--fast {
  background: color-mix(in srgb, var(--color-accent) 14%, var(--color-card));
  border-color: color-mix(in srgb, var(--color-accent) 50%, var(--color-border));
}
.cart-benefits .benefit-card.benefit-bg--warranty,
.cart-benefits .card.benefit-bg--warranty {
  background: color-mix(in srgb, var(--color-secondary) 14%, var(--color-card));
  border-color: color-mix(in srgb, var(--color-secondary) 50%, var(--color-border));
}
.cart-benefits .benefit-card.benefit-bg--support,
.cart-benefits .card.benefit-bg--support {
  background: color-mix(in srgb, var(--color-info) 14%, var(--color-card));
  border-color: color-mix(in srgb, var(--color-info) 50%, var(--color-border));
}

/* Fondos por posición como fallback si no se asignan clases */
.cart-benefits > .benefit-card:nth-child(1),
.cart-benefits > *:nth-child(1) .card {
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-card));
  border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-border));
}
.cart-benefits > .benefit-card:nth-child(2),
.cart-benefits > *:nth-child(2) .card {
  background: color-mix(in srgb, var(--color-accent) 12%, var(--color-card));
  border-color: color-mix(in srgb, var(--color-accent) 45%, var(--color-border));
}
.cart-benefits > .benefit-card:nth-child(3),
.cart-benefits > *:nth-child(3) .card {
  background: color-mix(in srgb, var(--color-secondary) 12%, var(--color-card));
  border-color: color-mix(in srgb, var(--color-secondary) 45%, var(--color-border));
}
.cart-benefits > .benefit-card:nth-child(4),
.cart-benefits > *:nth-child(4) .card {
  background: color-mix(in srgb, var(--color-info) 12%, var(--color-card));
  border-color: color-mix(in srgb, var(--color-info) 45%, var(--color-border));
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .header {
  background: rgba(15, 23, 42, 0.92);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* alinea items al inicio; usaremos auto-margin para empujar acciones a la derecha */
  padding: 16px 0;
  gap: 12px; /* separa brand y nav */
  position: relative; /* ancla popover del menú */
  flex-wrap: nowrap; /* evita saltos inesperados en desktop */
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 20px;
  color: var(--color-primary);
  text-decoration: none;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: 0 0 0 0 rgba(59,130,246,0.6);
  animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(59,130,246,0.6); }
  50% { box-shadow: 0 0 12px 4px rgba(16,185,129,0.35); }
  100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.6); }
}

.nav nav {
  display: flex;
  gap: 8px;
  min-width: 0; /* permite encoger sin desbordar */
  flex: 1 1 auto; /* ocupa espacio restante */
  justify-content: flex-end; /* alinea items a la derecha */
}

.nav a {
  color: var(--color-text);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  transition: var(--transition);
}

.nav a:hover {
  color: var(--color-primary);
  background: var(--color-surface);
}

.nav a.active {
  color: var(--color-primary);
  background: rgba(37, 99, 235, 0.1);
}

/* Dropdown en la navegación */
.nav .dropdown { position: relative; }
.nav .dropdown-toggle {
  color: var(--color-text);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
}
.nav .dropdown-toggle:hover { color: var(--color-primary); background: var(--color-surface); }
.nav .dropdown.open .dropdown-toggle { color: var(--color-primary); background: rgba(37,99,235,.1); }
.nav .dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 220px;
  background: var(--color-card); border: 1px solid var(--color-border); border-radius: 10px;
  box-shadow: var(--shadow-md); padding: 8px; display: none; z-index: 1003;
}
.nav .dropdown.open .dropdown-menu { display: block; }
.nav .dropdown-menu a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--color-text-light); text-decoration: none; }
.nav .dropdown-menu a:hover { color: var(--color-primary); background: var(--color-surface); }

/* Comportamiento del dropdown dentro del drawer móvil */
@media (max-width: 768px) {
  .nav .dropdown { width: 100%; }
  .nav .dropdown-menu { position: static; min-width: 0; box-shadow: none; border: none; padding: 4px 0; }
}

/* Botón hamburguesa visible en todas las resoluciones */
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  border-radius: 8px;
  cursor: pointer;
  color: var(--color-text);
}

/* Toggle de tema con mismo estilo que el menú */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  border-radius: 8px;
  cursor: pointer;
  color: var(--color-text);
}

/* Indicador de carrito (alineado junto al botón Menú) */
.cart-indicator {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  width: auto;
  height: 38px;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  text-decoration: none;
}
.cart-indicator:hover { background: var(--color-surface); box-shadow: var(--shadow-md); }
.cart-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease;
}
.cart-bump { transform: scale(1.12); }

@media (max-width: 768px) {
  .cart-indicator { height: 36px; }
  .cart-count { min-width: 20px; height: 20px; font-size: 11px; }
}

/* Título del hero ubicado en el header (entre carrito y menú) */
.header .header-hero-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--color-text);
  flex: 1 1 auto;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 768px) {
  .header .header-hero-title { display: none; }
}

/* Toast / notificaciones ligeras */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--color-card);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 10px 14px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .22s ease, transform .22s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Variantes profesionales */
.toast.success { border-color: var(--color-success); }
.toast.error { border-color: var(--color-danger); }
.toast.info { border-color: var(--color-primary); }
.toast .icon { flex: 0 0 auto; opacity: .9; }
.toast .content { display: grid; gap: 2px; }
.toast .title { font-weight: 600; }
.toast .message { opacity: .9; }


@media (max-width: 768px) {
  .nav nav { display: none !important; }
  /* Drawer básico para móviles (tablets ajustado más abajo) */
  .nav nav.open { 
    display: block !important; 
    position: fixed; 
    top: 0; 
    left: 0; 
    height: 100vh; 
    width: 80vw; 
    max-width: 320px; 
    background: var(--color-card); 
    padding: 16px; 
    border-right: 1px solid var(--color-border);
    box-shadow: 8px 0 24px rgba(0,0,0,.16);
    overflow-y: auto;
    z-index: 1002;
    animation: drawerIn .18s ease-out;
  }
  .nav nav.open a { display: block; padding: 12px 10px; margin: 4px 0; }
}

/* Desktop: nav oculto por defecto y mostrado como popover al abrir */
@media (min-width: 769px) {
  .nav nav { display: none !important; }
  .nav nav.open {
    display: flex !important;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 10px;
    gap: 6px;
    flex-wrap: wrap;
    max-width: 70vw;
    z-index: 1003;
  }
  .nav nav.open a { white-space: nowrap; }
}

/* Acción de notificaciones siempre visible */
.nav-actions { margin-left: auto; display: inline-flex; align-items: center; }
.notif-link {
  color: var(--color-text-light);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 500;
}
.notif-link:hover { color: var(--color-primary); background: var(--color-surface); }

/* Pulir scroll del nav en desktop/tablet si llegara a activarse */
.nav nav::-webkit-scrollbar { height: 8px; }
.nav nav::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 999px; }
.nav nav::-webkit-scrollbar-track { background: transparent; }

/* Alinear altura de botones dentro del nav para aspecto profesional */
.nav .btn.small { padding: 6px 10px; font-size: 14px; }

/* Overlay de móvil y tablet (<=768px) */
@media (max-width: 768px) {
  /* El overlay debe quedar por debajo del header/nav para no bloquearlo */
  .mobile-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 900; }
  .nav nav.open { z-index: 1100; }
}

/* Eliminamos excepción de tablet: el botón hamburguesa se mantiene visible siempre */

/* Animación del drawer */
@keyframes drawerIn {
  from { transform: translateX(-100%); opacity: 0.01; }
  to { transform: translateX(0); opacity: 1; }
}

/* Hero section */
.hero {
  padding: 60px 0; /* menos padding para dejar espacio inferior a acciones */
  min-height: 420px; /* mayor altura para apreciar imágenes completas */
  text-align: center;
  background: linear-gradient(135deg, var(--color-surface) 0%, rgba(27, 143, 58, 0.08) 50%, rgba(247, 198, 0, 0.08) 100%);
}

/* Hero con foto y overlay de marca */
.hero.with-photo {
  position: relative;
  background-color: var(--color-surface);
  background-size: cover;
  background-position: center;
}
.hero.with-photo .hero-bg,
.hero.with-photo .hero-bg.next {
  position: absolute;
  inset: 0;
  background-size: contain; /* mostrar imagen completa sin recortes */
  background-position: center;
  background-repeat: no-repeat;
  will-change: opacity;
  transition: opacity .6s ease;
  opacity: 1;
}
.hero.with-photo .hero-bg.next { opacity: 0; }
.hero.with-photo .hero-bg,
.hero.with-photo .hero-bg.next { z-index: 0; }
.hero.with-photo .hero-bg.next { background-size: contain; }
.hero.with-photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(27,143,58,.30), rgba(247,198,0,.20));
  pointer-events: none;
}
.hero.with-photo .container {
  position: static;
  z-index: auto;
}
.hero.with-photo h1 { text-shadow: 0 2px 8px rgba(0,0,0,.18); }
.hero.with-photo p { text-shadow: 0 1px 4px rgba(0,0,0,.14); }

/* En modo oscuro, reforzar contraste del overlay del hero */
[data-theme="dark"] .hero.with-photo::before {
  background: linear-gradient(135deg, rgba(15,23,42,.45), rgba(15,23,42,.32));
}

/* En modo oscuro, los botones fantasma dentro del hero deben tener fondo sutil */
[data-theme="dark"] .hero .btn.ghost {
  background: rgba(15,23,42,.35);
  border-color: #334155; /* slate-700 aprox */
  color: var(--color-text);
  backdrop-filter: blur(2px);
}
[data-theme="dark"] .hero .btn.ghost:hover {
  background: rgba(30,41,59,.45);
}

/* Ajustes responsivos para mostrar imágenes completas en móviles */
@media (max-width: 768px) {
  .hero {
    padding: 28px 0;
    min-height: 320px;
  }
  .hero.with-photo .hero-bg,
  .hero.with-photo .hero-bg.next {
    background-size: contain; /* mostrar la imagen completa */
    background-position: center center;
  }
}

@media (max-width: 480px) {
  .product-image { height: 180px; }
  .product-gallery .main-image { height: 280px; }
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--color-text);
}

.hero p {
  color: var(--color-text-light);
  margin: 0 auto 32px;
  max-width: 600px;
  font-size: 18px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
/* Anclar acciones al pie del banner para no cubrir contenido */
.hero.with-photo .hero-actions { position: static; transform: none; left: auto; bottom: auto; padding: 0; }
@media (max-width: 768px) {
  .hero { min-height: 360px; }
  .hero-actions { gap: 12px; }
}

/* Wrapper bajo el banner para ubicar las acciones entre banner y grilla */
.hero-actions-wrapper { margin-top: -8px; margin-bottom: 16px; }

/* Tinte de marca para imágenes (uso opcional) */
.brand-tint {
  filter: saturate(1.06) contrast(1.06) hue-rotate(4deg);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px 24px;
  cursor: pointer;
  text-decoration: none;
  color: var(--color-text);
  background: var(--color-card);
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

/* Alias Bootstrap */
.btn.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: white; }
.btn.btn-secondary { background: var(--color-secondary); border-color: var(--color-secondary); color: white; }
.btn.btn-success { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.btn.btn-danger { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.btn.btn-warning { background: var(--color-warning); border-color: var(--color-warning); color: #111827; }
.btn.btn-info { background: var(--color-info); border-color: var(--color-info); color: #fff; }
.btn.btn-outline-primary { background: transparent; border-color: var(--color-primary); color: var(--color-primary); }
.btn.btn-outline-secondary { background: transparent; border-color: var(--color-secondary); color: var(--color-secondary); }
.btn.btn-outline-success { background: transparent; border-color: var(--color-success); color: var(--color-success); }
.btn.btn-outline-danger { background: transparent; border-color: var(--color-danger); color: var(--color-danger); }
.btn.btn-outline-warning { background: transparent; border-color: var(--color-warning); color: var(--color-warning); }
.btn.btn-outline-info { background: transparent; border-color: var(--color-info); color: var(--color-info); }
.btn.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn.btn-lg { padding: 16px 32px; font-size: 16px; }

/* Botones solo con icono (compactos y uniformes) */
.btn.icon {
  padding: 8px;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  gap: 0;
}
.btn.btn-sm.icon {
  padding: 6px;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
}
.btn.icon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}
.btn.btn-sm.icon svg { width: 16px; height: 16px; }

/* Texto solo para lectores de pantalla */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.btn.primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.btn.secondary {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: white;
}

.btn.secondary:hover {
  background: var(--color-secondary-dark);
  border-color: var(--color-secondary-dark);
}

/* Variantes semánticas adicionales */
.btn.success, .btn.btn-success {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}
.btn.success:hover, .btn.btn-success:hover {
  background: var(--color-success-dark);
  border-color: var(--color-success-dark);
}

.btn.danger, .btn.btn-danger {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
}
.btn.danger:hover, .btn.btn-danger:hover {
  background: var(--color-danger-dark);
  border-color: var(--color-danger-dark);
}

.btn.warning, .btn.btn-warning {
  background: var(--color-warning);
  border-color: var(--color-warning);
  color: #111827; /* mejor contraste sobre ámbar */
}
.btn.warning:hover, .btn.btn-warning:hover {
  background: var(--color-warning-dark);
  border-color: var(--color-warning-dark);
}

.btn.info, .btn.btn-info {
  background: var(--color-info);
  border-color: var(--color-info);
  color: #fff;
}
.btn.info:hover, .btn.btn-info:hover {
  background: var(--color-info-dark);
  border-color: var(--color-info-dark);
}

/* Variantes outline (bordes coloreados, fondo transparente) */
.btn.outline-primary, .btn.btn-outline-primary { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn.outline-secondary, .btn.btn-outline-secondary { background: transparent; color: var(--color-secondary); border-color: var(--color-secondary); }
.btn.outline-success, .btn.btn-outline-success { background: transparent; color: var(--color-success); border-color: var(--color-success); }
.btn.outline-danger, .btn.btn-outline-danger { background: transparent; color: var(--color-danger); border-color: var(--color-danger); }
.btn.outline-warning, .btn.btn-outline-warning { background: transparent; color: var(--color-warning); border-color: var(--color-warning); }
.btn.outline-info, .btn.btn-outline-info { background: transparent; color: var(--color-info); border-color: var(--color-info); }

.btn.outline-primary:hover, .btn.btn-outline-primary:hover { background: rgba(27, 143, 58, 0.10); }
.btn.outline-secondary:hover, .btn.btn-outline-secondary:hover { background: rgba(15, 23, 42, 0.10); }
.btn.outline-success:hover, .btn.btn-outline-success:hover { background: rgba(34, 197, 94, 0.10); }
.btn.outline-danger:hover, .btn.btn-outline-danger:hover { background: rgba(220, 38, 38, 0.10); }
.btn.outline-warning:hover, .btn.btn-outline-warning:hover { background: rgba(245, 158, 11, 0.12); }
.btn.outline-info:hover, .btn.btn-outline-info:hover { background: rgba(37, 99, 235, 0.12); }

.btn.ghost {
  background: transparent;
  border-color: var(--color-border);
}

.btn.ghost:hover {
  background: var(--color-surface);
}

.btn.large {
  padding: 16px 32px;
  font-size: 16px;
}
.btn.small {
  padding: 8px 14px;
  font-size: 13px;
}

/* Estados activos y deshabilitados accesibles */
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); filter: brightness(0.98); }
.btn[disabled], .btn.disabled { opacity: 0.6; cursor: not-allowed; pointer-events: none; }
.btn[disabled]:hover, .btn.disabled:hover { transform: none; box-shadow: var(--shadow-sm); }

/* Banners informativos / conversión */
.conversion-banner {
  background: linear-gradient(90deg, rgba(37,99,235,.08), rgba(16,185,129,.08));
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.banner-content {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.banner-icon {
  font-size: 20px;
}

.banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--color-text);
}

.banner-text strong {
  font-weight: 700;
}

.banner-text span {
  color: var(--color-text-light);
  font-size: 14px;
}

.banner-cta .btn.small {
  padding: 8px 14px;
  font-size: 13px;
}

.banner-cta .remaining {
  color: var(--color-text-light);
  font-size: 13px;
}

.banner-success { color: var(--color-text); font-weight: 600; }

@media (max-width: 640px) {
  .banner-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* Trust badges debajo del hero */
.trust-badges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: -24px 0 24px; /* se acerca al hero */
}

.trust-badges .badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.trust-badges .badge-icon {
  font-size: 20px;
}

.trust-badges .badge-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.trust-badges .badge-text strong {
  font-size: 14px;
}

.trust-badges .badge-text span {
  font-size: 13px;
  color: var(--color-text-light);
}

@media (max-width: 768px) {
  .trust-badges {
    grid-template-columns: 1fr;
  }
}

/* CTA dual en catálogo */
.cta-dual {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .cta-dual .btn.large {
    width: 100%;
  }
}

.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.disabled:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-text);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 16px;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

.muted { color: var(--color-text-muted); }
.price { 
  color: var(--color-primary); 
  font-weight: 700; 
  font-size: 1.25rem;
}

/* Product cards */
.product {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-radius: 12px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  transition: var(--transition);
}

.product:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.product-image {
  position: relative;
  width: 100%;
  height: 240px;
  overflow: hidden;
  background: var(--color-surface);
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: var(--transition);
}

.product:hover .product-image img {
  transform: scale(1.05);
}

.product-image .no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-muted);
  font-size: 14px;
}
.product-image .no-image img {
  width: 56px;
  height: 56px;
  margin-right: 8px;
  opacity: 0.85;
}

.product-content {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product .title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--color-text);
}

.product .description {
  color: var(--color-text-light);
  font-size: 14px;
  margin-bottom: 12px;
  flex: 1;
}

.product .price {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 16px;
}

.product .actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: auto;
}

.product input[type=number] {
  width: 70px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 14px;
}

/* Product detail page */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}

@media (max-width: 768px) {
  .product-detail {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

.product-gallery .main-image {
  width: 100%;
  height: 400px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-surface);
  margin-bottom: 16px;
}

.product-gallery .main-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.thumbnail-gallery {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.thumbnail {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.thumbnail:hover,
.thumbnail.active {
  border-color: var(--color-primary);
}

.no-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 400px;
  background: var(--color-surface);
  border-radius: 12px;
  color: var(--color-text-muted);
}

.product-info h1 {
  font-size: 2rem;
  margin-bottom: 16px;
}

.product-info .description {
  color: var(--color-text-light);
  margin-bottom: 24px;
  font-size: 16px;
}

.price-section {
  margin-bottom: 32px;
  padding: 20px;
  background: var(--color-surface);
  border-radius: 12px;
}

.price-section .price {
  display: block;
  font-size: 2rem;
  margin-bottom: 8px;
}

.stock-info {
  color: var(--color-secondary);
  font-weight: 500;
}

.stock-info.out-of-stock {
  color: #ef4444;
}

.add-to-cart-form {
  margin-bottom: 24px;
}

.quantity-selector {
  margin-bottom: 16px;
}

.quantity-selector label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.quantity-selector input {
  width: 100px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 16px;
}

.product-actions {
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

/* Forms */
label {
  display: block;
  margin: 0 0 8px;
  font-weight: 500;
  color: var(--color-text);
}

input[type=text],
input[type=email],
input[type=number],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-text);
  font-size: 14px;
  transition: var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--ring);
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table th,
.table td {
  border-bottom: 1px solid var(--color-border);
  padding: 16px;
  text-align: left;
}

.table th {
  background: var(--color-surface);
  font-weight: 600;
  color: var(--color-text);
}

.table .right {
  text-align: right;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
}

/* Footer */
.footer {
  padding: 48px 0 32px;
  color: var(--color-text-light);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
  text-align: left;
  margin-bottom: 24px;
}

.footer-section h4 {
  color: var(--color-text);
  font-size: 1rem;
  margin-bottom: 12px;
}

.footer-section p {
  color: var(--color-text-light);
  margin: 0 0 10px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li { margin: 6px 0; }

.footer-links a {
  color: var(--color-text);
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover { color: var(--color-primary); }

.contact-info p {
  margin: 6px 0;
  color: var(--color-text);
}

.benefits-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.benefits-list li {
  position: relative;
  padding-left: 24px;
  margin: 8px 0;
  color: var(--color-text);
}

.benefits-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--color-secondary);
  font-weight: 700;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
  color: var(--color-text-muted);
}

.footer-trust { display: flex; gap: 8px; flex-wrap: wrap; }

.trust-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 12px;
}

@media (max-width: 992px) {
  .footer-content { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .footer-content { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--color-border);
}

/* Pager */
.pager {
  display: flex;
  justify-content: center;
  padding: 32px 0;
}

.pager a {
  padding: 8px 16px;
  margin: 0 4px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--color-text);
  transition: var(--transition);
}

.pager a:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* Mejoras para navegación del pager generado por CodeIgniter */
.pager > nav {
  display: inline-flex;
  align-items: center;
}
.pager nav ul {
  list-style: none;
  display: inline-flex;
  gap: 6px;
  padding: 0;
  margin: 0;
}
.pager nav li {
  display: inline-flex;
}
.pager nav li a,
.pager nav li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  background: var(--color-surface);
  text-decoration: none;
  transition: var(--transition);
}
.pager nav li a:hover {
  background: var(--color-surface-hover, #f2f2f2);
}
.pager nav li.active span,
.pager nav li span[aria-current="page"] {
  background: var(--color-primary);
  color: var(--color-on-primary, #fff);
  border-color: var(--color-primary);
}

/* Utility classes */
.hover-rise {
  transition: var(--transition);
}

.hover-rise:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

/* Responsive adjustments */
@media (max-width: 640px) {
  .hero {
    padding: 40px 0 32px;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 280px;
  }
  /* No expandir botones dentro de acciones de filas */
  .row-actions .btn { width: auto; max-width: none; }
  
  .product-image {
    height: 200px;
  }
  
  .nav {
    flex-direction: row; /* mantener una sola línea en móvil */
    gap: 8px;
    padding: 12px 0;
    flex-wrap: nowrap;
    align-items: center;
  }
  
  .nav nav {
    width: 100%;
    justify-content: center;
  }

  /* Asegurar que las acciones (tema, carrito, menú) queden alineadas en una fila */
  .nav-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
  }
}

/* --- Tablas responsivas para móviles --- */
@media (max-width: 640px) {
  /* Listado de pedidos: convertir filas en tarjetas compactas */
  .table.orders thead { display: none; }
  .table.orders tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
  }
  .table.orders tbody tr:hover { background: var(--color-surface); }
  .table.orders td { padding: 4px 0; }
  .table.orders td:nth-child(1) { font-weight: 600; color: var(--color-text); }
  .table.orders td:nth-child(3) { font-weight: 700; }
  /* Ocultar columnas menos críticas para móvil: Fecha y Pago */
  .table.orders td:nth-child(2),
  .table.orders td:nth-child(4) { display: none; }
  /* Estado visible; Acciones al pie de la tarjeta */
  .table.orders td:nth-child(5) { align-self: center; }
  .table.orders td:nth-child(6) {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }

  /* Detalle de pedido: simplificar y ocultar precio unitario */
  .table.order-detail thead { display: none; }
  .table.order-detail tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
  }
  .table.order-detail td { padding: 4px 0; }
  .table.order-detail td:nth-child(1) { font-weight: 600; }
  /* Ocultar Precio en móvil para reducir ancho */
  .table.order-detail td:nth-child(3) { display: none; }
  .table.order-detail td:nth-child(2),
  .table.order-detail td:nth-child(4) { text-align: right; }
}

/* Patrón genérico stack en móvil con data-labels */
@media (max-width: 640px) {
  .table.stack-sm thead { display: none; }
  .table.stack-sm tbody tr {
    display: block;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-card);
    box-shadow: var(--shadow-sm);
  }
  .table.stack-sm tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border: none;
  }
  .table.stack-sm tbody td::before {
    content: attr(data-label);
    color: var(--color-text-light);
    font-weight: 600;
    margin-right: 12px;
  }
  .table.stack-sm .row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 6px;
  }
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Success/Error messages */
.alert {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.alert.success { background: var(--alert-success-bg); border: 1px solid var(--alert-success-border); color: var(--alert-success-text); }
.alert.error { background: var(--alert-error-bg); border: 1px solid var(--alert-error-border); color: var(--alert-error-text); }
.alert.info { background: var(--alert-info-bg); border: 1px solid var(--alert-info-border); color: var(--alert-info-text); }
/* --- Superadmin Notificaciones (diseño mejorado) --- */
#superadmin-notifs .page-header { margin-bottom: 12px; }
#superadmin-notifs .page-header h2 { margin: 0; font-size: 22px; }
#superadmin-notifs .page-header .subtitle { color: var(--color-text-light); margin-top: 6px; }
#superadmin-notifs .cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
#superadmin-notifs .card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
#superadmin-notifs .card-header {
  padding: 10px 12px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
}
#superadmin-notifs .card-body { padding: 10px 12px; }
#superadmin-notifs .option { display: flex; align-items: center; gap: 8px; padding: 6px 0; }

/* Filtros del historial (adaptados a tema) */
.filtros {
  margin-bottom: 20px;
  padding: 15px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}
.filtros form {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}
.filtros .form-group { margin: 0; }
#superadmin-notifs .option input[type="checkbox"] { width: 18px; height: 18px; }
#superadmin-notifs .actions { margin-top: 16px; display: flex; gap: 8px; align-items: center; }
#superadmin-notifs .btn { display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 6px; border: 1px solid #d0d0d0; text-decoration: none; cursor: pointer; }
#superadmin-notifs .btn.primary { background: var(--color-primary); color: white; border-color: var(--color-primary); }
#superadmin-notifs .btn.ghost { background: var(--color-card); color: var(--color-text); }
#superadmin-notifs .alert { padding: 10px 12px; border-radius: 6px; margin-top: 12px; }
#superadmin-notifs .alert.success { background: var(--alert-success-bg); border: 1px solid var(--alert-success-border); color: var(--alert-success-text); }
#superadmin-notifs .alert.info { background: var(--alert-info-bg); border: 1px solid var(--alert-info-border); color: var(--alert-info-text); }

/* Page header reutilizable */
.page-header { margin-bottom: 12px; }
.page-header h2 { margin: 0; font-size: 22px; }
.page-header .subtitle { color: var(--color-text-light); margin-top: 6px; }

/* Badges para estados y prioridad */
.badge.state-pendiente { background: var(--state-pending-bg); border-color: var(--state-pending-border); color: var(--state-pending-text); }
.badge.state-enviado { background: var(--state-sent-bg); border-color: var(--state-sent-border); color: var(--state-sent-text); }
.badge.state-leido { background: var(--state-read-bg); border-color: var(--state-read-border); color: var(--state-read-text); }

.badge.pri-alta { background: var(--priority-high-bg); border-color: var(--priority-high-border); color: var(--priority-high-text); }
.badge.pri-media { background: var(--priority-medium-bg); border-color: var(--priority-medium-border); color: var(--priority-medium-text); }
.badge.pri-baja { background: var(--priority-low-bg); border-color: var(--priority-low-border); color: var(--priority-low-text); }
#superadmin-notifs .page-header h2 { margin: 0; font-size: 22px; }
#superadmin-notifs .page-header .subtitle { color: var(--color-text-light); margin-top: 6px; }

#superadmin-notifs .cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

#superadmin-notifs .card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
#superadmin-notifs .card-header {
  padding: 10px 12px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
}
#superadmin-notifs .card-body { padding: 10px 12px; }

#superadmin-notifs .option { display: flex; align-items: center; gap: 8px; padding: 6px 0; }

/* Encabezado de sugerencias */
.suggestions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.suggestions-header .summary { color: var(--color-text-light); }
.suggestions-controls .inline-form { display: inline-flex; align-items: center; gap: 8px; }
.suggestions-controls select { height: 36px; border: 1px solid var(--color-border); background: var(--color-card); color: var(--color-text); border-radius: 8px; padding: 6px 8px; }
.suggestions-controls .btn.small { padding: 6px 10px; font-size: 14px; }
#superadmin-notifs .option input[type="checkbox"] { width: 18px; height: 18px; }

#superadmin-notifs .actions { margin-top: 16px; display: flex; gap: 8px; align-items: center; }

#superadmin-notifs .btn { display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--color-border); text-decoration: none; cursor: pointer; }
#superadmin-notifs .btn.primary { background: var(--color-primary); color: white; border-color: var(--color-primary); }
#superadmin-notifs .btn.ghost { background: var(--color-card); color: var(--color-text); }

#superadmin-notifs .alert { padding: 10px 12px; border-radius: 6px; margin-top: 12px; }
#superadmin-notifs .alert.success { background: var(--alert-success-bg); border: 1px solid var(--alert-success-border); color: var(--alert-success-text); }
#superadmin-notifs .alert.info { background: var(--alert-info-bg); border: 1px solid var(--alert-info-border); color: var(--alert-info-text); }
/* ===== Tablas Responsive Profesionales ===== */
.table { width: 100%; border-collapse: collapse; table-layout: auto; }
.table th, .table td { padding: 10px 12px; vertical-align: middle; word-break: normal; overflow-wrap: break-word; }
.table th { font-weight: 600; }
.table .right { text-align: right; }
.table .center { text-align: center; }

/* Acciones dentro de tabla */
.table-actions { display: flex; gap: 8px; align-items: center; justify-content: center; }
.btn.table-action { padding: 6px 10px; font-size: 14px; line-height: 1.2; }

/* Inputs numéricos dentro de tabla */
.table input[type="number"] { width: 100%; max-width: 120px; padding: 6px 8px; }

/* Versión apilada para móviles: stack-sm */
.table.stack-sm { width: 100%; }
@media (max-width: 640px) {
  .table.stack-sm colgroup, .table.stack-sm col { width: auto !important; }
  .table.stack-sm thead { display: none; }
  .table.stack-sm tfoot { display: table-footer-group; }
  .table.stack-sm tr { display: block; padding: 12px; margin-bottom: 12px; border: 1px solid var(--color-border, #e5e7eb); border-radius: 12px; background: var(--color-surface); }
  .table.stack-sm tr:first-child { border-top: 0; }
  .table.stack-sm td, .table.stack-sm th { display: block; padding: 6px 0; text-align: left; }
  .table.stack-sm td::before, .table.stack-sm th::before { display:block; content: attr(data-label); font-weight: 600; color: var(--color-muted, #6b7280); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
  .table.stack-sm .center { text-align: left; }
  .table.stack-sm .right { text-align: right; }
  .table.stack-sm tfoot tr { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 0; margin: 0; border: 0; background: transparent; }
  .table.stack-sm tfoot th, .table.stack-sm tfoot td { display: block; text-align: left; }
  .table.stack-sm .table-actions { justify-content: flex-start; width: 100%; }
  /* Card Layout refinado: título de producto sin etiqueta y acciones al final */
  .table.stack-sm td.cell-title, .table.stack-sm th.cell-title {
    display: block;
    grid-template-columns: none;
    gap: 0;
    font-weight: 700;
    font-size: 16px;
    color: var(--color-text);
    margin-bottom: 6px;
  }
  .table.stack-sm td.cell-title::before, .table.stack-sm th.cell-title::before { content: none; }
  .table.stack-sm td.price, .table.stack-sm td.subtotal { font-weight: 700; font-size: 16px; }
  .table.stack-sm td.action-cell { display: block; margin-top: 8px; }
  .table.stack-sm .btn.table-action, .table.stack-sm td.action-cell .btn { width: 100%; }
}

/* Contenedor de tabla: sin scroll horizontal */
.table-wrap { overflow: visible; }