/* =========================================================
   Home page – Taim Sukkar
   Uses the tokens from theme.css (--ts-*).
   ========================================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* old variable names kept for shared snippets (liveBanner, bottom nav) */
:root {
  --bg: var(--ts-bg);
  --text: var(--ts-ink);
  --muted: var(--ts-muted);
  --card-bg: var(--ts-surface);
  --border: var(--ts-line);
  --accent: var(--ts-primary);
  --purple: var(--ts-primary);
  --green: var(--ts-primary-light);
  --shadow: rgba(17, 24, 39, 0.08);
}
body.page-dark-mode { --bg: var(--ts-bg); --text: var(--ts-ink); --card-bg: var(--ts-surface); --border: var(--ts-line); --shadow: rgba(0, 0, 0, 0.45); }

html { scroll-behavior: smooth; }
body {
  font-family: var(--ts-font);
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
  min-height: 100vh;
  background: var(--ts-bg);
  color: var(--ts-ink);
  transition: background 0.3s, color 0.3s;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
.hidden { display: none !important; }

/* ---------- notification + buy popup ---------- */
.notifi {
  position: fixed;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  max-width: calc(100% - 32px);
  min-height: 56px;
  padding: 14px 22px;
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
  z-index: 200;
}
.show-notifi { animation: notifiIn 0.6s ease-out forwards; }
.hide-notifi { animation: notifiOut 0.6s ease-in forwards; }
.notifi-message { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.6; text-align: center; }
.notifi.green { background: linear-gradient(135deg, var(--ts-primary-light), var(--ts-primary)); }
.notifi.red { background: linear-gradient(135deg, #ef4444, #dc2626); }
@keyframes notifiIn { from { top: -150px; } to { top: 18px; } }
@keyframes notifiOut { from { top: 18px; } to { top: -150px; } }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 110;
}
.popup-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(360px, calc(100% - 32px));
  padding: 32px 28px 26px;
  border-radius: var(--ts-radius-lg);
  background: var(--ts-surface);
  color: var(--ts-ink);
  text-align: center;
  box-shadow: 0 24px 60px rgba(2, 60, 64, 0.28);
  animation: popupIn 0.25s cubic-bezier(.2, .9, .3, 1.2);
}
.popup-message h2 { font-size: 19px; line-height: 1.6; }
.popup-message .buttons { display: flex; gap: 12px; margin-top: 22px; }
.popup-message .buttons button {
  flex: 1;
  padding: 12px 0;
  border: none;
  border-radius: var(--ts-radius);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.popup-message .confirm-btn { background: var(--ts-primary); color: #fff; }
.popup-message .confirm-btn:hover { background: var(--ts-primary-dark); }
.popup-message .cancel-btn { background: var(--ts-surface-2); color: var(--ts-ink); }
@keyframes popupIn {
  from { opacity: 0; transform: translate(-50%, -46%) scale(.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ---------- floating header ---------- */
.navbar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1480px, calc(100% - 40px));
  z-index: 100;
  background: var(--ts-surface-2);
  border-radius: var(--ts-radius);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.1);
}
body.page-dark-mode .navbar { background: #0f1623; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.navbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.logo-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--ts-primary), var(--ts-primary-light));
  color: #fff;
  font-family: var(--ts-font-head);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 1px;
  transform: rotate(-6deg);
}
.logo-words { display: flex; flex-direction: column; line-height: 1.25; }
.logo-text { font-weight: 800; font-size: 17px; color: var(--ts-ink); }
.logo-sub { font-size: 12px; color: var(--ts-muted); }

.nav-links { display: flex; align-items: center; gap: 4px; margin-inline-start: 12px; }
.nav-links a {
  padding: 8px 14px;
  border-radius: 10px;
  font-family: 'Almarai', var(--ts-font);
  font-size: 15px;
  font-weight: 700;
  color: var(--ts-muted);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover { color: var(--ts-primary); }
.nav-links a.active { color: var(--ts-primary); background: var(--ts-primary-tint); }
.nav-links a.nav-dashboard-link { color: var(--ts-accent); }

.nav-actions { display: flex; align-items: center; gap: 12px; margin-inline-start: auto; }
.nav-actions .ts-btn { padding: 9px 26px; }
.balance-container {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--ts-primary-tint);
  color: var(--ts-primary);
  font-weight: 800;
}
.balance-label { font-size: 12px; opacity: 0.8; }
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--ts-ink);
  cursor: pointer;
  padding: 4px;
}
.nav-progress { height: 4px; margin: 0 2px; border-radius: 0 0 var(--ts-radius) var(--ts-radius); background: #a5f3f5; overflow: hidden; }
body.page-dark-mode .nav-progress { background: #12333a; }
.nav-progress span { display: block; height: 100%; width: 0; background: var(--ts-primary); transition: width 0.1s linear; }

.mobile-menu {
  display: none;
  padding: 8px 16px 16px;
  border-top: 1px solid var(--ts-line);
}
.mobile-menu a {
  display: block;
  padding: 12px 8px;
  font-weight: 700;
  color: var(--ts-ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ts-line);
  cursor: pointer;
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a.active { color: var(--ts-primary); }

/* ---------- sections ---------- */
.section { padding: 90px 20px; }
.section-inner { max-width: 1280px; margin: 0 auto; }
.section-title {
  font-size: clamp(30px, 5vw, 56px);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  color: var(--ts-ink);
}
.section-title.title-start { text-align: right; }
.section-subtitle { margin-top: 14px; text-align: center; color: var(--ts-muted); font-size: 17px; }

/* ---------- hero ---------- */
.hero { padding: 150px 20px 40px; }
.hero-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 40px;
}
.hero-kicker { color: var(--ts-primary); font-size: 20px; font-weight: 500; margin-bottom: 14px; }
.hero-kicker b { font-weight: 800; font-family: 'Segoe UI', sans-serif; }
.hero-title {
  font-size: clamp(36px, 5.4vw, 66px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--ts-ink);
}
.hero-lead { margin-top: 44px; font-weight: 800; font-size: 17px; }
.hero-subtitle { margin-top: 8px; max-width: 520px; color: var(--ts-muted); font-size: 15px; line-height: 1.9; }
.hero-actions { margin-top: 44px; display: flex; gap: 14px; flex-wrap: wrap; }
.hero-actions .ts-btn { min-width: 230px; }

.hero-visual { position: relative; display: grid; place-items: center; min-height: 440px; }
.hero-blob {
  position: absolute;
  width: min(420px, 80%);
  aspect-ratio: 1;
  background: var(--ts-accent);
  border-radius: 58% 42% 55% 45% / 46% 52% 48% 54%;
  animation: blob 12s ease-in-out infinite;
}
.hero-img {
  position: relative;
  width: min(380px, 74%);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 46% 54% 48% 52% / 55% 45% 55% 45%;
  border: 8px solid var(--ts-bg);
  box-shadow: var(--ts-shadow);
}
@keyframes blob {
  0%, 100% { border-radius: 58% 42% 55% 45% / 46% 52% 48% 54%; transform: rotate(0deg); }
  50% { border-radius: 45% 55% 42% 58% / 54% 44% 56% 46%; transform: rotate(8deg); }
}

/* ---------- stats band ---------- */
.stats-section { position: relative; padding: 60px 20px clamp(70px, 11vw, 160px); }
.stats-ghost {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  line-height: 1;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(80px, 16vw, 230px);
  letter-spacing: 6px;
  color: #e5e7eb;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}
body.page-dark-mode .stats-ghost { color: #111827; }
.stats-band {
  position: relative;
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  padding: 70px 30px;
  border-radius: var(--ts-radius-lg);
  background: var(--ts-accent);
  color: #fff;
  text-align: center;
}
.stat-num { font-family: 'Segoe UI', Arial, sans-serif; font-weight: 900; font-size: clamp(36px, 5vw, 60px); line-height: 1; letter-spacing: -2px; }
.stat-label { margin-top: 14px; font-size: 17px; opacity: 0.95; }

/* ---------- my courses ---------- */
.my-courses-grid {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}
.my-course-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--ts-radius-lg);
  overflow: hidden;
  background: var(--ts-surface);
  border: 1px solid var(--ts-line);
  box-shadow: var(--ts-shadow);
  text-decoration: none;
  transition: transform 0.25s;
}
.my-course-card:hover { transform: translateY(-4px); }
.my-course-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.my-course-body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 10px; }
.my-course-body h3 { font-size: 18px; }
.my-course-bar { height: 8px; border-radius: 99px; background: var(--ts-surface-2); overflow: hidden; }
.my-course-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--ts-primary-light), var(--ts-primary)); }
.my-course-meta { display: flex; justify-content: space-between; color: var(--ts-muted); font-size: 13px; }
.my-course-cta { color: var(--ts-primary); font-weight: 800; }

/* ---------- why cards ---------- */
.why-grid {
  margin-top: 50px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.why-card {
  min-height: 330px;
  padding: 34px 30px;
  border-radius: 26px;
  border: 1px solid #d1d5db;
  background: var(--ts-surface);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s;
}
body.page-dark-mode .why-card { border-color: #374151; background: var(--ts-bg); }
.why-card:nth-child(odd) { transform: rotate(-2deg); }
.why-card:nth-child(even) { transform: rotate(2deg) translateY(6px); }
.why-card:hover { transform: rotate(0) translateY(-6px); z-index: 2; }
.why-card.is-filled { background: var(--ts-primary); border-color: var(--ts-primary); color: #fff; }
.why-icon {
  width: 70px;
  height: 70px;
  margin-inline-start: auto;
  margin-inline-end: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f59e0b, var(--ts-coral));
  color: #fff;
}
.why-card.is-filled .why-icon { background: linear-gradient(135deg, #fde68a, #f97316); }
.why-icon svg { width: 32px; height: 32px; }
.why-card h3 { margin-top: auto; padding-top: 70px; font-size: 19px; font-weight: 800; }
.why-card p { margin-top: 14px; font-size: 15px; line-height: 1.8; color: var(--ts-muted); }
.why-card.is-filled p { color: rgba(255, 255, 255, 0.92); }

/* ---------- courses ---------- */
.courses-admin { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.courses-grid {
  margin-top: 50px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 32px;
}
.courses-empty { grid-column: 1 / -1; text-align: center; color: var(--ts-muted); font-size: 18px; padding: 40px 0; }
.course-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  background: var(--ts-surface-2);
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.08);
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
}
body.page-dark-mode .course-card { background: var(--ts-surface); }
.course-card:hover { transform: translateY(-5px); box-shadow: 0 18px 40px rgba(17, 24, 39, 0.14); }
.course-card.is-soon { cursor: default; opacity: 0.85; }
.course-img-container { position: relative; }
.course-img-link { display: block; }
.course-title-link { color: inherit; text-decoration: none; }
.course-title-link:hover { color: var(--ts-primary); }
.course-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--ts-primary-tint); }
.course-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}
.badge-soon { background: var(--ts-accent); }
.badge-owned { background: var(--ts-primary); }
.course-admin-edit {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 4px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.course-body { padding: 20px 24px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.course-body h3 { font-size: 21px; font-weight: 800; color: var(--ts-ink); }
.course-body p { font-size: 14px; color: var(--ts-muted); line-height: 1.8; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.course-footer { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.course-price { font-weight: 800; color: var(--ts-accent); font-size: 17px; }
body.page-dark-mode .course-price { color: var(--ts-coral); }
.course-footer .ts-btn { padding: 9px 22px; margin-inline-start: auto; }

/* ---------- about ---------- */
.about-card {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 50px;
  align-items: center;
  padding: 40px;
  border-radius: 28px;
  background: var(--ts-surface-2);
}
body.page-dark-mode .about-card { background: var(--ts-surface); }
.about-visual { position: relative; }
.about-visual::before {
  content: '';
  position: absolute;
  inset: 18px -18px -18px 18px;
  border-radius: 24px;
  background: var(--ts-primary);
}
.about-img { position: relative; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: top; border-radius: 24px; }
.about-kicker { color: var(--ts-primary); font-weight: 800; font-size: 15px; }
.about-name { margin-top: 8px; font-size: clamp(30px, 4vw, 48px); font-weight: 800; }
.about-lead { margin-top: 12px; color: var(--ts-muted); font-size: 17px; line-height: 1.9; }
.about-features { margin-top: 28px; display: flex; flex-direction: column; gap: 18px; }
.about-feature { display: flex; gap: 16px; align-items: flex-start; }
.about-dot {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--ts-accent);
  color: #fff;
  font-weight: 800;
}
.about-feature-title { font-weight: 800; font-size: 17px; }
.about-feature-desc { color: var(--ts-muted); margin-top: 4px; line-height: 1.8; }

/* ---------- CTA ---------- */
.cta-section { padding: 40px 20px 90px; }
.cta-box {
  max-width: 1480px;
  margin: 0 auto;
  padding: 110px 30px;
  border-radius: var(--ts-radius-lg);
  background: var(--ts-accent);
  color: #fff;
  text-align: center;
}
.cta-title { font-size: clamp(32px, 5vw, 60px); font-weight: 800; }
.cta-text { margin: 18px auto 0; max-width: 640px; font-size: clamp(17px, 2.2vw, 26px); opacity: 0.95; }
.cta-btn { margin-top: 44px; min-width: 300px; padding: 22px 56px; }

/* ---------- footer ---------- */
.footer { padding: 50px 20px 110px; border-top: 1px solid var(--ts-line); }
.footer-inner {
  max-width: 1480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 30px;
}
.footer-copy { margin-top: 20px; font-weight: 800; font-size: 14px; }
.footer-col h4 { color: var(--ts-accent); font-size: 16px; margin-bottom: 16px; }
body.page-dark-mode .footer-col h4 { color: var(--ts-coral); }
.footer-links, .footer-social { display: flex; flex-direction: column; gap: 10px; }
.footer-links a, .footer-social a { color: var(--ts-ink); text-decoration: none; cursor: pointer; font-size: 15px; }
.footer-links a:hover, .footer-social a:hover { color: var(--ts-primary); }
.footer-contact {
  display: inline-block;
  padding: 12px 34px;
  border: 1.5px solid var(--ts-muted);
  border-radius: 6px;
  color: var(--ts-muted);
  text-decoration: none;
}
.footer-contact:hover { border-color: var(--ts-primary); color: var(--ts-primary); }
.footer-phone { display: block; margin-top: 12px; color: var(--ts-muted); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: block; }
  .why-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }
}
@media (max-width: 900px) {
  .hero { padding-top: 130px; }
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-visual { order: -1; min-height: 320px; }
  .hero-subtitle { margin-inline: auto; }
  .hero-actions { justify-content: center; }
  .hero-lead { margin-top: 24px; }
  .about-card { grid-template-columns: 1fr; padding: 26px; }
  .about-visual { max-width: 320px; margin: 0 auto 10px; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .navbar { top: 10px; width: calc(100% - 20px); }
  .navbar-inner { padding: 10px 14px; gap: 10px; }
  .logo-words { display: none; }
  .nav-actions { gap: 8px; }
  .nav-actions .ts-btn { padding: 8px 14px; font-size: 13px; }
  .nav-actions .nav-login { display: none; }
  .ts-theme-toggle { width: 64px; height: 32px; }
  .ts-theme-toggle .ts-knob { width: 24px; height: 24px; }
  .ts-theme-toggle input:checked ~ .ts-knob { right: 36px; }
  .section { padding: 64px 16px; }
  .stats-band { grid-template-columns: 1fr; gap: 34px; padding: 44px 20px; }
  .why-grid { grid-template-columns: 1fr; }
  .why-card { min-height: 0; }
  .why-card h3 { padding-top: 30px; }
  .courses-grid { grid-template-columns: 1fr; }
  .cta-box { padding: 70px 20px; }
  .cta-btn { min-width: 0; width: 100%; }
  .footer-inner { grid-template-columns: 1fr; }
  .hero-actions .ts-btn { min-width: 0; width: 100%; }
}
