/**
 * Reneumind Student/Public UI
 * Lifestyle · Mindset · Meditation platform
 * Color palette: #5C5078 (amethyst), #232136 (dark navy), #469498 (teal)
 */

/* Mobile overlay for Course Content on learn page */
@media (max-width: 992px) {
  .learn-side.learn-side-overlay {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    top: 72px;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(35, 33, 54, 0.45);
    z-index: 1050;
    max-height: none;
    overflow: hidden;
  }

  .learn-side.learn-side-overlay .accordion {
    height: 100%;
    overflow-y: auto;
  }
}

:root {
  --p: #5C5078;
  --primary: #5C5078;
  --p2: #4A3D62;
  --accent: #469498;
  --accent2: #37797D;
  --dark: #232136;
  --bg: #F9F8FF;
  --card: #FFFFFF;
  --txt: #3D3652;
  --txt2: #70668A;
  --hd: #232136;
  --bd: #E8E3F2;
  --r: 12px;
  --r2: 10px;
  --sh: 0 1px 3px rgba(35, 33, 54, 0.06);
  --success: #059669;
}

body.student-wrap {
  font-family: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--txt);
}

/* Topbar */
.student-topbar {
  background: var(--card);
  border-bottom: 1px solid var(--bd);
  box-shadow: var(--sh);
}

.student-brand {
  font-weight: 800;
  color: var(--hd) !important;
  letter-spacing: -0.02em;
}

.student-brand i {
  color: var(--p);
}

.site-logo {
  height: 64px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Buttons */
.btn-primary {
  background: var(--p);
  border-color: var(--p);
  border-radius: var(--r2);
  font-weight: 500;
  color: #fff;
}

.btn-primary:hover {
  background: var(--p2);
  border-color: var(--p2);
  color: #fff;
}

.btn-outline-primary {
  border-color: var(--bd);
  color: var(--txt);
  border-radius: var(--r2);
}

.btn-outline-primary:hover {
  border-color: var(--p);
  color: var(--p);
  background: #EEE9FF;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  border-radius: var(--r2);
  color: #fff;
  font-weight: 500;
}

.btn-accent:hover {
  background: var(--accent2);
  border-color: var(--accent2);
  color: #fff;
}

/* Cards */
.s-card {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  box-shadow: var(--sh);
  overflow: hidden;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}

.s-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(35, 33, 54, 0.12);
}

.s-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--hd);
}

.s-sub {
  color: var(--txt2);
  font-size: 0.875rem;
}

/* Progress bars */
.progress {
  height: 10px;
  background: #EEE9FF;
  border-radius: 9999px;
}

.progress-bar {
  background: var(--accent);
  border-radius: 9999px;
}

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 9999px;
  background: #EEE9FF;
  color: var(--p);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Learn page layout */
.learn-shell {
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

.learn-main {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--sh);
  padding: 24px;
}

.learn-side {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--sh);
  padding: 16px;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.lesson-item {
  padding: 12px;
  border-radius: var(--r2);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.lesson-item:hover {
  background: var(--bg);
}

.lesson-item.active {
  border-color: var(--p);
  background: #EEE9FF;
}

.lesson-item .meta {
  font-size: 0.75rem;
  color: var(--txt2);
}

.lesson-item .lesson-num {
  font-size: 0.75rem;
  color: var(--txt2);
  margin-right: 6px;
}

/* Learn page typography */
.learn-breadcrumb {
  font-size: 0.8125rem;
  color: var(--txt2);
  margin-bottom: 8px;
}

.learn-breadcrumb a {
  color: var(--txt2);
  text-decoration: none;
}

.learn-breadcrumb a:hover {
  color: var(--p);
}

.learn-video-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--hd);
  margin: 0 0 16px 0;
  line-height: 1.3;
}

.learn-action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px solid var(--bd);
  border-bottom: 1px solid var(--bd);
}

.learn-action-bar .btn-completed {
  background: #D1FAE5;
  color: var(--success);
  border-color: #D1FAE5;
  cursor: default;
}

.learn-tabs {
  border-bottom: 2px solid var(--bd);
  margin-bottom: 20px;
}

.learn-tabs .nav-link {
  border: none;
  background: none;
  color: var(--txt2);
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 0;
  margin-bottom: -2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease;
}

.learn-tabs .nav-link:hover {
  color: var(--hd);
}

.learn-tabs .nav-link.active {
  color: var(--p);
  border-bottom-color: var(--p);
  background: transparent;
}

.learn-tab-content {
  min-height: 140px;
  line-height: 1.6;
}

.learn-desc-body {
  color: var(--txt);
  font-size: 0.9375rem;
}

.learn-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--txt2);
}

.learn-empty i {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.learn-note-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--bd);
}

.learn-note-row:last-child {
  border-bottom: none;
}

.learn-note-time {
  font-weight: 600;
  color: var(--accent);
  min-width: 52px;
  font-variant-numeric: tabular-nums;
}

.learn-note-text {
  color: var(--txt);
  flex: 1;
}

.learn-note-delete {
  color: #9CA3AF;
  cursor: pointer;
  padding: 4px;
}

.learn-note-delete:hover {
  color: #EF4444;
}

.learn-notes-form {
  background: var(--bg);
  border-radius: var(--r2);
  padding: 16px;
  margin-top: 16px;
}

.learn-resource-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--r2);
  color: var(--txt);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.learn-resource-link:hover {
  border-color: var(--p);
  background: #EEE9FF;
  color: var(--p);
}

.learn-resource-link i {
  color: var(--txt2);
}

.learn-resource-link:hover i {
  color: var(--p);
}

.learn-progress-card {
  background: #EEE9FF;
  border: 1px solid #D4CCF5;
  border-radius: var(--r);
  padding: 16px;
}

.learn-progress-card .progress {
  height: 8px;
}

.learn-next-prev {
  gap: 8px;
}

.learn-next-prev .btn {
  border-radius: var(--r2);
}

/* Content tab (inline lesson list on mobile) */
.learn-content-section {
  border-bottom: 1px solid var(--bd);
}

.learn-content-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 4px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--hd);
  cursor: pointer;
  user-select: none;
}

.learn-content-section-title i {
  font-size: 0.75rem;
  color: var(--txt2);
}

.learn-content-type-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--txt2);
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 6px;
  padding: 2px 7px;
  flex-shrink: 0;
  margin-left: 8px;
  text-transform: capitalize;
  letter-spacing: 0.02em;
}

/* Video wrapper */
.learn-video-wrapper {
  border-radius: 0;
  overflow: hidden;
  background: #0F0E1A;
  max-width: 100%;
}

.learn-video-wrapper iframe {
  border: 0;
  width: 100%;
  height: 100%;
}

/* ── Mobile ≤768px ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .student-topbar .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }

  .student-wrap .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .student-wrap .row.g-4 > [class*="col-"] {
    margin-bottom: 0;
  }

  .s-card {
    border-radius: var(--r2);
  }

  /* Compact logo on mobile so navbar takes less vertical space */
  .site-logo {
    height: 36px;
  }

  /* Hide topbar progress — shown in the Content tab instead */
  .student-topbar .learn-topbar-progress {
    display: none !important;
  }

  /* ── Fixed-video + scrollable-content layout ──────────────────────
     How it works:
       body.learn-page         → column flex, height 100vh
       .student-topbar         → flex-shrink: 0  (takes its natural height)
       .learn-shell            → flex: 1         (fills remaining height)
       .learn-shell > .row     → height: 100%
       .learn-side-col         → hidden          (Content tab replaces sidebar)
       .col-lg-9               → height: 100%
       .learn-main             → flex column, overflow hidden
       .learn-lesson-wrap      → flex: 1, overflow hidden (passes height down)
       .learn-video-wrapper    → flex-shrink: 0  (pinned, never scrolls away)
       .learn-below-video      → flex: 1, overflow-y: auto  (scrolls)
  ──────────────────────────────────────────────────────────────────── */

  body.learn-page {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body.learn-page .student-topbar {
    flex-shrink: 0;
  }

  .learn-shell {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0;
  }

  .learn-shell > .row {
    height: 100%;
    margin: 0;
  }

  /* Hide sidebar column — the Content tab replaces it on mobile */
  .learn-side-col {
    display: none;
  }

  /* Main column: full height, no Bootstrap gutter padding */
  .learn-shell > .row > .col-lg-9 {
    height: 100%;
    padding: 0;
  }

  /* learn-main: vertical flex container filling the column */
  .learn-main {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }

  /* Lesson wrapper: passes flex height down to video + below-video */
  .learn-lesson-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  /* Video: pinned at top, never shrinks or scrolls away */
  .learn-video-wrapper {
    flex-shrink: 0;
    border-radius: 0;
    --bs-aspect-ratio: 60%; /* slightly taller than 16:9 for more canvas */
  }

  /* Scrollable content pane below the video */
  .learn-below-video {
    flex: 1;
    min-height: 0; /* without this, flex won't allow the child to scroll */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px 24px;
  }

  /* Breadcrumb removed — wastes space above the video */
  .learn-breadcrumb {
    display: none;
  }

  .learn-video-title {
    font-size: 1.05rem;
    margin-bottom: 8px;
  }

  .learn-action-bar {
    padding: 10px 0;
  }

  .learn-tabs .nav-link {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .learn-side {
    position: static;
    top: auto;
    max-height: none;
    margin-top: 8px;
  }
}

/* ── Very small screens ≤576px ─────────────────────────────── */
@media (max-width: 576px) {
  .student-topbar .ms-3.text-truncate {
    display: none;
  }

  .student-topbar .ms-auto.d-flex {
    gap: 6px !important;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  /* On tiny screens, Prev/Next span full width below Mark Complete */
  .learn-action-bar {
    flex-wrap: wrap;
  }

  .learn-next-prev {
    width: 100%;
    justify-content: space-between;
  }
}
