/**
 * ERP Labtronic - Design Tokens
 * Sistema de variables CSS — Estilo IndustrialAI ERP
 * Versión: 2.0.0
 *
 * Paleta: Emerald (#10b981) accent, dark sidebar, Inter font
 */

:root {
  /* ============================================
     THEME TOKENS - Light Mode (Default)
     ============================================ */

  /* Backgrounds */
  --bg-primary: #f1f5f9;       /* slate-100 — main bg */
  --bg-secondary: #ffffff;     /* white — cards */
  --bg-tertiary: #f8fafc;      /* slate-50 — subtle */
  --bg-elevated: #ffffff;      /* white */

  /* Text/Labels */
  --label-primary: #0f172a;    /* slate-900 */
  --label-secondary: #64748b;  /* slate-500 */
  --label-tertiary: #94a3b8;   /* slate-400 */

  /* Borders */
  --separator: #e2e8f0;        /* slate-200 */
  --separator-opaque: #cbd5e1; /* slate-300 */

  /* Semantic Colors */
  --color-primary: #10b981;    /* emerald-500 */
  --color-primary-dark: #059669; /* emerald-600 */
  --color-success: #22c55e;    /* green-500 */
  --color-warning: #f59e0b;    /* amber-500 */
  --color-danger: #ef4444;     /* red-500 */
  --color-info: #3b82f6;       /* blue-500 */

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px -2px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 20px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 16px 32px -8px rgba(0, 0, 0, 0.12);

  /* Sidebar — Dark gradient */
  --sidebar-width: 260px;
  --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  --sidebar-surface: transparent;
  --sidebar-surface-alt: rgba(255, 255, 255, 0.03);
  --sidebar-text: #e2e8f0;
  --sidebar-muted: rgba(255, 255, 255, 0.4);
  --sidebar-icon-bg: transparent;
  --sidebar-icon-color: #94a3b8;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
  --sidebar-active-bg: rgba(16, 185, 129, 0.12);
  --sidebar-active-text: #34d399;
  --sidebar-badge-bg: rgba(16, 185, 129, 0.15);
  --sidebar-badge-text: #34d399;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --sidebar-shadow: none;

  /* Header */
  --header-bg: #ffffff;
  --header-border: #e2e8f0;
  --header-height: 56px;

  /* ERP Card tokens */
  --card-radius: 12px;
  --card-border: #e2e8f0;
  --card-header-border: #f1f5f9;

  /* ERP Button */
  --btn-primary-bg: linear-gradient(135deg, #059669, #10b981);
  --btn-primary-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* ============================================
   DARK MODE THEME
   ============================================ */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-elevated: #1e293b;

  --label-primary: #f8fafc;
  --label-secondary: #94a3b8;
  --label-tertiary: #64748b;

  --separator: rgba(255, 255, 255, 0.1);
  --separator-opaque: rgba(255, 255, 255, 0.2);

  --color-primary: #34d399;
  --color-primary-dark: #10b981;
  --color-success: #22c55e;
  --color-warning: #fbbf24;
  --color-danger: #ef4444;
  --color-info: #60a5fa;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);

  /* Sidebar stays dark (same as light) */
  --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);

  --header-bg: #1e293b;
  --header-border: rgba(255, 255, 255, 0.1);

  --card-border: rgba(255, 255, 255, 0.1);
  --card-header-border: rgba(255, 255, 255, 0.06);
}

/* ============================================
   ERP UTILITY CLASSES
   ============================================ */

.theme-bg-primary { background-color: var(--bg-primary); }
.theme-bg-secondary { background-color: var(--bg-secondary); }
.theme-bg-tertiary { background-color: var(--bg-tertiary); }
.theme-text-primary { color: var(--label-primary); }
.theme-text-secondary { color: var(--label-secondary); }
.theme-text-tertiary { color: var(--label-tertiary); }
.theme-border { border-color: var(--separator); }
.theme-border-opaque { border-color: var(--separator-opaque); }

/* ERP Card */
.erp-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  overflow: hidden;
}

.erp-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--card-header-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.erp-card-header h3,
.erp-card-header .erp-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--label-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.erp-card-body {
  padding: 16px 20px;
}

/* ERP Labels & Values */
.erp-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--label-tertiary);
  margin-bottom: 3px;
}

.erp-value {
  font-size: 13px;
  color: var(--label-primary);
  font-weight: 500;
}

/* ERP Buttons */
.erp-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--btn-primary-bg);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.erp-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--btn-primary-shadow);
}

.erp-btn-primary:active {
  transform: translateY(0);
}

.erp-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--bg-secondary);
  color: var(--label-secondary);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--separator);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.erp-btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--separator-opaque);
}

/* ERP Badges */
.erp-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
}

.erp-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.erp-badge-green { background: #dcfce7; color: #15803d; }
.erp-badge-yellow { background: #fef9c3; color: #a16207; }
.erp-badge-red { background: #fee2e2; color: #991b1b; }
.erp-badge-blue { background: #dbeafe; color: #1d4ed8; }
.erp-badge-gray { background: #f1f5f9; color: #475569; }
.erp-badge-purple { background: #ede9fe; color: #7c3aed; }

/* ERP Inputs */
.erp-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--separator);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--label-primary);
  background: var(--bg-secondary);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.erp-input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* ERP Stat Card */
.erp-stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 10px;
}

.erp-stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.erp-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--label-primary);
  line-height: 1;
}

.erp-stat-label {
  font-size: 11px;
  color: var(--label-tertiary);
  margin-top: 2px;
}

/* ERP Animations */
@keyframes erpSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.erp-animate { animation: erpSlideIn 0.3s ease forwards; }
.erp-animate-d1 { animation-delay: 0.05s; opacity: 0; }
.erp-animate-d2 { animation-delay: 0.1s; opacity: 0; }
.erp-animate-d3 { animation-delay: 0.15s; opacity: 0; }
