/* ============================================
   SL Distribuidora — Design System
   Apple-like aesthetic, Inter font, glassmorphism
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* --- Design Tokens --- */
:root {
  /* Logo-derived palette */
  --navy: #0a1e5c;
  --navy-light: #132b6e;
  --royal: #1955a5;
  --royal-light: #2468c2;
  --cyan: #00b4d8;
  --cyan-light: #33c7e8;
  --silver: #b8c5d6;
  --silver-light: #d0dae8;

  /* Semantic colors */
  --bg-primary: #f2f4f8;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-glass: rgba(255, 255, 255, 0.55);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  --border: rgba(148, 163, 184, 0.2);
  --border-hover: rgba(25, 85, 165, 0.3);

  /* Status */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);

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

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(10, 30, 92, 0.04);
  --shadow-md: 0 4px 16px rgba(10, 30, 92, 0.06);
  --shadow-lg: 0 8px 32px rgba(10, 30, 92, 0.08);
  --shadow-xl: 0 16px 48px rgba(10, 30, 92, 0.12);
  --shadow-glass: 0 8px 32px rgba(10, 30, 92, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.6);

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-display: 3rem;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 150ms var(--ease);
  --transition: 250ms var(--ease);
  --transition-slow: 400ms var(--ease);

  /* Gradients */
  --gradient-brand: linear-gradient(135deg, var(--navy) 0%, var(--royal) 50%, var(--cyan) 100%);
  --gradient-card: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 100%);
  --gradient-accent: linear-gradient(135deg, var(--royal) 0%, var(--cyan) 100%);
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --bg-primary: #0b1120;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-glass: rgba(17, 24, 39, 0.65);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: rgba(148, 163, 184, 0.12);
  --border-hover: rgba(0, 180, 216, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.4);
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --gradient-card: linear-gradient(135deg, rgba(17,24,39,0.9) 0%, rgba(17,24,39,0.7) 100%);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}
a { color: var(--royal); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--cyan); }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, select { font-family: var(--font); font-size: var(--text-base); }
img { max-width: 100%; display: block; }
table { border-collapse: collapse; width: 100%; }

/* --- Utility Classes --- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.fade-in { animation: fadeIn var(--transition-slow) var(--ease) both; }
.slide-up { animation: slideUp var(--transition-slow) var(--ease) both; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* --- Components --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-primary {
  background: var(--gradient-accent);
  color: var(--text-inverse);
  box-shadow: 0 2px 8px rgba(25, 85, 165, 0.3);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(25, 85, 165, 0.4); transform: translateY(-1px); }
.btn-ghost {
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--border); }

.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  outline: none;
}
.input:focus { border-color: var(--royal); box-shadow: 0 0 0 3px rgba(25, 85, 165, 0.12); }
.input::placeholder { color: var(--text-muted); }

.select {
  padding: var(--space-2) var(--space-8) var(--space-2) var(--space-3);
  background: var(--bg-secondary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 12px center no-repeat;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 500;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
}
.select:focus { border-color: var(--royal); box-shadow: 0 0 0 3px rgba(25, 85, 165, 0.12); }
.select:hover { border-color: var(--border-hover); }

/* Options dropdown (suporte varia por navegador/OS) */
.select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: var(--text-sm);
}
[data-theme="dark"] .select option {
  background: #0f172a;
  color: #e2e8f0;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, transparent 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--silver); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
