/* TrustyBooker Design System - Premium Theme Tokens */
/* Single source of truth for all design tokens */
/* Version 2.0 - Premium Polish Update */

:root {
  /* ===== LIGHT MODE (Default) ===== */
  
  /* Base Colors */
  --bg: #F8FAFC;
  --bg-dim: #F1F5F9;
  --bg-elevated: #FFFFFF;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #FFFFFF;
  --panel-2: #F8FAFC;
  --panel-glass: rgba(255, 255, 255, 0.88);
  
  /* Text & Content */
  --text: #1E293B;
  --text-bright: #0F172A;
  --muted: #64748B;
  --muted-dark: #475569;
  
  /* Primary Palette - Blue */
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-600: #1D4ED8;
  --primary-700: #1E40AF;
  --primary-800: #1E3A8A;
  --primary-glow: rgba(37, 99, 235, 0.12);
  
  /* Accent Palette - Teal */
  --accent: #0D9488;
  --accent-hover: #0F766E;
  --accent-600: #0F766E;
  --accent-700: #115E59;
  --accent-800: #134E4A;
  --accent-glow: rgba(13, 148, 136, 0.12);
  
  /* Status Colors */
  --success: #10B981;
  --success-hover: #059669;
  --success-glow: rgba(16, 185, 129, 0.2);
  --danger: #EF4444;
  --danger-hover: #DC2626;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --warn: #F59E0B;
  --warn-hover: #D97706;
  --warn-glow: rgba(245, 158, 11, 0.2);
  --info: #3B82F6;
  --info-hover: #2563EB;
  --info-glow: rgba(59, 130, 246, 0.2);
  
  /* Borders & Dividers */
  --border: rgba(0,0,0,.08);
  --border-focus: rgba(37, 99, 235, 0.35);
  --border-hover: rgba(0,0,0,.12);
  
  /* Shadows & Elevation */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.1);
  --shadow-xl: 0 16px 40px rgba(0,0,0,.12);
  --glow-primary: 0 0 32px var(--primary-glow);
  --glow-accent: 0 0 32px var(--accent-glow);
  
  /* Glass Effects */
  --glass-blur: blur(20px);
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(0, 0, 0, 0.08);
  
  /* Spacing Scale (4px base) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Typography Scale */
  --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;
  
  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  
  /* Legacy support */
  --link: #2563EB;
  --card: var(--panel-solid);
}

/* ===== DARK MODE ===== */
[data-theme="dark"],
body[data-theme="dark"] {
  --bg: #1A2535;
  --bg-dim: #1F2A40;
  --bg-elevated: #243045;
  --panel: rgba(30, 40, 60, 0.75);
  --panel-solid: #1E2840;
  --panel-2: #1A2235;
  --panel-glass: rgba(25, 35, 55, 0.6);
  
  --text: #E7ECF5;
  --text-bright: #F5F7FA;
  --muted: #A7B2C7;
  --muted-dark: #7A8599;
  
  --primary: #3B82F6;
  --primary-hover: #60A5FA;
  --primary-600: #2563EB;
  --primary-700: #1D4ED8;
  --primary-800: #1E40AF;
  --primary-glow: rgba(59, 130, 246, 0.25);
  
  --accent: #11C5A1;
  --accent-hover: #34D9B6;
  --accent-600: #0FB594;
  --accent-700: #0DA98B;
  --accent-800: #0A8A74;
  --accent-glow: rgba(17, 197, 161, 0.25);
  
  --border: rgba(255,255,255,.08);
  --border-focus: rgba(59, 130, 246, 0.4);
  --border-hover: rgba(255,255,255,.15);
  
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
  --shadow: 0 8px 24px rgba(0,0,0,.3);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.4);
  --shadow-xl: 0 24px 60px rgba(11,15,26,.45);
  
  --glass-bg: rgba(25, 35, 55, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
  
  --link: #9ABEFF;
  --card: var(--panel-solid);
}

/* ===== BUTTON SYSTEM ===== */

/* Base Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

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

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Button Sizes */
.btn-sm {
  height: 36px;
  padding: 0 var(--space-md);
  font-size: var(--text-sm);
}

.btn-md, .btn {
  height: 44px;
  padding: 0 var(--space-lg);
  font-size: var(--text-base);
}

.btn-lg {
  height: 52px;
  padding: 0 var(--space-xl);
  font-size: var(--text-lg);
}

/* Button Variants */
.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow);
}

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-accent:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: var(--shadow);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: var(--success-hover);
  box-shadow: var(--shadow);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
  box-shadow: var(--shadow);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-dim);
  border-color: var(--border-hover);
}

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

.btn-outline:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

/* ===== CARD SYSTEM ===== */

.card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-elevated {
  box-shadow: var(--shadow);
}

.card-elevated:hover {
  box-shadow: var(--shadow-lg);
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
}

.card-body {
  color: var(--text);
}

.card-footer {
  padding-top: var(--space-md);
  margin-top: var(--space-md);
  border-top: 1px solid var(--border);
}

/* ===== INPUT SYSTEM ===== */

.input, input[type="text"], input[type="email"], input[type="password"], 
input[type="number"], input[type="tel"], input[type="date"], 
input[type="url"], textarea, select {
  height: 44px;
  padding: 0 var(--space-md);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
}

textarea {
  height: auto;
  min-height: 100px;
  padding: var(--space-md);
  resize: vertical;
}

.input:focus, input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input:hover:not(:focus), input:hover:not(:focus), 
textarea:hover:not(:focus), select:hover:not(:focus) {
  border-color: var(--border-hover);
}

.input-error, .input.error, input.error {
  border-color: var(--danger);
}

.input-error:focus, .input.error:focus, input.error:focus {
  box-shadow: 0 0 0 3px var(--danger-glow);
}

.input-success, .input.success, input.success {
  border-color: var(--success);
}

.input-success:focus, .input.success:focus, input.success:focus {
  box-shadow: 0 0 0 3px var(--success-glow);
}

.input-lg {
  height: 52px;
  font-size: var(--text-lg);
}

/* ===== BADGE/CHIP SYSTEM ===== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-primary {
  background: var(--primary-glow);
  color: var(--primary);
}

.badge-accent {
  background: var(--accent-glow);
  color: var(--accent);
}

.badge-success {
  background: var(--success-glow);
  color: var(--success);
}

.badge-warning {
  background: var(--warn-glow);
  color: var(--warn);
}

.badge-danger {
  background: var(--danger-glow);
  color: var(--danger);
}

.badge-muted {
  background: rgba(100, 116, 139, 0.15);
  color: var(--muted);
}

/* ===== TABLE SYSTEM ===== */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th {
  background: var(--bg-dim);
  color: var(--muted-dark);
  font-weight: 600;
  text-align: left;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg-dim);
}

/* ===== UTILITY CLASSES ===== */

.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-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }

.text-muted { color: var(--muted); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warn); }
.text-danger { color: var(--danger); }

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

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

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* ===== EMPTY STATE ===== */

.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.6;
}

.empty-state-title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-sm);
}

.empty-state-description {
  font-size: var(--text-base);
  color: var(--muted);
  max-width: 400px;
  margin: 0 auto var(--space-lg);
}

/* ===== MODAL/DIALOG ===== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.modal {
  background: var(--panel-solid);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-dim);
  color: var(--text);
}

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

.modal-footer {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  padding: var(--space-lg);
  border-top: 1px solid var(--border);
}

/* ===== LOADING STATES ===== */

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

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

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

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

/* ===== RESPONSIVE UTILITIES ===== */

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: block !important; }
  
  .btn-md, .btn {
    height: 48px;
    padding: 0 var(--space-md);
  }
  
  .card {
    padding: var(--space-md);
  }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
  .show-desktop { display: block !important; }
}

/* ===== ACCESSIBILITY ===== */

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

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--primary);
  color: white;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  z-index: 9999;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 16px;
}

/* Focus Visible */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --border: rgba(0,0,0,0.3);
    --text: #000000;
  }
  
  [data-theme="dark"] {
    --border: rgba(255,255,255,0.3);
    --text: #FFFFFF;
  }
}
