/* ==========================================================================
   Haizum LMS — Frontend Styles
   Uses the Mihrab Academy design tokens from the theme (--c-emerald,
   --c-gold, etc.). Falls back gracefully if the theme is not active.
   ========================================================================== */

:root {
  --ha-emerald:      #0E3F33;
  --ha-emerald-dark: #0A2E26;
  --ha-emerald-tint: #E7EFEC;
  --ha-gold:         #C7A03C;
  --ha-gold-tint:    #F8F1DE;
  --ha-cream:        #FBF6EC;
  --ha-muted:        #75706A;
  --ha-border:       #E7E0D2;
  --ha-white:        #ffffff;
  --ha-success:      #3F8F5C;
  --ha-error:        #B0473D;
  --ha-radius:       12px;
  --ha-pill:         999px;
}

/* ---- Enroll button overrides on course pages ---- */
.ha-enroll-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--c-emerald, var(--ha-emerald));
  color: var(--c-white, var(--ha-white));
  border: none;
  border-radius: var(--radius-pill, var(--ha-pill));
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: background .18s ease;
  text-decoration: none;
}
.ha-enroll-btn:hover { background: var(--c-emerald-light, #1E5C4B); color: var(--ha-white); }
.ha-enroll-btn:disabled { opacity: .65; cursor: wait; }
.ha-enroll-btn--gold {
  background: var(--c-gold, var(--ha-gold));
  color: var(--ha-emerald-dark);
}
.ha-enroll-btn--free { background: var(--ha-success); }

.ha-enrolled-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--c-emerald-tint, var(--ha-emerald-tint));
  color: var(--c-emerald, var(--ha-emerald));
  border-radius: var(--ha-pill);
  font-weight: 700;
  font-size: .9rem;
}

/* ---- Progress bar ---- */
.ha-progress { }
.ha-progress__bar {
  height: 8px;
  background: var(--c-border, var(--ha-border));
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}
.ha-progress__fill {
  height: 100%;
  background: var(--c-emerald, var(--ha-emerald));
  border-radius: 4px;
  transition: width .4s ease;
}
.ha-progress__labels {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--c-muted, var(--ha-muted));
}

/* ---- Dashboard ---- */
.ha-dashboard { }
.ha-dashboard__welcome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--c-emerald, var(--ha-emerald));
  color: #fff;
  border-radius: var(--ha-radius);
  padding: 28px 32px;
  margin-bottom: 28px;
}
.ha-dashboard__welcome h2 { color: #fff; margin: 0 0 4px; }
.ha-dashboard__welcome p { margin: 0; color: rgba(255,255,255,.8); }

.ha-dashboard__summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.ha-stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--c-white, var(--ha-white));
  border: 1px solid var(--c-border, var(--ha-border));
  border-radius: var(--ha-radius);
}
.ha-stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--c-emerald, var(--ha-emerald));
  line-height: 1;
}
.ha-stat-card__label {
  font-size: .8125rem;
  color: var(--c-muted, var(--ha-muted));
}
.ha-dashboard__section-title {
  margin-bottom: 20px;
  font-size: 1.25rem;
}
.ha-dashboard__empty {
  text-align: center;
  padding: 48px 0;
  color: var(--c-muted, var(--ha-muted));
}
.ha-dashboard__empty p { margin-bottom: 16px; }

.ha-dashboard__courses {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.ha-course-card {
  background: var(--c-white, var(--ha-white));
  border: 1px solid var(--c-border, var(--ha-border));
  border-radius: var(--ha-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ha-course-card__thumb {
  display: block;
  position: relative;
  aspect-ratio: 16/9;
}
.ha-course-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ha-course-card__badge-done {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--ha-success);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.ha-course-card__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.ha-course-card__title { margin: 0; font-size: 1rem; }
.ha-course-card__title a { color: var(--c-charcoal, #2A2823); }
.ha-course-card__instructor { font-size: .8rem; color: var(--c-muted, var(--ha-muted)); margin: 0; }
.ha-course-card .ha-progress { margin-bottom: 4px; }

/* ---- Lesson player ---- */
.ha-lesson-wrap {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 120px);
}
.ha-lesson-sidebar {
  background: var(--c-cream, var(--ha-cream));
  border-right: 1px solid var(--c-border, var(--ha-border));
  padding: 24px 16px;
  overflow-y: auto;
}
.ha-lesson-sidebar__back {
  display: block;
  font-weight: 700;
  color: var(--c-emerald, var(--ha-emerald));
  margin-bottom: 16px;
  text-decoration: none;
  font-size: .875rem;
}
.ha-lesson-sidebar__progress { margin-bottom: 16px; }
.ha-lesson-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ha-lesson-sidebar__list li a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: .875rem;
  color: var(--c-charcoal, #2A2823);
  text-decoration: none;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.ha-lesson-sidebar__list li.is-done a { color: var(--ha-success); }
.ha-lesson-sidebar__list li.is-active a {
  background: var(--c-emerald-tint, var(--ha-emerald-tint));
  color: var(--c-emerald, var(--ha-emerald));
  font-weight: 700;
}

.ha-lesson-main {
  padding: 36px 40px;
  max-width: 860px;
}
.ha-lesson-main__title { margin-bottom: 24px; }
.ha-lesson-video {
  position: relative;
  aspect-ratio: 16/9;
  margin-bottom: 28px;
  border-radius: var(--ha-radius);
  overflow: hidden;
}
.ha-lesson-video iframe { width: 100%; height: 100%; border: none; }
.ha-lesson-content { margin-bottom: 32px; }
.ha-lesson-actions { display: flex; align-items: center; gap: 16px; }
.ha-mark-complete {
  background: var(--c-emerald, var(--ha-emerald));
  color: #fff;
  border: none;
  border-radius: var(--ha-pill);
  padding: 12px 28px;
  font-weight: 700;
  cursor: pointer;
  font-size: 1rem;
}
.ha-mark-complete:disabled { opacity: .65; cursor: wait; }
.ha-lesson-completed-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--ha-success);
  color: #fff;
  border-radius: var(--ha-pill);
  font-weight: 700;
}
.ha-next-lesson-link {
  font-weight: 600;
  color: var(--c-emerald, var(--ha-emerald));
  text-decoration: none;
  font-size: .9rem;
}

@media (max-width: 768px) {
  .ha-lesson-wrap { grid-template-columns: 1fr; }
  .ha-lesson-sidebar { border-right: none; border-bottom: 1px solid var(--ha-border); }
  .ha-lesson-main { padding: 24px 16px; }
  .ha-dashboard__welcome { padding: 20px; }
}

/* ---- Status badges (admin) ---- */
.ha-status-active  { color: var(--ha-success); font-weight: 700; }
.ha-status-cancelled { color: var(--ha-error); }
.ha-status-paid    { color: var(--ha-success); font-weight: 700; }
.ha-status-created { color: var(--ha-muted); }
