/* ============================================================
   main.css — Magic Learning CMS
   RTL/LTR automatic via [dir] attribute
   ============================================================ */

:root {
  --primary:      #534AB7;
  --primary-dark: #3C3489;
  --primary-light:#EEEDFE;
  --text:         #1a1a1a;
  --text-muted:   #6b6b6b;
  --border:       #e0ddd6;
  --bg:           #ffffff;
  --bg-secondary: #f8f7f4;
  --success:      #1D9E75;
  --error:        #E24B4A;
  --warning:      #BA7517;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow:       0 1px 4px rgba(0,0,0,0.08);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans Hebrew', 'Noto Sans', 'Inter', sans-serif;
  color: var(--text);
  background: var(--bg-secondary);
  line-height: 1.6;
  font-size: 16px;
}

/* שפות LTR */
[dir="ltr"] body,
.lang-en body,
.lang-ru body {
  font-family: 'Inter', 'Noto Sans', sans-serif;
}

/* --- Container --- */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Navbar --- */
.navbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}
.navbar-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  flex-shrink: 0;
}

/* Nav collapse wrapper */
.nav-collapse {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
}

.navbar-links {
  display: flex;
  gap: 4px;
  list-style: none;
  flex: 1;
}
.navbar-links a {
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.navbar-links a:hover { background: var(--bg-secondary); color: var(--text); }

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* --- Hamburger button (hidden on desktop) --- */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 110;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --- Language switcher --- */
.lang-switcher {
  display: flex;
  gap: 2px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 2px;
  border: 1px solid var(--border);
}
.lang-btn {
  padding: 3px 8px;
  font-size: 12px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.lang-btn:hover, .lang-btn.active {
  background: var(--bg);
  color: var(--primary);
  font-weight: 500;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--bg-secondary); }

.btn-danger { background: #fee2e2; color: var(--error); }
.btn-danger:hover { background: #fecaca; }

.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* --- Flash Messages --- */
.flash {
  padding: 12px 0;
  font-size: 14px;
  font-weight: 500;
}
.flash-success { background: #f0fdf4; color: var(--success); border-bottom: 1px solid #bbf7d0; }
.flash-error   { background: #fef2f2; color: var(--error);   border-bottom: 1px solid #fecaca; }

/* --- Main content --- */
.main-content {
  min-height: calc(100vh - 60px - 80px);
  padding: 40px 0;
}
/* Landing page — no padding, no container constraint */
.main-content.lp-page {
  padding: 0;
}
.main-content.lp-page > .container {
  max-width: none;
  padding: 0;
}

/* --- Cards --- */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-body { padding: 20px 24px; }
.card-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }

/* Course grid */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 32px;
}
.course-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.course-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.1); transform: translateY(-2px); }
.course-card-thumb {
  background: var(--primary-light);
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}
.course-card-body { padding: 16px; }
.course-card-title { font-weight: 600; font-size: 16px; margin-bottom: 6px; }
.course-card-meta  { font-size: 13px; color: var(--text-muted); }
.course-card-price { font-size: 18px; font-weight: 700; color: var(--primary); margin-top: 12px; }

/* --- Forms --- */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-muted);
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(83,74,183,0.12);
}
.form-textarea { min-height: 100px; resize: vertical; }
.form-error { font-size: 12px; color: var(--error); margin-top: 4px; }

/* --- Progress bar --- */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef9c3; color: #a16207; }
.badge-error   { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: var(--primary-light); color: var(--primary); }

/* --- Stats cards (Admin) --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }

/* --- Table --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 16px; text-align: start; border-bottom: 1px solid var(--border); }
th { font-weight: 500; color: var(--text-muted); background: var(--bg-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: var(--bg-secondary); }

/* --- Footer --- */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 24px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-copy { font-size: 13px; color: var(--text-muted); }
.footer-links { display: flex; gap: 16px; list-style: none; }
.footer-links a { font-size: 13px; color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--primary); }

/* --- Lesson player --- */
.learn-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}
.video-wrap {
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.video-wrap iframe { width: 100%; height: 100%; border: none; }
.lessons-sidebar {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.lesson-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  font-size: 14px;
  transition: background 0.12s;
}
.lesson-item:hover { background: var(--bg-secondary); }
.lesson-item.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.lesson-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.lesson-check.done { border-color: var(--success); background: var(--success); }

/* --- RTL specific adjustments --- */
[dir="rtl"] .lesson-item  { flex-direction: row-reverse; }

/* --- Responsive --- */

/* Tablet */
@media (max-width: 768px) {
  .learn-layout { grid-template-columns: 1fr; }
  .lessons-sidebar { order: 2; }

  /* Navbar — hamburger layout */
  .navbar-inner {
    flex-wrap: wrap;
    justify-content: space-between;
  }
  .nav-hamburger { display: flex; }

  .nav-collapse {
    display: none;
    position: fixed;
    top: 60px;
    left: 0; right: 0; bottom: 0;
    background: var(--bg);
    flex-direction: column;
    padding: 0;
    gap: 0;
    overflow-y: auto;
    z-index: 100;
    border-top: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  }
  .nav-collapse.open { display: flex; }

  /* Links — full width stacked list */
  .navbar-links {
    flex-direction: column;
    gap: 0;
    width: 100%;
    flex: none;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
  }
  .navbar-links li { list-style: none; }
  .navbar-links a {
    padding: 14px 24px;
    font-size: 16px;
    display: block;
    border-radius: 0;
    color: var(--text);
  }
  .navbar-links a:hover {
    background: var(--bg-secondary);
  }

  /* Actions — stacked below links */
  .navbar-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    padding: 16px 24px;
  }
  .navbar-actions .btn {
    text-align: center;
    justify-content: center;
    display: block;
    padding: 12px;
  }

  /* Language switcher — centered row */
  .lang-switcher {
    justify-content: center;
    margin-bottom: 8px;
  }

  /* Course show page */
  .course-show-grid { grid-template-columns: 1fr !important; }
  .course-sidebar { position: static !important; }

  /* Account dashboard */
  .account-grid { grid-template-columns: 1fr !important; }

  /* Contact page */
  .contact-grid { display: block !important; }
  .contact-grid > div:last-child { margin-top: 24px; }
}

/* Footer */
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-col-brand { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

/* Phone */
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .courses-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .btn-lg { width: 100%; justify-content: center; }
}

/* badge-sub ב-navbar */
.badge-sub {
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}

/* ============================================================
   Footer מלא
   ============================================================ */

.footer-full {
  background: #1e1c2e;
  color: #c8c6e8;
  padding: 56px 0 0;
  margin-top: 64px;
}
/* No gap between CTA and footer on landing page */
.lp-page .footer-full {
  margin-top: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.footer-logo {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  display: block;
  margin-bottom: 12px;
}
.footer-tagline {
  font-size: 13px;
  color: #9896b8;
  line-height: 1.65;
  margin-bottom: 20px;
}

.footer-social { display: flex; gap: 8px; }
.social-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: #c8c6e8;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; font-size: 12px; font-weight: 600;
  transition: background 0.15s;
}
.social-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }

.footer-col-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #fff;
  margin-bottom: 16px;
}

.footer-col-links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-col-links a {
  font-size: 13px;
  color: #9896b8;
  text-decoration: none;
  transition: color 0.12s;
}
.footer-col-links a:hover { color: #fff; }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-copy { font-size: 12px; color: #6b6988; }
.footer-bottom-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-bottom-links a {
  font-size: 12px;
  color: #6b6988;
  text-decoration: none;
  transition: color 0.12s;
}
.footer-bottom-links a:hover { color: #c8c6e8; }

/* Secure payment badge */
.footer-secure {
  width: 100%;
  text-align: center;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.secure-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(29,158,117,0.1);
  border: 1px solid rgba(29,158,117,0.25);
  color: #5CC9A7;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 6px 18px;
  border-radius: 20px;
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-col-brand { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; text-align: center; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}
