/**
 * DESIGN SYSTEM — Unicorn SaaS Premium Tokens
 * Single source of truth for UI overhaul.
 * Load AFTER base.css, BEFORE layout/components.
 *
 * Defines: --bg, --surface, --surface-2, --border, --text, --text-muted,
 * --primary, --success, --warning, --danger, --radius-*, --shadow-*, --focus-ring,
 * --table-hover, --sidebar-bg, --sidebar-active
 */

:root {
  /* ============================================
     VISUAL DEPTH — 3-Layer Surface System
     Layer 0: App background (warm neutral)
     Layer 1: Main surfaces (cards, tables)
     Layer 2: Elevated (dropdowns, modals)
     ============================================ */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --color-bg: #f5f6f8;

  /* ============================================
     BORDERS (soft, no harsh lines)
     ============================================ */
  --border: #e8eaef;
  --border-subtle: #f0f2f5;

  /* ============================================
     TEXT
     ============================================ */
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;

  /* ============================================
     SEMANTIC COLORS (soft, readable)
     ============================================ */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #dbeafe;

  --success: #16a34a;
  --success-soft: #dcfce7;

  --warning: #d97706;
  --warning-soft: #fef3c7;

  --danger: #dc2626;
  --danger-soft: #fee2e2;

  --info: #0284c7;
  --info-soft: #e0f2fe;

  /* ============================================
     RADIUS (8/12/16)
     ============================================ */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* ============================================
     SHADOWS — Layer 1 (cards) / Layer 2 (elevated)
     ============================================ */
  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-2: 0 4px 6px rgba(15, 23, 42, 0.05), 0 10px 24px rgba(15, 23, 42, 0.06);
  --shadow-elevated: 0 8px 16px rgba(15, 23, 42, 0.06), 0 20px 40px rgba(15, 23, 42, 0.08);

  /* ============================================
     FOCUS RING (accessible)
     ============================================ */
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.25);

  /* ============================================
     TABLE
     ============================================ */
  --table-hover: rgba(37, 99, 235, 0.04);

  /* ============================================
     SIDEBAR
     ============================================ */
  --sidebar-bg: #0f172a;
  --sidebar-active: rgba(37, 99, 235, 0.15);
  --sidebar-active-text: #ffffff;

  /* ============================================
     SPACING (8px scale)
     ============================================ */
  --ds-space-1: 8px;
  --ds-space-2: 16px;
  --ds-space-3: 24px;
  --ds-space-4: 32px;
  --ds-space-5: 40px;
  --ds-space-6: 48px;

  /* ============================================
     TYPOGRAPHY (consistent)
     ============================================ */
  --ds-title: 28px;
  --ds-title-weight: 700;
  --ds-subtitle: 14px;
  --ds-subtitle-muted: 1;
  --ds-section: 16px;
  --ds-section-weight: 600;
  --ds-body: 14px;
  --ds-body-line: 1.5;
  --ds-caption: 12px;

  /* ============================================
     TRANSITIONS (180ms — premium feel)
     ============================================ */
  --ds-transition: 180ms ease;
}

/* ============================================
   CARD (soft border + subtle shadow)
   ============================================ */
.ds-card,
.card-xl {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--ds-space-3);
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--ds-transition), transform var(--ds-transition);
}

.ds-card:hover,
.card-xl:hover {
  box-shadow: var(--shadow-2);
}

/* ============================================
   FILTER BAR (Apply/Reset right aligned)
   ============================================ */
.ds-filter-bar .filter-row {
  display: flex;
  align-items: center;
  gap: var(--ds-space-2);
  flex-wrap: wrap;
}

.ds-filter-bar .filter-actions {
  margin-left: auto;
  display: flex;
  gap: var(--ds-space-1);
  align-items: center;
}

.ds-filter-bar .filter-search input,
.ds-filter-bar .form-control {
  height: 40px;
  padding: 0 var(--ds-space-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ============================================
   EMPTY STATE (centered, balanced)
   ============================================ */
.ds-empty-state,
.empty-state {
  text-align: center;
  padding: var(--ds-space-6) var(--ds-space-4);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  margin: var(--ds-space-3) 0;
}

.ds-empty-state .empty-icon,
.empty-state .empty-icon {
  font-size: 48px;
  color: var(--text-soft);
  margin-bottom: var(--ds-space-2);
}

.ds-empty-state .empty-title,
.empty-state .empty-title {
  font-size: var(--ds-section);
  font-weight: var(--ds-section-weight);
  color: var(--text);
  margin: 0 0 var(--ds-space-1);
}

.ds-empty-state .empty-description,
.empty-state .empty-description {
  font-size: var(--ds-body);
  color: var(--text-muted);
  margin: 0 0 var(--ds-space-3);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.ds-empty-state .ds-empty-cta,
.empty-state .empty-action a,
.empty-state .btn {
  margin-top: var(--ds-space-2);
}

/* ============================================
   BADGE (soft pill, readable)
   ============================================ */
.badge {
  padding: 4px 10px;
  font-size: var(--ds-caption);
  font-weight: 500;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-secondary { background: var(--surface-2); color: var(--text-muted); }

/* ============================================
   TABLE (sticky header, row hover)
   ============================================ */
.table-wrapper {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ds-body);
}

.table thead {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 1;
}

.table th {
  padding: var(--ds-space-1) var(--ds-space-2);
  text-align: left;
  font-weight: 600;
  font-size: var(--ds-caption);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: var(--ds-space-2);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--ds-transition);
}

.table tbody tr:hover {
  background: var(--table-hover);
}

.table .col-actions {
  text-align: right;
}

/* ============================================
   BUTTON (hover lift, focus ring)
   ============================================ */
.btn {
  transition: all var(--ds-transition);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
