/* ============================================
   أكاديمية بنيان - نظام التصميم الحديث
   مستوحى من shadcn/ui + Tailwind
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&family=Amiri:wght@400;700&display=swap');

:root {
  --background: 120 20% 97%;
  --foreground: 130 50% 10%;
  --card: 0 0% 100%;
  --card-foreground: 130 50% 10%;
  --popover: 0 0% 100%;
  --popover-foreground: 130 50% 10%;

  /* Dark green - primary brand */
  --primary: 127 43% 25%;
  --primary-foreground: 120 20% 97%;
  --primary-glow: 127 43% 35%;

  /* Yellow-green accent */
  --accent: 72 70% 47%;
  --accent-foreground: 130 50% 10%;
  --accent-soft: 72 70% 92%;

  --secondary: 120 20% 92%;
  --secondary-foreground: 127 43% 20%;
  --muted: 120 15% 93%;
  --muted-foreground: 127 15% 40%;
  --border: 120 20% 85%;
  --input: 120 20% 88%;
  --ring: 72 70% 47%;
  --radius: 0.75rem;
  --success: 127 55% 38%;
  --destructive: 0 75% 50%;

  /* Gradients */
  --gradient-hero: linear-gradient(135deg, hsl(127 43% 18%) 0%, hsl(127 43% 28%) 60%, hsl(127 38% 36%) 100%);
  --gradient-overlay: linear-gradient(180deg, hsl(127 43% 15% / 0.4) 0%, hsl(127 43% 15% / 0.85) 100%);
  --gradient-gold: linear-gradient(135deg, hsl(72 75% 52%), hsl(80 65% 40%));
  --gradient-card: linear-gradient(180deg, hsl(0 0% 100%) 0%, hsl(120 20% 98%) 100%);

  /* Shadows */
  --shadow-card: 0 4px 20px -8px hsl(127 50% 20% / 0.15);
  --shadow-elegant: 0 20px 60px -20px hsl(127 43% 25% / 0.25);
  --shadow-gold: 0 10px 30px -10px hsl(72 70% 47% / 0.4);

  /* Motion */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  overflow-x: hidden;
}

html {
  direction: rtl;
  scroll-behavior: smooth;
}

body {
  font-family: 'Tajawal', system-ui, -apple-system, sans-serif;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.7;
  font-feature-settings: "kern", "liga";
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 800;
  letter-spacing: -0.01em;
  color: hsl(var(--foreground));
}

.font-display {
  font-family: 'Amiri', 'Tajawal', serif;
}

a {
  color: hsl(var(--primary));
  text-decoration: none;
  transition: var(--transition-smooth);
}

a:hover {
  color: hsl(var(--primary-glow));
}

/* Utility Classes */
.gradient-hero {
  background: var(--gradient-hero);
}

.gradient-gold {
  background: var(--gradient-gold);
}

.gradient-card {
  background: var(--gradient-card);
}

.shadow-card {
  box-shadow: var(--shadow-card);
}

.shadow-elegant {
  box-shadow: var(--shadow-elegant);
}

.shadow-gold {
  box-shadow: var(--shadow-gold);
}

.transition-smooth {
  transition: var(--transition-smooth);
}

.transition-bounce {
  transition: var(--transition-bounce);
}

.text-muted {
  color: hsl(var(--muted-foreground));
}

.bg-card {
  background-color: hsl(var(--card));
}

/* ============== MODERN NAVBAR ============== */
.site-nav {
  background: hsl(var(--primary));
  border-bottom: none;
  position: sticky;
  top: 0;
  z-index: 1020; /* Increased z-index */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  width: 100%;
}

.site-nav .navbar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-weight: 800;
  color: #ffffff;
  font-size: 1.15rem;
}

.site-nav .navbar-brand img {
  height: 50px;
  width: auto;
  transition: height 0.3s ease;
  background: #fff;
  padding: 4px;
  border-radius: 8px;
}

.site-nav .nav-link {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 700;
  padding: .45rem 1.25rem !important;
  border-radius: 50px;
  margin: 0 0.2rem;
  transition: var(--transition-smooth);
}

.site-nav .nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.site-nav .nav-link.active {
  background: hsl(var(--accent));
  color: hsl(var(--primary));
}

/* ============== MODERN BUTTONS ============== */
.btn-start-learning {
  background: linear-gradient(135deg, hsl(72 70% 52%) 0%, hsl(80 65% 40%) 100%);
  color: hsl(var(--accent-foreground));
  font-weight: 700;
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-gold);
}

.btn-start-learning:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(123, 179, 66, 0.4);
  color: hsl(var(--accent-foreground));
}

.btn-primary {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-weight: 700;
  padding: .65rem 1.5rem;
  border-radius: .65rem;
  transition: var(--transition-smooth);
}

.btn-primary:hover {
  background: hsl(var(--primary-glow));
  border-color: hsl(var(--primary-glow));
  transform: translateY(-2px);
  box-shadow: var(--shadow-elegant);
}

.btn-accent {
  background: var(--gradient-gold);
  border: none;
  color: hsl(var(--accent-foreground));
  font-weight: 800;
  padding: .75rem 1.75rem;
  border-radius: .65rem;
  transition: var(--transition-smooth);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-gold);
  color: hsl(var(--accent-foreground));
}

.btn-outline-primary {
  border: 2px solid hsl(var(--primary));
  color: hsl(var(--primary));
  font-weight: 700;
  padding: .55rem 1.4rem;
  border-radius: .65rem;
  background: transparent;
}

.btn-outline-primary:hover {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

/* ============== HERO SECTION ============== */
.hero {
  position: relative;
  min-height: 88vh;
  display: flex;
  align-items: center;
  background-image: var(--gradient-overlay), url('../images/nam.jpg');
  background-size: cover;
  background-position: center;
  color: #fff;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-overlay);
  pointer-events: none;
}

.hero .hero-inner {
  position: relative;
  z-index: 2;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  color: #fff;
  font-family: 'Amiri', serif;
  line-height: 1.2;
  margin-bottom: 1.25rem;
}

.hero h1 .highlight {
  color: hsl(72 80% 60%);
}

.hero p.lead {
  font-size: 1.25rem;
  opacity: .92;
  max-width: 680px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: hsl(72 70% 47% / 0.2);
  border: 1px solid hsl(72 70% 47% / 0.4);
  border-radius: 9999px;
  color: hsl(72 70% 52%);
  font-weight: 700;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.hero-badge .pulse {
  width: 8px;
  height: 8px;
  background: hsl(72 70% 47%);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* ============== SECTIONS ============== */
.section {
  padding: 5rem 0;
}

.section-title {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title .eyebrow {
  display: inline-block;
  padding: .35rem 1rem;
  background: hsl(var(--accent-soft));
  color: hsl(var(--primary));
  border-radius: 9999px;
  font-weight: 700;
  font-size: .85rem;
  margin-bottom: 1rem;
}

.section-title h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.75rem);
  font-family: 'Amiri', serif;
}

.section-title p {
  color: hsl(var(--muted-foreground));
  max-width: 640px;
  margin: 1rem auto 0;
}

/* ============== COURSE CARD ============== */
.course-card {
  background: var(--gradient-card);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition-bounce);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.course-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-elegant);
  border-color: hsl(var(--accent));
}

.course-card .img-wrap {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
}

.course-card .img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}

.course-card:hover .img-wrap img {
  transform: scale(1.06);
}

.course-card .badge-cat {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--gradient-gold);
  color: hsl(var(--accent-foreground));
  padding: .3rem .75rem;
  border-radius: 9999px;
  font-size: .8rem;
  font-weight: 700;
}

.course-card .body {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.course-card h3 {
  font-size: 1.2rem;
  margin-bottom: .5rem;
  font-family: 'Amiri', serif;
}

.course-card .desc {
  color: hsl(var(--muted-foreground));
  font-size: .95rem;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.course-card .meta {
  display: flex;
  gap: 1rem;
  font-size: .85rem;
  color: hsl(var(--muted-foreground));
  border-top: 1px solid hsl(var(--border));
  padding-top: 1rem;
}

.course-card .meta i {
  color: hsl(var(--primary));
  margin-left: .25rem;
}

.course-card .footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--background));
}

.course-card .price {
  color: hsl(var(--primary));
  font-weight: 800;
  font-size: 1.25rem;
}

.course-card .price-free {
  color: hsl(var(--success));
}

/* ============== CATEGORY CHIP ============== */
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.2rem;
  border-radius: 9999px;
  background: hsl(var(--card));
  border: 1.5px solid hsl(var(--border));
  color: hsl(var(--foreground));
  font-weight: 600;
  transition: var(--transition-smooth);
}

.cat-chip:hover,
.cat-chip.active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

/* ============== FEATURE CARDS ============== */
.feature-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  height: 100%;
  transition: var(--transition-smooth);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
  border-color: hsl(var(--accent));
}

.feature-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--gradient-gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--accent-foreground));
  font-size: 1.75rem;
  margin-bottom: 1.25rem;
}

/* ============== FOOTER ============== */
.site-footer {
  background: hsl(127 43% 12%);
  color: hsl(120 20% 85%);
  padding: 4rem 0 1.5rem;
  margin-top: 5rem;
}

.site-footer h5 {
  color: #fff;
  font-weight: 800;
  margin-bottom: 1.25rem;
}

.site-footer a {
  color: hsl(120 20% 80%);
  display: block;
  padding: .25rem 0;
}

.site-footer a:hover {
  color: hsl(72 80% 60%);
}

.site-footer .brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: #fff;
  font-weight: 800;
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.site-footer .brand img {
  height: 50px;
}

.site-footer .copy {
  border-top: 1px solid hsla(120 20% 85% / 0.15);
  padding-top: 1.5rem;
  margin-top: 3rem;
  text-align: center;
  color: hsl(120 20% 70%);
  font-size: .9rem;
}

.social-row {
  display: flex;
  gap: .75rem;
  margin-top: 1rem;
}

.social-row a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: hsla(120 20% 85% / 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.social-row a:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* ============== AUTH PAGE ============== */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-side {
  background: var(--gradient-hero);
  color: #fff;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.auth-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 20% 20%, hsl(var(--accent)) 0%, transparent 50%);
  opacity: 0.2;
}

.auth-side-content {
  text-align: center;
  max-width: 400px;
  position: relative;
  z-index: 1;
}

.auth-side .logo-container {
  display: inline-flex;
  height: 80px;
  width: 80px;
  border-radius: 1rem;
  background: white;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-gold);
  margin-bottom: 1.5rem;
  padding: 0.5rem;
}

.auth-side .logo-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-side h2 {
  color: #fff;
  font-family: 'Amiri', serif;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.auth-side p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
  line-height: 1.7;
}

.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: hsl(var(--background));
}

.auth-form {
  width: 100%;
  max-width: 420px;
}

.auth-form h1 {
  font-family: 'Amiri', serif;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.auth-form .form-label {
  font-weight: 600;
  font-size: 0.9rem;
}

/* Auth Tabs Modern */
.auth-tabs {
  display: flex;
  background: hsl(var(--secondary));
  border-radius: 0.75rem;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.auth-tab:hover {
  color: hsl(var(--foreground));
}

.auth-tab.active {
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Modern Form Inputs */
.input-wrap {
  position: relative;
  margin-bottom: 1rem;
}

.input-wrap label {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  display: block;
}

.input-wrap .input-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: hsl(var(--muted-foreground));
  pointer-events: none;
}

.input-wrap .form-control {
  padding: 0.75rem 1rem;
  padding-right: 2.5rem;
  height: 48px;
  border: 1px solid hsl(var(--border));
  border-radius: 0.65rem;
  background: hsl(var(--card));
  transition: var(--transition-smooth);
}

.input-wrap .form-control:focus {
  border-color: hsl(var(--accent));
  box-shadow: 0 0 0 3px hsl(var(--accent) / 0.15);
  outline: none;
}

/* Buttons */
.btn-login,
.btn-register {
  background: var(--gradient-gold);
  color: hsl(var(--accent-foreground));
  font-weight: 700;
  border: none;
  border-radius: 0.65rem;
  padding: 0.75rem 1.5rem;
  width: 100%;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-gold);
}

.btn-login:hover,
.btn-register:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -10px hsl(var(--accent) / 0.5);
}

@media (max-width: 768px) {
  .auth-wrap {
    grid-template-columns: 1fr;
  }

  .auth-side {
    display: none;
  }
}

/* ============== ALERTS ============== */
.alert {
  border-radius: var(--radius);
  border: none;
  font-weight: 500;
}

.alert-success {
  background: hsl(var(--success) / 0.12);
  color: hsl(var(--success));
}

.alert-danger {
  background: hsl(var(--destructive) / 0.12);
  color: hsl(var(--destructive));
}

.alert-info {
  background: hsl(var(--accent-soft));
  color: hsl(var(--primary));
}

/* ============== ANIMATIONS ============== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-up {
  animation: fadeUp 0.6s ease-out both;
}

.animate-delay-1 {
  animation-delay: 0.15s;
}

.animate-delay-2 {
  animation-delay: 0.3s;
}

/* Course detail */
.course-hero {
  background: var(--gradient-hero);
  color: #fff;
  padding: 4rem 0;
}

.course-hero h1 {
  color: #fff;
  font-family: 'Amiri', serif;
  font-size: 2.75rem;
}

.module-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.module-card h4 {
  color: hsl(var(--primary));
  margin-bottom: 1rem;
}

.lesson-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 0;
  border-bottom: 1px dashed hsl(var(--border));
}

.lesson-row:last-child {
  border-bottom: none;
}

.lesson-row i {
  color: hsl(var(--accent));
  margin-left: .5rem;
}

/* ============== ADMIN ============== */
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  background: hsl(127 43% 12%);
  color: #fff;
  padding: 1.5rem 0;
}

.admin-sidebar .brand {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid hsla(255 255% 255% / 0.1);
  margin-bottom: 1rem;
}

.admin-mobile-bar .brand-text img {
  height: 42px;
}

.admin-sidebar .brand img {
  height: 40px;
}

.admin-sidebar .brand span {
  color: #fff;
  font-weight: 800;
}

.admin-sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: all 0.2s;
  font-size: 0.95rem;
  font-weight: 600;
  border-right: 4px solid transparent;
}

.admin-sidebar a i {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-right-color: hsl(72 80% 60%);
}

.admin-sidebar a.active i {
  color: hsl(72 80% 60%);
}

.admin-main {
  padding: 2rem;
  background: hsl(var(--background));
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid hsl(var(--border));
}

.stat-card {
  background: var(--gradient-card);
  padding: 1.5rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}

.stat-card .num {
  font-size: 2rem;
  font-weight: 800;
  color: hsl(var(--primary));
}

.stat-card .label {
  color: hsl(var(--muted-foreground));
  font-size: .9rem;
}

.stat-card .icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: hsl(var(--accent-soft));
  color: hsl(var(--primary));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

table.data-table {
  background: hsl(var(--card));
  border-radius: var(--radius);
  overflow: hidden;
}

table.data-table thead {
  background: hsl(var(--secondary));
  color: hsl(var(--foreground));
}

table.data-table th {
  font-weight: 700;
  padding: 1rem;
}

table.data-table td {
  padding: .9rem 1rem;
  vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════
   Lesson Editor Styles
═══════════════════════════════════════════════════════════════ */
.lesson-editor-wrap {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  min-height: calc(100vh - 200px);
}

.lesson-sidebar {
  background: hsl(var(--card));
  border-radius: var(--radius-lg);
  border: 1px solid hsl(var(--border));
  overflow: hidden;
}

.lesson-sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--secondary) / 0.5);
}

.lesson-sidebar-content {
  max-height: calc(100vh - 300px);
  overflow-y: auto;
}

.module-item {
  border-bottom: 1px solid hsl(var(--border));
}

.module-header {
  padding: 0.75rem 1rem;
  background: hsl(var(--secondary) / 0.3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 600;
}

.module-header:hover {
  background: hsl(var(--secondary) / 0.5);
}

.module-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: hsl(var(--primary));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.lesson-list {
  padding: 0.5rem;
}

.lesson-item {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.875rem;
  color: inherit;
  text-decoration: none;
}

.lesson-item:hover {
  background: hsl(var(--accent-soft));
}

.lesson-item.active {
  background: hsl(var(--primary));
  color: white;
}

.lesson-item i {
  font-size: 0.875rem;
  opacity: 0.7;
}

.lesson-status {
  margin-right: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.lesson-status.published {
  background: hsl(var(--success));
}

.lesson-status.draft {
  background: hsl(var(--muted-foreground));
}

.lesson-main {
  background: hsl(var(--card));
  border-radius: var(--radius-lg);
  border: 1px solid hsl(var(--border));
  padding: 1.5rem;
}

.lesson-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid hsl(var(--border));
}

/* Rich Text Editor */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.75rem;
  background: hsl(var(--secondary) / 0.3);
  border: 1px solid hsl(var(--border));
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}

.editor-toolbar button {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: hsl(var(--foreground));
}

.editor-toolbar button:hover {
  background: hsl(var(--accent-soft));
}

.editor-toolbar select {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--border));
  background: white;
  font-size: 0.875rem;
}

.editor-toolbar .divider {
  width: 1px;
  height: 24px;
  background: hsl(var(--border));
  margin: 0 0.25rem;
}

.editor-content {
  min-height: 300px;
  padding: 1rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0 0 var(--radius) var(--radius);
  outline: none;
  line-height: 1.8;
}

.editor-content:empty:before {
  content: 'اكتب محتوى الدرس هنا...';
  color: hsl(var(--muted-foreground));
  font-style: italic;
}

.editor-content img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 1rem 0;
}

.editor-content video {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 1rem 0;
}

/* Video Section */
.video-section {
  background: hsl(var(--secondary) / 0.2);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.video-type-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.video-type-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: white;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.875rem;
}

.video-type-btn.active {
  border-color: hsl(var(--primary));
  background: hsl(var(--accent-soft));
  color: hsl(var(--primary));
}

.video-preview {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
}

.video-preview iframe,
.video-preview video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Attachments */
.attachment-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: hsl(var(--secondary) / 0.3);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.attachment-item i {
  color: hsl(var(--primary));
}

.attachment-item .delete-btn {
  margin-right: auto;
  color: hsl(var(--destructive));
  cursor: pointer;
}

/* =============================================
   RESPONSIVE - Mobile First
   ============================================= */

/* ---- Tablet (max 992px) ---- */
@media (max-width: 992px) {

  /* Admin */
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    display: none;
  }

  .lesson-editor-wrap {
    grid-template-columns: 1fr;
  }

  /* Auth */
  .auth-wrap {
    grid-template-columns: 1fr;
  }

  .auth-side {
    display: none;
  }

  .auth-main {
    padding: 2rem 1.5rem;
  }

  /* Hero */
  .hero {
    min-height: 70vh;
    padding: 4rem 0 3rem;
  }

  .hero h1 {
    font-size: clamp(1.9rem, 6vw, 3rem);
  }

  .hero p.lead {
    font-size: 1rem;
  }

  /* LMS Lesson page */
  .lms-wrapper {
    flex-direction: column-reverse;
  }

  .lms-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid #e5e7eb;
    max-height: 380px;
    overflow-y: auto;
  }

  .lms-sidebar.hidden {
    display: none;
  }

  /* User layout */
  .user-layout {
    grid-template-columns: 1fr;
  }
}

/* ---- Mobile (max 768px) ---- */
@media (max-width: 768px) {

  /* General spacing */
  .section {
    padding: 3rem 0;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Hero */
  .hero {
    min-height: auto;
    padding: 3.5rem 0 2.5rem;
    text-align: center;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p.lead {
    font-size: 0.95rem;
    max-width: 100%;
  }

  .hero .d-flex {
    justify-content: center;
  }

  .hero-badge {
    font-size: 0.8rem;
  }

  /* Navbar */
  .site-nav .navbar-brand span {
    font-size: 1rem;
  }

  .site-nav .navbar-brand img {
    height: 34px;
  }

  .navbar-collapse {
    background: hsl(var(--primary));
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    margin-top: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
  }

  /* Stats section */
  .hero+section .row {
    gap: 1rem;
  }

  .hero+section .fs-2 {
    font-size: 1.5rem !important;
  }

  /* Course cards */
  .course-card h3 {
    font-size: 1rem;
  }

  .course-card .body {
    padding: 1rem;
  }

  .course-card .footer-row {
    padding: 0.75rem 1rem;
  }

  /* Feature cards */
  .feature-card {
    padding: 1.25rem;
  }

  .feature-icon {
    width: 50px;
    height: 50px;
    font-size: 1.4rem;
  }

  /* Footer */
  .site-footer {
    padding: 2.5rem 0 1rem;
  }

  .site-footer .brand img {
    height: 38px;
  }

  /* Auth */
  .auth-main {
    padding: 1.5rem 1rem;
  }

  .auth-form-card {
    padding: 1.5rem;
    border-radius: 1rem;
  }

  /* Admin bars and cards */
  .admin-topbar {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .admin-stats {
    grid-template-columns: 1fr 1fr;
  }

  /* User Dashboard */
  .user-sidebar {
    display: none;
  }

  .main-content {
    padding: 1rem !important;
  }

  /* Lesson page */
  .lms-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 15px;
  }

  .lms-main-area {
    padding: 15px;
  }

  .lms-nav-buttons {
    flex-wrap: wrap;
    gap: 8px;
  }

  .lms-nav-btn {
    font-size: 0.85rem;
    padding: 7px 16px;
  }

  .lms-nav-icons {
    display: none;
  }

  .lms-player {
    aspect-ratio: 16/9;
  }

  .lms-title-area h2 {
    font-size: 1.15rem;
  }

  /* Courses user page */
  .courses-grid {
    grid-template-columns: 1fr !important;
  }

  .page-header {
    padding: 1.5rem;
    border-radius: 1rem;
  }

  .page-header h1 {
    font-size: 1.4rem;
  }

  .filter-bar {
    flex-direction: column;
    gap: 0.75rem;
  }

  /* Progress page */
  .chart-container {
    height: 280px;
  }

  .enrollment-badge {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  /* Certificates */
  .cert-grid {
    grid-template-columns: 1fr !important;
  }

  /* Admin Visual Editor Bar */
  #ve-admin-bar {
    bottom: 12px;
    padding: 8px 14px;
    gap: 8px;
    font-size: 0.8rem;
    width: calc(100% - 24px);
    justify-content: center;
  }

  .ve-btn {
    padding: 6px 12px;
    font-size: 0.78rem;
  }

  #ve-modal {
    width: 95vw;
  }

  /* Quiz / Question cards */
  .question-card .row {
    flex-direction: column;
  }

  .question-card .col-md-6 {
    width: 100%;
  }
}

/* ---- Small Mobile (max 480px) ---- */
@media (max-width: 480px) {

  /* Hero */
  .hero h1 {
    font-size: 1.65rem;
    line-height: 1.3;
  }

  .hero .btn {
    width: 100%;
    justify-content: center;
  }

  .hero .d-flex {
    flex-direction: column;
    gap: 0.75rem !important;
  }

  /* Stats */
  .hero+section .col-6 {
    text-align: center;
  }

  /* Navbar brand */
  .site-nav .navbar-brand .flex-column span {
    display: inline-block;
  }

  /* Admin stats 1 column */
  .admin-stats {
    grid-template-columns: 1fr;
  }

  /* Lesson sidebar */
  .lms-sidebar {
    max-height: 300px;
  }

  /* CTA section */
  .gradient-hero.p-5 {
    padding: 2rem 1rem !important;
  }

  .gradient-hero h2 {
    font-size: 1.5rem;
  }

  /* Form controls */
  .form-control,
  .form-select {
    font-size: 1rem;
  }

  /* Breadcrumb overflow */
  .lms-breadcrumb {
    font-size: 0.75rem;
  }

  .lms-breadcrumb span {
    margin: 0 2px;
  }
}

/* ---- Ensure images never overflow ---- */
img {
  max-width: 100%;
  height: auto;
}

/* ---- Touch-friendly tap targets ---- */
@media (hover: none) {

  .btn,
  .nav-link,
  .lesson-item,
  .lms-lesson-item,
  .lms-nav-btn {
    min-height: 44px;
  }

  .course-card:hover {
    transform: none;
  }

  .feature-card:hover {
    transform: none;
  }

  .btn-primary:hover,
  .btn-accent:hover {
    transform: none;
  }
}

/* ---- Safe area (notch support) ---- */
@supports (padding: env(safe-area-inset-bottom)) {
  #ve-admin-bar {
    bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .site-footer {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
  }
}

/* Cookie Consent Banner */
.cookie-banner {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: min(450px, calc(100vw - 4rem));
  background: hsla(0, 0%, 100%, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid hsla(127, 43%, 25%, 0.1);
  border-radius: 1.25rem;
  padding: 1.25rem;
  z-index: 2100;
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.15);
  display: none;
  animation: cookieSlideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes cookieSlideUp {
  from { transform: translateY(100%) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.cookie-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cookie-text {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #0f172a;
  display: flex;
  gap: 0.75rem;
  text-align: right;
}

.cookie-text i {
  color: hsl(127, 43%, 25%);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.cookie-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.btn-cookie-accept {
  background: hsl(127, 43%, 25%);
  color: white !important;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: 0.65rem;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-cookie-accept:hover {
  background: hsl(127, 43%, 35%);
  transform: translateY(-1px);
}

@media (max-width: 576px) {
  .cookie-banner {
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    width: auto;
    border-radius: 1rem;
    padding: 1rem;
  }
}