/* SmartFidelis POC - Design System
 * French Fintech Elegance with Glassmorphism
 * Production Ready for Cloudflare Pages
 */

/* ========================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ======================================== */
:root {
  /* Primary Colors */
  --color-primary: #1E40AF;
  --color-primary-light: #3B82F6;
  --color-primary-dark: #1E3A8A;

  /* Accent Colors */
  --color-accent-teal: #0D9488;
  --color-accent-teal-light: #14B8A6;
  --color-accent-gold: #F59E0B;
  --color-accent-gold-light: #FBBF24;

  /* Status Colors */
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  --color-info: #3B82F6;

  /* Neutral Colors */
  --color-bg-dark: #0F172A;
  --color-bg-dark-secondary: #1E293B;
  --color-bg-light: #F8FAFC;
  --color-bg-light-secondary: #F1F5F9;
  --color-bg-secondary: #F1F5F9;
  --color-bg-tertiary: #E2E8F0;

  /* Border Color */
  --color-border: #E2E8F0;

  /* Text Colors */
  --color-text-primary: #0F172A;
  --color-text-secondary: #475569;
  --color-text-muted: #94A3B8;
  --color-text-light: #F8FAFC;
  --color-text-light-secondary: #CBD5E1;

  /* Glass Effects */
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-bg-light: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-border-light: rgba(30, 64, 175, 0.1);
  --glass-blur: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 40px rgba(30, 64, 175, 0.3);
  --shadow-card: 0 4px 24px rgba(30, 64, 175, 0.15);

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease-out;
  --transition-slow: 300ms ease-out;

  /* Z-Index Scale */
  --z-base: 0;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-fixed: 30;
  --z-modal-backdrop: 40;
  --z-modal: 50;
  --z-tooltip: 60;
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

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

body.dark-mode {
  color: var(--color-text-light);
  background: var(--color-bg-dark);
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

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

a:hover {
  color: var(--color-primary-light);
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
.font-display {
  font-family: var(--font-display);
}

.font-body {
  font-family: var(--font-body);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text-primary);
}

.dark-mode h1, .dark-mode h2, .dark-mode h3,
.dark-mode h4, .dark-mode h5, .dark-mode h6 {
  color: var(--color-text-light);
}

h1, .h1 {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2, .h2 {
  font-size: var(--text-3xl);
  font-weight: 600;
}

h3, .h3 {
  font-size: var(--text-2xl);
  font-weight: 600;
}

h4, .h4 {
  font-size: var(--text-xl);
  font-weight: 500;
}

.text-gradient {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted {
  color: var(--color-text-secondary);
}

.dark-mode .text-muted {
  color: var(--color-text-light-secondary);
}

/* ========================================
   LAYOUT UTILITIES
   ======================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.container-sm {
  max-width: 640px;
}

.container-lg {
  max-width: 1400px;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.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 {
  display: grid;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
  .md\:grid-cols-1 {
    grid-template-columns: 1fr;
  }
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================
   GLASS CARD COMPONENTS
   ======================================== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.glass-card-light {
  background: var(--glass-bg-light);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border-light);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.glass-card-light:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

/* ========================================
   TILE CARDS (Mobile Dashboard)
   ======================================== */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  padding: var(--space-4);
}

@media (min-width: 768px) {
  .tile-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tile-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--glass-bg-light);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--glass-border-light);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 140px;
  overflow: hidden;
}

.tile-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.tile-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.tile-card:hover::before {
  opacity: 1;
}

.tile-card:active {
  transform: scale(0.98);
}

.tile-card.tile-primary {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
}

.tile-card.tile-primary::before {
  background: rgba(255, 255, 255, 0.3);
}

.tile-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
}

.tile-card.tile-primary .tile-icon {
  background: rgba(255, 255, 255, 0.2);
}

.tile-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-primary);
  text-align: center;
}

.tile-card.tile-primary .tile-title {
  color: white;
}

.tile-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-align: center;
  margin-top: var(--space-1);
}

.tile-card.tile-primary .tile-subtitle {
  color: rgba(255, 255, 255, 0.8);
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  font-weight: 500;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-base);
  border: none;
  text-decoration: none;
}

.btn:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  box-shadow: var(--shadow-md), 0 4px 14px rgba(30, 64, 175, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 6px 20px rgba(30, 64, 175, 0.5);
  filter: brightness(1.05);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-primary);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-primary);
}

.btn-ghost:hover {
  background: rgba(30, 64, 175, 0.1);
}

.dark-mode .btn-ghost {
  color: var(--color-text-light);
}

.dark-mode .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-lg);
}

/* ========================================
   NAVIGATION
   ======================================== */
.navbar {
  position: fixed;
  top: var(--space-4);
  left: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-fixed);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  background: var(--glass-bg-light);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border-light);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
}

.dark-mode .navbar {
  background: var(--glass-bg);
  border-color: var(--glass-border);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.navbar-logo {
  height: 36px;
  width: auto;
}

.navbar-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-primary);
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.nav-link:hover {
  background: rgba(30, 64, 175, 0.1);
  color: var(--color-primary);
}

.dark-mode .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-light);
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-fixed);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: var(--space-2) var(--space-4);
  padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom));
  background: var(--glass-bg-light);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-top: 1px solid var(--glass-border-light);
}

.dark-mode .bottom-nav {
  background: var(--glass-bg);
  border-color: var(--glass-border);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--color-primary);
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
}

/* ========================================
   FORMS & INPUTS
   ======================================== */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-primary);
}

.dark-mode .form-label {
  color: var(--color-text-light);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background: white;
  border: 2px solid var(--color-bg-light-secondary);
  border-radius: var(--radius-xl);
  transition: all var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.dark-mode .form-input {
  color: var(--color-text-light);
  background: var(--color-bg-dark-secondary);
  border-color: var(--glass-border);
}

/* ========================================
   STATS & METRICS CARDS
   ======================================== */
.stat-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  background: white;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-bg-light-secondary);
  transition: all var(--transition-base);
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1;
}

.stat-change {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  font-size: var(--text-sm);
}

.stat-change.positive {
  color: var(--color-success);
}

.stat-change.negative {
  color: var(--color-error);
}

/* ========================================
   DATA TABLES
   ======================================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-bg-light-secondary);
}

.data-table th {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-bg-light-secondary);
}

.data-table tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(30, 64, 175, 0.05);
}

.dark-mode .data-table th,
.dark-mode .data-table td {
  border-color: var(--glass-border);
}

.dark-mode .data-table th {
  color: var(--color-text-light-secondary);
  background: var(--color-bg-dark-secondary);
}

.dark-mode .data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* ========================================
   BADGES & TAGS
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--color-bg-light-secondary);
  color: var(--color-text-secondary);
}

.badge-primary {
  background: rgba(30, 64, 175, 0.1);
  color: var(--color-primary);
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
}

.badge-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
}

/* ========================================
   WALLET PASS STYLES
   ======================================== */
.wallet-pass {
  position: relative;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1.586;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: var(--radius-2xl);
  padding: var(--space-5);
  color: white;
  box-shadow: var(--shadow-xl), var(--shadow-glow);
  overflow: hidden;
}

.wallet-pass::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.wallet-pass-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-6);
}

.wallet-pass-logo {
  height: 32px;
  width: auto;
}

.wallet-pass-type {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.8;
}

.wallet-pass-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.wallet-pass-points {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.wallet-pass-points-value {
  font-size: var(--text-4xl);
  font-weight: 700;
  line-height: 1;
}

.wallet-pass-points-label {
  font-size: var(--text-sm);
  opacity: 0.8;
}

.wallet-pass-barcode {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: white;
  border-radius: var(--radius-lg);
  color: var(--color-text-primary);
}

.wallet-pass-barcode svg {
  height: 40px;
}

.wallet-pass-barcode-number {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.1em;
}

.wallet-pass-footer {
  position: absolute;
  bottom: var(--space-4);
  left: var(--space-5);
  right: var(--space-5);
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  opacity: 0.7;
}

/* ========================================
   SIDEBAR (Back-Office)
   ======================================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: white;
  border-right: 1px solid var(--color-bg-light-secondary);
  padding: var(--space-6);
  z-index: var(--z-sticky);
  display: flex;
  flex-direction: column;
}

.dark-mode .sidebar {
  background: var(--color-bg-dark);
  border-color: var(--glass-border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.sidebar-brand img {
  height: 40px;
}

.sidebar-brand span {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-primary);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--color-text-secondary);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  font-weight: 500;
}

.sidebar-link:hover {
  background: rgba(30, 64, 175, 0.1);
  color: var(--color-primary);
}

.sidebar-link.active {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
}

.dark-mode .sidebar-link {
  color: var(--color-text-light-secondary);
}

.dark-mode .sidebar-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-light);
}

/* Main Content with Sidebar */
.main-content {
  margin-left: 260px;
  min-height: 100vh;
  padding: var(--space-6);
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }
}

/* ========================================
   CHARTS PLACEHOLDER
   ======================================== */
.chart-container {
  position: relative;
  width: 100%;
  height: 300px;
  background: var(--color-bg-light-secondary);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 100%;
  padding: var(--space-4);
}

.chart-bar {
  width: 12%;
  background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height var(--transition-slow);
}

/* ========================================
   MODALS
   ======================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal-backdrop);
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  z-index: var(--z-modal);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  background: white;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  overflow: auto;
}

.modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-bg-light-secondary);
}

.modal-body {
  padding: var(--space-5);
}

.modal-footer {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-5);
  border-top: 1px solid var(--color-bg-light-secondary);
  justify-content: flex-end;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-tooltip);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  transform: translateX(120%);
  transition: transform var(--transition-base);
}

.toast.show {
  transform: translateX(0);
}

.toast-success {
  border-left: 4px solid var(--color-success);
}

.toast-error {
  border-left: 4px solid var(--color-error);
}

.toast-warning {
  border-left: 4px solid var(--color-warning);
}

.toast-info {
  border-left: 4px solid var(--color-info);
}

.toast-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-icon svg {
  width: 20px;
  height: 20px;
}

.toast-success .toast-icon {
  color: var(--color-success);
}

.toast-error .toast-icon {
  color: var(--color-error);
}

.toast-warning .toast-icon {
  color: var(--color-warning);
}

.toast-info .toast-icon {
  color: var(--color-info);
}

.toast-message {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  line-height: 1.4;
  flex: 1;
}

.toast-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
  margin-left: var(--space-2);
}

.toast-close:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

/* ========================================
   LOADING STATES
   ======================================== */
.skeleton {
  background: linear-gradient(90deg,
    var(--color-bg-light-secondary) 25%,
    var(--color-bg-light) 50%,
    var(--color-bg-light-secondary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
}

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

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-bg-light-secondary);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========================================
   PAGE TRANSITIONS
   ======================================== */
.page {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.page.active {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden {
  display: none !important;
}

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

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

.w-full {
  width: 100%;
}

.min-h-screen {
  min-height: 100vh;
}

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }

.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }

.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Points animation */
.points-pulse {
  animation: points-pulse 2s ease-in-out infinite;
}

@keyframes points-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Success checkmark animation */
.checkmark {
  stroke: var(--color-success);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: checkmark-draw 0.5s ease forwards;
}

@keyframes checkmark-draw {
  to {
    stroke-dashoffset: 0;
  }
}
