/* ============================================================
   FILE: 01-style.css
   Universal Tournament Qualification & Scenario Predictor
   Global Base Styles & Design Tokens
   ============================================================ */

:root {
  /* Brand Colors */
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --secondary: #10b981;
  --secondary-light: #34d399;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-light: #fca5a5;

  /* Backgrounds */
  --bg-base: #0f172a;
  --bg-surface: #1e293b;
  --bg-elevated: #263348;
  --bg-glass: rgba(30, 41, 59, 0.7);

  /* Borders */
  --border: rgba(255, 255, 255, 0.08);
  --border-active: rgba(37, 99, 235, 0.5);

  /* Text */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #38bdf8;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #2563eb, #10b981);
  --gradient-card: linear-gradient(145deg, #1e293b, #263348);
  --gradient-danger: linear-gradient(135deg, #ef4444, #b91c1c);
  --gradient-warning: linear-gradient(135deg, #f59e0b, #d97706);

  /* Glassmorphism */
  --glass-bg: rgba(30, 41, 59, 0.6);
  --glass-blur: blur(16px);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);

  /* Elevation Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow-blue: 0 0 20px rgba(37, 99, 235, 0.4);
  --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.4);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Typography */
  --font-sans: 'Inter', 'Poppins', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --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;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-surface);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: var(--radius-pill);
  border: 3px solid var(--bg-surface);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* Text Selection */
::selection {
  background: var(--primary);
  color: white;
}

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

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

a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Utility Classes */
.text-primary {
  color: var(--text-primary);
}

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

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

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

.text-accent {
  color: var(--text-accent);
}

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

/* Badge Styles */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid var(--border);
}

.badge--primary {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-light);
  border-color: rgba(37, 99, 235, 0.3);
}

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

.badge--danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-light);
  border-color: rgba(239, 68, 68, 0.3);
}

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

/* Divider */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: var(--space-lg) 0;
}

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

.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

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

/* Print Styles */
@media print {
  .sidebar,
  .sidebar-toggle,
  .btn,
  form {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .main-panel {
    margin-left: 0;
    max-width: 100%;
  }

  table {
    border-collapse: collapse;
  }

  thead {
    display: table-header-group;
  }

  tbody {
    page-break-inside: avoid;
  }
}
