/**
 * EuroSoccer Academy - Typography System
 * Version: 2.0.0
 *
 * Font Stack:
 * - Display (Headlines): Sora - Geometric, bold, modern character
 * - Body (Text): DM Sans - Friendly, readable, professional
 * - Data (Numbers/Stats): Space Mono - Technical, precise, dashboard-ready
 *
 * Arabic Font Stack:
 * - Display: Tajawal - Modern, bold Arabic
 * - Body: Cairo - Readable, professional Arabic
 * - Data: IBM Plex Sans Arabic - Technical Arabic text
 */

/* ========================================
   Typography CSS Custom Properties
   ======================================== */
:root {
  /* === FONT FAMILIES === */

  /* English Fonts */
  --font-display: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Space Mono', 'SF Mono', 'Monaco', 'Inconsolata', monospace;

  /* Arabic Fonts (auto-applied via [lang="ar"]) */
  --font-display-ar: 'Tajawal', 'Cairo', sans-serif;
  --font-body-ar: 'Cairo', 'IBM Plex Sans Arabic', sans-serif;
  --font-mono-ar: 'IBM Plex Sans Arabic', 'Cairo', monospace;

  /* === TYPE SCALE === */
  /* Based on 1.25 ratio (Major Third) */
  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.25rem;      /* 20px */
  --text-2xl: 1.5rem;      /* 24px */
  --text-3xl: 1.875rem;    /* 30px */
  --text-4xl: 2.25rem;     /* 36px */
  --text-5xl: 3rem;        /* 48px */
  --text-6xl: 3.75rem;     /* 60px */
  --text-7xl: 4.5rem;      /* 72px */

  /* === FONT WEIGHTS === */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  /* === LINE HEIGHTS === */
  --leading-none: 1;
  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  /* === LETTER SPACING === */
  --tracking-tighter: -0.05em;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;

  /* === TYPOGRAPHY COLORS === */
  --text-primary: #0F172A;      /* Slate 900 - Headlines */
  --text-secondary: #334155;    /* Slate 700 - Body */
  --text-tertiary: #64748B;     /* Slate 500 - Captions */
  --text-muted: #94A3B8;        /* Slate 400 - Disabled */
  --text-inverse: #FFFFFF;      /* White - On dark */
  --text-accent: #1565C0;       /* Brand Blue - Links */
  --text-success: #059669;      /* Emerald 600 */
  --text-warning: #D97706;      /* Amber 600 */
  --text-danger: #DC2626;       /* Red 600 */
}

/* ========================================
   Base Typography Reset
   ======================================== */
*, *::before, *::after {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--text-secondary);
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

/* Arabic Language Override */
html[lang="ar"] body,
html[dir="rtl"] body {
  font-family: var(--font-body-ar);
  letter-spacing: 0; /* Arabic doesn't need letter-spacing */
}

/* ========================================
   Headings - Display Font
   ======================================== */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  margin-top: 0;
  margin-bottom: 0.5em;
}

/* Arabic Headings */
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3,
html[lang="ar"] h4, html[lang="ar"] h5, html[lang="ar"] h6,
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3,
html[dir="rtl"] h4, html[dir="rtl"] h5, html[dir="rtl"] h6 {
  font-family: var(--font-display-ar);
  letter-spacing: 0;
}

h1, .h1 {
  font-size: var(--text-4xl);
  font-weight: var(--weight-extrabold);
  letter-spacing: var(--tracking-tighter);
}

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

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

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

h5, .h5 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}

h6, .h6 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* ========================================
   Paragraph & Body Text
   ======================================== */
p {
  margin-top: 0;
  margin-bottom: 1em;
}

.lead {
  font-size: var(--text-lg);
  font-weight: var(--weight-normal);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

.text-small, small {
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
}

/* ========================================
   Data & Statistics - Mono Font
   ======================================== */
.stat-number,
.data-value,
.metric-value,
.price,
.currency,
.stat-card h3,
.stat-content h3,
.today-info h4 {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  font-feature-settings: 'tnum' 1, 'kern' 1; /* Tabular numbers */
}

/* Large stat numbers - hero treatment */
.stat-hero {
  font-family: var(--font-mono);
  font-size: var(--text-5xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-none);
  letter-spacing: var(--tracking-tighter);
}

/* Medium stat numbers */
.stat-number,
.stat-card h3,
.stat-content h3 {
  font-size: var(--text-4xl);
  line-height: var(--leading-none);
}

/* Small stat numbers */
.stat-small {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
}

/* Arabic Numbers */
html[lang="ar"] .stat-number,
html[lang="ar"] .data-value,
html[lang="ar"] .metric-value,
html[lang="ar"] .stat-card h3,
html[dir="rtl"] .stat-number,
html[dir="rtl"] .data-value {
  font-family: var(--font-mono-ar);
}

/* ========================================
   Labels & Captions
   ======================================== */
.label-text,
.caption,
.meta,
.stat-label,
.stat-card p,
.stat-content p {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-tertiary);
}

/* ========================================
   Navigation Typography
   ======================================== */
.nav-text,
.sidebar-menu-link,
.sidebar-menu-text {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
}

.nav-heading,
.sidebar-section-title {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--text-muted);
}

/* ========================================
   Button Typography
   ======================================== */
.btn {
  font-family: var(--font-body);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: none;
}

.btn-lg {
  font-size: var(--text-base);
}

.btn-sm {
  font-size: var(--text-xs);
}

.btn-xs {
  font-size: 0.6875rem; /* 11px */
  letter-spacing: var(--tracking-wider);
}

/* ========================================
   Form Typography
   ======================================== */
.form-control {
  font-family: var(--font-body);
  font-size: var(--text-sm);
}

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

label,
.control-label {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

/* ========================================
   Table Typography
   ======================================== */
.table {
  font-family: var(--font-body);
  font-size: var(--text-sm);
}

.table th {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.table td {
  font-weight: var(--weight-normal);
}

/* Numeric table data */
.table .numeric,
.table td[data-type="number"],
.table .amount,
.table .price,
.table .quantity {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1;
}

/* ========================================
   Badge & Tag Typography
   ======================================== */
.badge,
.label,
.tag {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

/* ========================================
   Panel & Card Typography
   ======================================== */
.panel-title,
.card-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  margin: 0;
}

.panel-heading-modern .panel-title {
  color: var(--text-inverse);
}

/* ========================================
   Modal Typography
   ======================================== */
.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
}

/* ========================================
   Page Header Typography
   ======================================== */
.page-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  margin: 0;
}

/* ========================================
   Welcome/Hero Typography
   ======================================== */
.dashboard-welcome h1,
.hero-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-extrabold);
  letter-spacing: var(--tracking-tighter);
  line-height: var(--leading-tight);
}

.dashboard-welcome p,
.hero-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  letter-spacing: var(--tracking-normal);
  opacity: 0.9;
}

/* ========================================
   Links Typography
   ======================================== */
a {
  color: var(--text-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #0D47A1;
  text-decoration: none;
}

.stat-link {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

/* ========================================
   Code & Technical Typography
   ======================================== */
code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

pre {
  line-height: var(--leading-relaxed);
}

/* ========================================
   Utility Classes
   ======================================== */
/* Font Family Utilities */
.font-display { font-family: var(--font-display) !important; }
.font-body { font-family: var(--font-body) !important; }
.font-mono { font-family: var(--font-mono) !important; }

/* Font Size Utilities */
.text-xs { font-size: var(--text-xs) !important; }
.text-sm { font-size: var(--text-sm) !important; }
.text-base { font-size: var(--text-base) !important; }
.text-lg { font-size: var(--text-lg) !important; }
.text-xl { font-size: var(--text-xl) !important; }
.text-2xl { font-size: var(--text-2xl) !important; }
.text-3xl { font-size: var(--text-3xl) !important; }
.text-4xl { font-size: var(--text-4xl) !important; }
.text-5xl { font-size: var(--text-5xl) !important; }

/* Font Weight Utilities */
.font-normal { font-weight: var(--weight-normal) !important; }
.font-medium { font-weight: var(--weight-medium) !important; }
.font-semibold { font-weight: var(--weight-semibold) !important; }
.font-bold { font-weight: var(--weight-bold) !important; }
.font-extrabold { font-weight: var(--weight-extrabold) !important; }

/* Line Height Utilities */
.leading-none { line-height: var(--leading-none) !important; }
.leading-tight { line-height: var(--leading-tight) !important; }
.leading-snug { line-height: var(--leading-snug) !important; }
.leading-normal { line-height: var(--leading-normal) !important; }
.leading-relaxed { line-height: var(--leading-relaxed) !important; }

/* Letter Spacing Utilities */
.tracking-tighter { letter-spacing: var(--tracking-tighter) !important; }
.tracking-tight { letter-spacing: var(--tracking-tight) !important; }
.tracking-normal { letter-spacing: var(--tracking-normal) !important; }
.tracking-wide { letter-spacing: var(--tracking-wide) !important; }
.tracking-wider { letter-spacing: var(--tracking-wider) !important; }
.tracking-widest { letter-spacing: var(--tracking-widest) !important; }

/* Text Transform Utilities */
.uppercase { text-transform: uppercase !important; }
.lowercase { text-transform: lowercase !important; }
.capitalize { text-transform: capitalize !important; }
.normal-case { text-transform: none !important; }

/* Text Alignment */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* Text Color Utilities */
.text-primary-color { color: var(--text-primary) !important; }
.text-secondary-color { color: var(--text-secondary) !important; }
.text-tertiary-color { color: var(--text-tertiary) !important; }
.text-muted-color { color: var(--text-muted) !important; }
.text-accent-color { color: var(--text-accent) !important; }

/* ========================================
   Responsive Typography
   ======================================== */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  h1, .h1 {
    font-size: var(--text-3xl);
  }

  h2, .h2 {
    font-size: var(--text-2xl);
  }

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

  .stat-number,
  .stat-card h3,
  .stat-content h3 {
    font-size: var(--text-3xl);
  }

  .dashboard-welcome h1 {
    font-size: var(--text-2xl);
  }

  .page-title {
    font-size: var(--text-xl);
  }
}

@media (max-width: 480px) {
  html {
    font-size: 13px;
  }

  .stat-number,
  .stat-card h3,
  .stat-content h3 {
    font-size: var(--text-2xl);
  }
}

/* ========================================
   Print Typography
   ======================================== */
@media print {
  body {
    font-size: 12pt;
    line-height: 1.4;
    color: #000;
  }

  h1, h2, h3, h4, h5, h6 {
    color: #000;
    page-break-after: avoid;
  }

  p, table, figure {
    orphans: 3;
    widows: 3;
  }
}
