/* ═══════════════════════════════════════════════════════════════
   CAFÉ RAYUELA — SISTEMA POS
   main.css: Design tokens, reset, utilidades globales
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  /* Brand Colors */
  --cr-amber:        #b45309;
  --cr-amber-dark:   #92400e;
  --cr-amber-light:  #fef3c7;
  --cr-amber-pale:   #fffbeb;

  /* Neutrals */
  --cr-dark:         #0f172a;
  --cr-dark-2:       #1e293b;
  --cr-dark-3:       #334155;
  --cr-mid:          #64748b;
  --cr-light:        #94a3b8;
  --cr-pale:         #cbd5e1;
  --cr-border:       #e2e8f0;
  --cr-surface:      #f8fafc;
  --cr-white:        #ffffff;

  /* Semantic */
  --cr-green:        #059669;
  --cr-green-light:  #d1fae5;
  --cr-red:          #dc2626;
  --cr-red-light:    #fee2e2;
  --cr-blue:         #2563eb;
  --cr-blue-light:   #dbeafe;
  --cr-orange:       #ea580c;
  --cr-orange-light: #ffedd5;
  --cr-purple:       #7c3aed;
  --cr-purple-light: #ede9fe;

  /* Sidebar */
  --sidebar-bg:      #0f172a;
  --sidebar-width:   240px;
  --sidebar-collapsed: 68px;
  --topbar-height:   60px;

  /* Typography */
  --font:            'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:       'Courier New', Courier, monospace;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Radius */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(0,0,0,.05);
  --shadow:     0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --shadow-xl:  0 20px 25px rgba(0,0,0,.1), 0 10px 10px rgba(0,0,0,.04);

  /* Transitions */
  --tr-fast:   150ms ease;
  --tr-normal: 250ms ease;
  --tr-slow:   350ms ease;

  /* Z-index */
  --z-sidebar:  100;
  --z-topbar:   90;
  --z-modal:    300;
  --z-toast:    400;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--cr-dark);
  background: var(--cr-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}
img { max-width: 100%; display: block; }
table { border-collapse: collapse; width: 100%; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--cr-pale); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--cr-light); }

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.375rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }
h4 { font-size: 1rem;     font-weight: 600; line-height: 1.4; }
h5 { font-size: 0.875rem; font-weight: 600; line-height: 1.5; }
small { font-size: 0.75rem; }
strong { font-weight: 600; }

/* ── Utility Classes ── */
.text-xs    { font-size: 0.75rem; }
.text-sm    { font-size: 0.875rem; }
.text-base  { font-size: 1rem; }
.text-lg    { font-size: 1.125rem; }
.text-xl    { font-size: 1.25rem; }
.text-2xl   { font-size: 1.5rem; }

.font-normal  { font-weight: 400; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }

.text-muted   { color: var(--cr-mid); }
.text-light   { color: var(--cr-light); }
.text-primary { color: var(--cr-amber); }
.text-success { color: var(--cr-green); }
.text-danger  { color: var(--cr-red); }
.text-info    { color: var(--cr-blue); }
.text-warning { color: var(--cr-orange); }

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

.text-uppercase { text-transform: uppercase; letter-spacing: .06em; }
.text-truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Spacing utilities */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }

/* Flex utilities */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.items-end    { align-items: flex-end; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* Display */
.hidden   { display: none !important; }
.visible  { display: block !important; }

/* Width utils */
.w-full   { width: 100%; }
.w-auto   { width: auto; }
.min-w-0  { min-width: 0; }

/* ── Status Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-success { background: var(--cr-green-light);  color: var(--cr-green); }
.badge-danger  { background: var(--cr-red-light);    color: var(--cr-red); }
.badge-warning { background: var(--cr-orange-light);  color: var(--cr-orange); }
.badge-info    { background: var(--cr-blue-light);   color: var(--cr-blue); }
.badge-neutral { background: var(--cr-border);       color: var(--cr-mid); }
.badge-primary { background: var(--cr-amber-light);  color: var(--cr-amber-dark); }
.badge-purple  { background: var(--cr-purple-light); color: var(--cr-purple); }

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10);
  text-align: center;
  color: var(--cr-light);
}
.empty-state-icon { font-size: 3rem; margin-bottom: var(--space-4); opacity: .5; }
.empty-state h3   { color: var(--cr-mid); margin-bottom: var(--space-2); }
.empty-state p    { font-size: 0.875rem; max-width: 320px; }

/* ── Dividers ── */
.divider {
  border: none;
  border-top: 1px solid var(--cr-border);
  margin: var(--space-4) 0;
}

/* ── Spinner ── */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--cr-border);
  border-top-color: var(--cr-amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto var(--space-4);
}
.spinner-sm { width: 18px; height: 18px; border-width: 2px; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Stat large number ── */
.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--cr-dark);
  line-height: 1;
  letter-spacing: -.02em;
}
.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--cr-mid);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.stat-change.up   { color: var(--cr-green); background: var(--cr-green-light); }
.stat-change.down { color: var(--cr-red);   background: var(--cr-red-light); }

/* ── Loading page ── */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  color: var(--cr-mid);
}

/* ── Currency & Number formatting ── */
.currency { font-family: var(--font); font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.monospace { font-family: var(--font-mono); font-size: 0.85em; }

/* ── Print ── */
@media print {
  .sidebar, .topbar, .btn-group, .no-print { display: none !important; }
  .main-wrapper { margin: 0 !important; }
  .page-content { padding: 0 !important; }
}
