/* ─── base.css ───────────────────────────────────────────────────────────────
   Design tokens, reset, typography, utility classes, shared UI primitives.
   All other CSS files import nothing from here — they rely on these CSS vars
   being available globally through the <link> load order in HTML.
   ─────────────────────────────────────────────────────────────────────────── */

/* ─── Design tokens ──────────────────────────────────────────────────────────*/
:root {
  --bg:         #050508;
  --surface:    #0d0d14;
  --surface2:   #13131f;
  --accent:     #7c5cfc;
  --accent-dim: rgba(124, 92, 252, 0.15);
  --accent2:    #00e5b0;
  --text:       #e8e8f0;
  --text-muted: #6b6b8a;
  --border:     rgba(255, 255, 255, 0.08);
  --glass:      rgba(255, 255, 255, 0.03);
  --radius:     12px;
  --radius-lg:  20px;
  --shadow:     0 8px 32px rgba(0, 0, 0, 0.5);
  --nav-h:      64px;
}

/* ─── Reset ──────────────────────────────────────────────────────────────────*/
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { scroll-behavior: smooth; font-size: 16px; }
body  {
  background:   var(--bg);
  color:        var(--text);
  font-family:  'Inter', sans-serif;
  line-height:  1.65;
  overflow-x:   hidden;
  -webkit-font-smoothing: antialiased;
}
[dir="rtl"] body { font-family: 'Noto Naskh Arabic', 'Inter', sans-serif; }
.rtl-font      { font-family: 'Noto Naskh Arabic', 'Inter', sans-serif; }

a              { color: inherit; text-decoration: none; }
ul, ol         { list-style: none; }
img            { max-width: 100%; display: block; }
button         { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ─── Typography ─────────────────────────────────────────────────────────────*/
h1 { font-size: clamp(2rem,   5vw, 3.5rem);  font-weight: 800; line-height: 1.15; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 700; line-height: 1.25; }
h3 { font-size: clamp(1rem,   2vw, 1.35rem); font-weight: 600; line-height: 1.35; }
p  { color: var(--text-muted); line-height: 1.7; }

.gradient-text {
  background:             linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip:         text;
}
.accent  { color: var(--accent);  }
.accent2 { color: var(--accent2); }

/* ─── Layout ─────────────────────────────────────────────────────────────────*/
.container {
  width:     100%;
  max-width: 1200px;
  margin:    0 auto;
  padding:   0 1.5rem;
}

section { padding: 5rem 0; }

.section-header {
  text-align:    center;
  margin-bottom: 3rem;
}
.section-header p {
  margin-top:   0.75rem;
  font-size:    1.05rem;
  max-width:    580px;
  margin-left:  auto;
  margin-right: auto;
}
.section-badge {
  display:        inline-block;
  background:     var(--accent-dim);
  color:          var(--accent);
  border:         1px solid rgba(124, 92, 252, 0.3);
  padding:        0.25rem 0.85rem;
  border-radius:  50px;
  font-size:      0.78rem;
  font-weight:    600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom:  0.65rem;
}

/* ─── Scroll reveal ──────────────────────────────────────────────────────────*/
.reveal {
  opacity:    0;
  transform:  translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* stagger children */
.reveal-stagger > * { transition-delay: calc(var(--i, 0) * 80ms); }

/* ─── Buttons ────────────────────────────────────────────────────────────────*/
.btn {
  display:        inline-flex;
  align-items:    center;
  justify-content:center;
  gap:            0.45rem;
  padding:        0.72rem 1.6rem;
  border-radius:  50px;
  font-weight:    600;
  font-size:      0.93rem;
  transition:     transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
  white-space:    nowrap;
  line-height:    1;
}
.btn-primary {
  background:  linear-gradient(135deg, var(--accent), #9b7dff);
  color:       #fff;
  box-shadow:  0 4px 20px rgba(124, 92, 252, 0.35);
}
.btn-primary:hover {
  transform:   translateY(-2px);
  box-shadow:  0 8px 30px rgba(124, 92, 252, 0.55);
}
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  border:     1.5px solid var(--border);
  color:      var(--text);
  background: var(--glass);
  backdrop-filter: blur(10px);
}
.btn-outline:hover {
  border-color: var(--accent);
  color:        var(--accent);
  transform:    translateY(-2px);
}
.btn-accent2 {
  background:  linear-gradient(135deg, var(--accent2), #00c49a);
  color:       #050508;
  font-weight: 700;
  box-shadow:  0 4px 20px rgba(0, 229, 176, 0.35);
}
.btn-accent2:hover {
  transform:  translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 229, 176, 0.55);
}
.btn:disabled {
  opacity: 0.55;
  cursor:  not-allowed;
  transform: none !important;
}

/* ─── Glass card ─────────────────────────────────────────────────────────────*/
.glass-card {
  background:       var(--glass);
  border:           1px solid var(--border);
  border-radius:    var(--radius);
  backdrop-filter:  blur(10px);
  transition:       transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.glass-card:hover {
  transform:    translateY(-4px);
  border-color: rgba(124, 92, 252, 0.3);
  box-shadow:   0 12px 40px rgba(124, 92, 252, 0.1);
}

/* ─── Form elements ──────────────────────────────────────────────────────────*/
.form-group  { display: flex; flex-direction: column; gap: 0.4rem; }
.form-label  { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.form-input  {
  background:  rgba(255, 255, 255, 0.04);
  border:      1px solid var(--border);
  border-radius: var(--radius);
  padding:     0.72rem 1rem;
  color:       var(--text);
  font-size:   0.94rem;
  width:       100%;
  transition:  border-color 0.22s ease, background 0.22s ease;
}
.form-input:focus {
  outline:     none;
  border-color: var(--accent);
  background:  rgba(124, 92, 252, 0.06);
}
.form-input::placeholder { color: var(--text-muted); }
select.form-input { cursor: pointer; }
select.form-input option { background: var(--surface); }

/* ─── Modal overlay ──────────────────────────────────────────────────────────*/
.modal-overlay {
  display:         none;
  position:        fixed;
  inset:           0;
  background:      rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  z-index:         9000;
  align-items:     center;
  justify-content: center;
  padding:         1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background:   var(--surface);
  border:       1px solid var(--border);
  border-radius: var(--radius-lg);
  padding:      2rem;
  max-width:    480px;
  width:        100%;
  position:     relative;
  max-height:   90vh;
  overflow-y:   auto;
}
.modal-close {
  position:     absolute;
  top:          1rem;
  right:        1rem;
  color:        var(--text-muted);
  font-size:    1.2rem;
  padding:      0.3rem 0.55rem;
  border-radius: 8px;
  transition:   color 0.2s, background 0.2s;
  line-height:  1;
}
.modal-close:hover { color: var(--text); background: var(--glass); }

/* ─── Scrollbar ──────────────────────────────────────────────────────────────*/
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* ─── Utilities ──────────────────────────────────────────────────────────────*/
.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); }
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.grid-2       { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3       { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4       { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; } .gap-3 { gap: 1.5rem; }
.mt-2  { margin-top: 1rem;  } .mt-3 { margin-top: 1.5rem; }
.mb-2  { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.pt-0  { padding-top: 0; }

/* ─── Responsive ─────────────────────────────────────────────────────────────*/
@media (max-width: 768px) {
  section    { padding: 3.5rem 0; }
  .grid-3    { grid-template-columns: repeat(2, 1fr); }
  .grid-4    { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: clamp(1.8rem, 7vw, 2.6rem); }
  h2 { font-size: clamp(1.35rem, 5vw, 1.9rem); }
  .section-header { margin-bottom: 2rem; }
  .section-header p { font-size: 0.95rem; }
}
@media (max-width: 480px) {
  section    { padding: 2.5rem 0; }
  .container { padding: 0 0.9rem; }
  .btn       { padding: 0.7rem 1.3rem; font-size: 0.9rem; min-height: 44px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  h1 { font-size: clamp(1.65rem, 8vw, 2.2rem); }
  h2 { font-size: clamp(1.25rem, 6vw, 1.7rem); }
}

/* ─── Mobile touch targets ───────────────────────────────────────────────────*/
@media (max-width: 768px) {
  a, button { min-height: 44px; min-width: 44px; }
  .section-badge { font-size: 0.72rem; }

  /* Modal full-screen on mobile */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-box {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-width:     100%;
    max-height:    92vh;
    padding:       1.5rem 1.25rem;
  }
}

/* ─── Smooth momentum scrolling on iOS ──────────────────────────────────────*/
@media (max-width: 768px) {
  .categories-row,
  .epg-slots {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
}
