/* ════════════════════════════════════════════════════════════════
   QABASIA — Main Stylesheet
   Brand: White-first, Outfit font, #E2670C accent
   ════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ───────────────────────────────────────────── */
:root {
  --white: #FFFFFF;
  --mist: #F5F5F7;
  --sky: #E2670C;
  --sky-hover: #C2560A;
  --graphite: #1D1D1F;
  --stone: #86868B;
  --border: #E5E5E7;
  --danger: #FF3B30;
  --success: #34C759;
  --warning: #FF9500;

  --font-family: 'Outfit', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --transition: 0.2s ease;
}

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

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

body {
  font-family: var(--font-family);
  background: var(--white);
  color: var(--graphite);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--sky);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--sky-hover); }

img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* ── Typography ──────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family);
  font-weight: 700;
  color: var(--graphite);
  line-height: 1.2;
}

h1 { font-size: 2.25rem; letter-spacing: -0.01em; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }

p { color: var(--stone); line-height: 1.7; }

.overline {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--sky);
}

.text-stone { color: var(--stone); }
.text-graphite { color: var(--graphite); }
.text-sky { color: var(--sky); }

/* ── Layout ──────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }

/* ── Navigation ──────────────────────────────────────────────── */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nav-brand-text {
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 3px;
  color: var(--graphite);
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
}

.nav-links a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--stone);
  letter-spacing: 0.3px;
  transition: color var(--transition);
  padding: 4px 0;
}

.nav-links a:hover,
.nav-links a.active { color: var(--graphite); }

.nav-actions { display: flex; align-items: center; gap: 12px; }

.nav-cart {
  position: relative;
  color: var(--graphite);
  padding: 8px;
}

.nav-cart-badge {
  position: absolute;
  top: 2px;
  right: 0;
  background: var(--sky);
  color: var(--white);
  font-size: 0.6rem;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile nav toggle */
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  font-family: var(--font-family);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1;
}

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

.btn-secondary {
  background: var(--graphite);
  color: var(--white);
}
.btn-secondary:hover { background: #333; color: var(--white); }

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

.btn-sm { padding: 8px 18px; font-size: 0.75rem; }
.btn-lg { padding: 16px 36px; font-size: 0.9375rem; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}

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

.card-body { padding: 20px; }
.card-title { font-size: 1.0625rem; font-weight: 600; margin-bottom: 6px; }
.card-meta { font-size: 0.75rem; color: var(--stone); margin-bottom: 12px; }

.card-surface {
  background: var(--mist);
  border: none;
}

.card-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--mist);
}

/* ── Hero Section ────────────────────────────────────────────── */
.hero {
  padding: 80px 24px;
  text-align: center;
  background: var(--white);
}

.hero .overline { margin-bottom: 12px; }
.hero h1 { margin-bottom: 16px; }
.hero p { max-width: 480px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Continue learning hero card */
.hero-continue {
  background: var(--mist);
  border-radius: var(--radius-md);
  padding: 24px;
  max-width: 500px;
  margin: 40px auto 0;
  text-align: left;
}

.hero-continue h4 { margin-bottom: 4px; }
.hero-continue .progress-label { font-size: 0.75rem; color: var(--stone); margin-bottom: 8px; }

/* ── Progress Bar ────────────────────────────────────────────── */
.progress-bar {
  background: var(--border);
  border-radius: 4px;
  height: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  background: var(--sky);
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ── Course Grid ─────────────────────────────────────────────── */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.course-card .card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--sky);
  color: var(--white);
  font-size: 0.625rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.course-card .card-thumbnail-wrapper {
  position: relative;
}

.course-price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--graphite);
}

.course-format {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--stone);
  background: var(--mist);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

/* ── Filters ─────────────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--stone);
  background: var(--mist);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.filter-btn:hover,
.filter-btn.active {
  color: var(--graphite);
  border-color: var(--border);
  background: var(--white);
}

/* ── Section spacing ─────────────────────────────────────────── */
.section {
  padding: 60px 0;
}

.section-border {
  border-top: 1px solid var(--border);
}

.section-header {
  margin-bottom: 32px;
}

.section-header .overline { margin-bottom: 6px; }
.section-header h2 { margin-bottom: 8px; }

/* ── Seat Urgency ────────────────────────────────────────────── */
.urgency-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--danger);
}

.urgency-dot {
  width: 6px;
  height: 6px;
  background: var(--danger);
  border-radius: 50%;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Forms ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--graphite);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.875rem;
  color: var(--graphite);
  background: var(--white);
  transition: border-color var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.1);
}

.form-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 4px;
}

/* ── Alerts / Messages ───────────────────────────────────────── */
.alert {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-bottom: 16px;
}

.alert-success { background: #E8F8EE; color: #1B7A3D; border: 1px solid #C6F0D4; }
.alert-error { background: #FDE8E8; color: #C0392B; border: 1px solid #F5C6C6; }
.alert-warning { background: #FFF3E0; color: #E65100; border: 1px solid #FFE0B2; }
.alert-info { background: #E8F0FE; color: #1565C0; border: 1px solid #BBDEFB; }

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  background: var(--graphite);
  color: rgba(255,255,255,0.6);
  padding: 48px 24px 24px;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-brand .nav-brand-text { color: var(--white); }
.footer-brand p { color: rgba(255,255,255,0.4); font-size: 0.8125rem; margin-top: 8px; }

.footer h4 {
  color: var(--white);
  font-size: 0.75rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.footer a {
  color: rgba(255,255,255,0.5);
  font-size: 0.8125rem;
  display: block;
  margin-bottom: 8px;
}
.footer a:hover { color: var(--white); }

.footer-bottom {
  max-width: 1200px;
  margin: 32px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  text-align: center;
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.25);
  letter-spacing: 1px;
}

/* ── Dashboard ───────────────────────────────────────────────── */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--mist);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--graphite);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--stone);
  margin-top: 4px;
}

/* ── Cart & Checkout ─────────────────────────────────────────── */
.cart-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.cart-item-info { flex: 1; }
.cart-item-price { font-weight: 600; font-size: 1rem; }
.cart-item-remove {
  color: var(--danger);
  font-size: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  padding: 20px 0;
  font-size: 1.125rem;
  font-weight: 700;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.375rem; }

  .nav-links { display: none; }
  .nav-toggle { display: block; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .course-grid { grid-template-columns: 1fr; }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }

  .hero { padding: 48px 24px; }
  .hero-actions { flex-direction: column; align-items: center; }
}

@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
}

/* ── RTL Support ─────────────────────────────────────────────── */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .nav-links { direction: rtl; }
[dir="rtl"] .card-badge { left: auto; right: 12px; }
[dir="rtl"] .nav-cart-badge { right: auto; left: 0; }
