/* ============================================
   BAOGIA.MMCORP — Design System
   Modern B2B SaaS · Dark Theme
   ============================================ */

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

/* ─── CSS Custom Properties ─────────────────── */
:root {
  /* Brand Colors */
  --color-brand-primary: #F59E0B;
  --color-brand-secondary: #3B82F6;
  --color-brand-gradient: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
  --color-brand-gradient-blue: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
  --color-brand-gradient-green: linear-gradient(135deg, #10B981 0%, #3B82F6 100%);

  /* Background Scale */
  --bg-base: #080E1C;
  --bg-surface: #0F1729;
  --bg-card: #141E33;
  --bg-card-hover: #1A2540;
  --bg-elevated: #1E2D4A;
  --bg-overlay: rgba(8, 14, 28, 0.85);
  --bg-glass: rgba(20, 30, 51, 0.7);

  /* Text Scale */
  --text-primary: #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-muted: #64748B;
  --text-disabled: #334155;
  --text-inverse: #0F1729;
  --text-brand: #F59E0B;

  /* Border */
  --border-subtle: rgba(255,255,255,0.06);
  --border-default: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.18);
  --border-brand: rgba(245, 158, 11, 0.4);
  --border-focus: #F59E0B;

  /* Status Colors */
  --color-success: #10B981;
  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-success-border: rgba(16, 185, 129, 0.3);

  --color-warning: #F59E0B;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-warning-border: rgba(245, 158, 11, 0.3);

  --color-danger: #EF4444;
  --color-danger-bg: rgba(239, 68, 68, 0.12);
  --color-danger-border: rgba(239, 68, 68, 0.3);

  --color-info: #3B82F6;
  --color-info-bg: rgba(59, 130, 246, 0.12);
  --color-info-border: rgba(59, 130, 246, 0.3);

  --color-purple: #8B5CF6;
  --color-purple-bg: rgba(139, 92, 246, 0.12);
  --color-purple-border: rgba(139, 92, 246, 0.3);

  /* Quotation Status Colors */
  --status-draft: #64748B;
  --status-review: #3B82F6;
  --status-approved: #10B981;
  --status-sent: #8B5CF6;
  --status-discussing: #F59E0B;
  --status-revised: #F97316;
  --status-won: #10B981;
  --status-lost: #EF4444;
  --status-archived: #475569;

  /* Margin Health */
  --margin-healthy: #10B981;
  --margin-ok: #F59E0B;
  --margin-low: #EF4444;

  /* Spacing Scale */
  --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;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.4);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.6);
  --shadow-brand: 0 4px 20px rgba(245, 158, 11, 0.25);
  --shadow-glow: 0 0 30px rgba(245, 158, 11, 0.15);

  /* Typography */
  --font-heading: 'Outfit', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Font Sizes */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 22px;
  --text-3xl: 28px;
  --text-4xl: 36px;
  --text-5xl: 48px;

  /* Line Heights */
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 350ms ease;
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-Index Scale */
  --z-base: 0;
  --z-raised: 10;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
  --z-tooltip: 600;

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --header-height: 60px;
  --content-max: 1400px;
}

[data-theme="light"] {
  --bg-base: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --bg-elevated: #F1F5F9;
  --bg-overlay: rgba(255, 255, 255, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.7);

  --text-primary: #0F1729;
  --text-secondary: #334155;
  --text-muted: #64748B;
  --text-disabled: #CBD5E1;
  --text-inverse: #FFFFFF;

  --border-subtle: rgba(0,0,0,0.06);
  --border-default: rgba(0,0,0,0.12);
  --border-strong: rgba(0,0,0,0.20);
}

/* ─── Reset & Base ───────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Typography ─────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-md); }

p {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

a {
  color: var(--color-brand-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover { color: #FCD34D; }

strong { font-weight: 600; color: var(--text-primary); }
small { font-size: var(--text-xs); }

/* ─── Number Display ─────────────────────────── */
.num {
  font-family: var(--font-heading);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.num-xl { font-size: var(--text-5xl); }
.num-lg { font-size: var(--text-4xl); }
.num-md { font-size: var(--text-3xl); }
.num-sm { font-size: var(--text-2xl); }

/* ─── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ─── Selection ──────────────────────────────── */
::selection { background: rgba(245, 158, 11, 0.25); color: var(--text-primary); }

/* ─── Focus Ring ─────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-brand-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ─── Images ─────────────────────────────────── */
img, video { max-width: 100%; height: auto; display: block; }

/* ─── Lists ──────────────────────────────────── */
ul, ol { list-style: none; }

/* ─── Utility Classes ────────────────────────── */

/* Flex */
.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-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Grid */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Text */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-brand { color: var(--color-brand-primary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-heading { font-family: var(--font-heading); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Spacing */
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

/* Display */
.hidden { display: none !important; }
.block { display: block; }
.inline-flex { display: inline-flex; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.relative { position: relative; }
.absolute { position: absolute; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Border Radius */
.rounded { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* Cursors */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }

/* Opacity */
.opacity-50 { opacity: 0.5; }
.opacity-0 { opacity: 0; }

/* ─── Color Indicators ───────────────────────── */
.dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
  flex-shrink: 0;
}
.dot-success { background: var(--color-success); }
.dot-warning { background: var(--color-warning); }
.dot-danger { background: var(--color-danger); }
.dot-info { background: var(--color-info); }
.dot-muted { background: var(--text-muted); }

/* ─── Dividers ───────────────────────────────── */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-4) 0;
}
.divider-vertical {
  width: 1px;
  height: 100%;
  background: var(--border-subtle);
  margin: 0 var(--space-4);
}

/* ─── Gradient Text ──────────────────────────── */
.gradient-text {
  background: var(--color-brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Glassmorphism ──────────────────────────── */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
}

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

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 10px rgba(245, 158, 11, 0.3); }
  50% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.6); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-fadeIn { animation: fadeIn 0.3s ease forwards; }
.animate-fadeInScale { animation: fadeInScale 0.3s ease forwards; }
.animate-slideInRight { animation: slideInRight 0.3s ease forwards; }
.animate-slideInLeft { animation: slideInLeft 0.3s ease forwards; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-glow { animation: glow 2s infinite; }
.animate-spin { animation: spin 1s linear infinite; }

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

/* ─── Print Styles ───────────────────────────── */
@media print {
  :root {
    --bg-base: #fff;
    --bg-surface: #fff;
    --bg-card: #f8f9fa;
    --text-primary: #1a1a2e;
    --text-secondary: #444;
    --border-default: #ddd;
  }
  .no-print { display: none !important; }
  .print-only { display: block !important; }
}
.print-only { display: none; }

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 1200px) {
  :root { --sidebar-width: 220px; }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 64px; }
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
}
/* ─── Compact Mode Overrides ─────────────────── */
body.compact-mode {
  --space-4: 10px;
  --space-6: 14px;
  --text-base: 13px;
  --text-lg: 14px;
  --text-xl: 16px;
  --text-2xl: 18px;
  --text-3xl: 22px;
  --header-height: 52px;
}

body.compact-mode .card,
body.compact-mode .stat-card {
  padding: 12px 14px;
}

body.compact-mode .stat-icon {
  width: 32px; height: 32px;
  font-size: 16px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
}

body.compact-mode .stat-value {
  font-size: 22px;
}

body.compact-mode .table td {
  padding: 8px 12px;
}

body.compact-mode .table th {
  padding: 8px 12px;
}

body.compact-mode .line-item-row {
  padding: 6px 10px;
  gap: 8px;
}

body.compact-mode .form-control {
  padding: 6px 10px;
  font-size: 13px;
}

body.compact-mode .btn {
  padding: 6px 12px;
}

body.compact-mode .badge {
  padding: 2px 8px;
  font-size: 10px;
}
