/* ================================================================
   SISTEMA PIXELIA — CSS Base
   Paleta corporativa Pixelia (azul). Fuente de verdad del look.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

/* --- Variables del sistema de diseño --- */
:root {
  /* ===== Marca Pixelia ===== */
  --brand:        #0078E4;   /* azul Pixelia — acento principal */
  --brand-osc:    #0064C0;   /* azul hover / pressed */
  --brand-noche:  #002454;   /* azul noche — sidebar, títulos, texto fuerte */
  --teal:         #00A89C;   /* verde azulado Pixelia — segundo color de marca */
  --teal-osc:     #068B81;

  /* ===== Superficies y tinta ===== */
  --app-bg: #EEF1F6;         /* fondo de la app (no blanco puro) */
  --bg: #FFFFFF;             /* superficie: tarjetas, inputs, topbar */
  --ink: #14243D;            /* texto principal (azul noche legible) */
  --ink-2: #48566B;          /* texto secundario */
  --ink-3: #8A93A2;          /* texto mudo / placeholders */
  --line: #D7DDE7;           /* bordes */
  --panel: #F4F6F9;          /* zebra de tablas, th, paneles sutiles */

  /* ===== Acento (compat: muchas reglas heredadas usan --accent) ===== */
  --accent: #0078E4;
  --btn-primary-bg: #0078E4;
  --btn-primary-fg: #FFFFFF;

  /* ===== Semánticos ===== */
  --ok: #12A150;             /* verde: aprobar, positivo */
  --warn: #B76E00;           /* ámbar Pixelia */
  --danger: #B3261E;         /* rojo Pixelia */

  /* ===== Semáforo de cocina (KDS): funcional, alto contraste ===== */
  --kds-new: #E8A317;        /* nueva (ámbar de alerta) */
  --kds-prep: #CBD5E1;       /* en preparación */
  --kds-ready: #12A150;      /* lista */

  --radius: 6px;
  --radius-max: 10px;
  --shadow-sm: 0 1px 2px rgba(16,33,64,0.06);
  --shadow-md: 0 6px 20px rgba(16,33,64,0.08);
  --font-ui: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

/* --- Reset mínimo --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--app-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Tipografía --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--brand-noche);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }

.text-secondary { color: var(--ink-2); }
.text-muted { color: var(--ink-3); }
.font-mono { font-family: var(--font-mono); }

/* --- Links --- */
a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  color: var(--brand-osc);
  text-decoration: underline;
}

/* --- Botones --- */
button, .btn {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
}

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

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border-color: var(--btn-primary-bg);
  box-shadow: 0 1px 2px rgba(0,120,228,0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-osc);
  border-color: var(--brand-osc);
}

.btn-secondary {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--line);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--panel);
  border-color: var(--ink-3);
}

.btn-danger {
  background: var(--danger);
  color: #FFFFFF;
  border-color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  opacity: 0.85;
}

/* ===== Vocabulario de botones por acción (consistente en todo el sistema) =====
   ok = aprobar/positivo · danger = anular/eliminar/rechazar · excel/pdf = exportes.
   Acción principal = azul Pixelia (.btn-primary); estos son acentos semánticos. */
.btn-ok {
  background: var(--ok);
  color: #FFFFFF;
  border-color: var(--ok);
}
.btn-ok:hover:not(:disabled) { opacity: 0.88; }

/* Exportes: outline con el color del formato; al hover se rellena. */
.btn-excel {
  background: var(--bg);
  color: #1D6F42;            /* verde Excel */
  border-color: #1D6F42;
}
.btn-excel:hover:not(:disabled) { background: #1D6F42; color: #FFFFFF; }
.btn-pdf {
  background: var(--bg);
  color: #B00020;            /* rojo PDF */
  border-color: #B00020;
}
.btn-pdf:hover:not(:disabled) { background: #B00020; color: #FFFFFF; }

/* ===== Identidad de color por módulo (wayfinding, solo acentos) =====
   --mod lo fija el <body> según el grupo del módulo activo. Paleta fría Pixelia. */
:root { --mod: var(--brand); }
body.mod-operacion { --mod: #0078E4; }  /* Operación  → azul Pixelia */
body.mod-stock     { --mod: #0E8C86; }  /* Catálogo/Stock → teal */
body.mod-config    { --mod: #5B6573; }  /* Configuración → gris pizarra */
body.mod-personas  { --mod: #6D5BD0; }  /* Personas → violeta azulado */
body.mod-analisis  { --mod: #3A57C4; }  /* Análisis → índigo */

/* Acento del módulo en la cabecera (topbar) */
body[class*="mod-"] .topbar-crumbs .crumb-group { color: var(--mod); font-weight: 600; }
body[class*="mod-"] .topbar-title { border-left: 3px solid var(--mod); padding-left: 0.5rem; }

/* Acento reutilizable para cabeceras de módulo dentro del contenido */
.mod-accent { border-left: 3px solid var(--mod); padding-left: 0.6rem; }
.mod-dot::before {
  content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--mod); margin-right: 0.45rem; vertical-align: middle;
}

/* --- Inputs --- */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="tel"],
input[type="url"],
select,
textarea {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 120, 228, 0.18);
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-3);
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--ink-2);
}

/* --- Tablas --- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

th, td {
  padding: 0.5rem 0.625rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  font-weight: 600;
  color: var(--brand-noche);
  background: var(--panel);
}

/* Zebra */
tbody tr:nth-child(even) {
  background: var(--panel);
}

tbody tr:hover {
  background: #E7EFF9;
}

/* Columnas numéricas en monoespaciada */
.col-num {
  font-family: var(--font-mono);
  text-align: right;
}

/* --- Badges / estados --- */
.badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-ok { background: #E3F6EC; color: var(--ok); }
.badge-warn { background: #FBF0DC; color: var(--warn); }
.badge-danger { background: #FBEAE9; color: var(--danger); }
.badge-info { background: #E4F0FC; color: var(--brand); }

/* --- Paneles / cards --- */
.panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-max);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

/* --- Utilidades --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

#app-notificaciones {
  position: fixed !important;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }

/* ===== Tematización unificada Pixelia =====
   El sistema usa una sola identidad azul en todas las sucursales (antes había
   acento rojo/amarillo por marca del local). La franja del sidebar es azul Pixelia. */
body.marca-papios,
body.marca-emperador {
  --accent: var(--brand);
}

.sidebar-header {
  border-bottom: 3px solid var(--brand);
}

/* Pestañas (.tab-container/.tab-btn/.tab-content) — usadas por Reportes y otros.
   Sin esta regla todas las secciones se mostraban apiladas a la vez. */
.tab-header {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 0.5rem 1rem;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tab-btn:hover { color: var(--brand); }
.tab-btn.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}
.tab-content { display: none; }
.tab-content.active { display: block; }
