/**
 * LCM On-Demand — Sidebar, Auto-advance, Landing page styles.
 * v1.1.0 — Added: pending banner, reviews, enrolled badge.
 */

/* ══════════════════════════════════════════
   SIDEBAR LAYOUT
   ══════════════════════════════════════════ */
.od-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.od-layout .lcm-content-page {
  flex: 1;
  min-width: 0;
  transition: margin-left 0.3s ease;
}

.od-sidebar {
  width: 320px;
  min-width: 320px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  transform: translateX(-320px);
  margin-left: -320px;
  transition: transform 0.3s ease, margin-left 0.3s ease;
  z-index: 50;
}

.od-sidebar-open .od-sidebar {
  transform: translateX(0);
  margin-left: 0;
}

.od-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #fafafa;
  flex-shrink: 0;
}

.od-sidebar-title { font-size: 14px; font-weight: 600; color: #111827; }

.od-sidebar-close {
  background: none; border: none; font-size: 20px; color: #6b7280;
  cursor: pointer; padding: 0 4px; line-height: 1;
}
.od-sidebar-close:hover { color: #111827; }

.od-sidebar-body { flex: 1; overflow-y: auto; overflow-x: hidden; }

.od-sidebar-toggle {
  position: fixed; left: 12px; top: 50%; transform: translateY(-50%);
  z-index: 60; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 10px; padding: 8px 10px; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08); transition: opacity 0.3s, left 0.3s;
}
.od-sidebar-toggle:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.od-sidebar-toggle svg { color: #374151; }
.od-toggle-progress { font-size: 11px; font-weight: 600; color: #7c3aed; }
.od-sidebar-open .od-sidebar-toggle { opacity: 0; pointer-events: none; }

.od-sb-module { border-bottom: 1px solid #f3f4f6; }

.od-sb-mod-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; cursor: pointer; background: #f9fafb; transition: background 0.15s;
}
.od-sb-mod-hdr:hover { background: #f3f4f6; }

.od-sb-mod-title {
  font-size: 13px; font-weight: 600; color: #111827; flex: 1;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.od-sb-mod-count { font-size: 11px; color: #9ca3af; margin-left: 8px; white-space: nowrap; }

.od-sb-items { transition: max-height 0.3s ease; overflow: hidden; }
.od-sb-collapsed .od-sb-items { max-height: 0 !important; }

.od-sb-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 16px 10px 20px; text-decoration: none; color: #374151;
  border-left: 3px solid transparent; transition: background 0.15s, border-color 0.15s;
}
.od-sb-item:hover { background: #f9fafb; text-decoration: none; color: #374151; }
.od-sb-item.active { background: #eff6ff; border-left-color: #3b82f6; }
.od-sb-item.done .od-sb-check { color: #059669; }

.od-sb-check { font-size: 12px; width: 18px; text-align: center; flex-shrink: 0; margin-top: 2px; color: #d1d5db; }
.od-sb-item.active .od-sb-check { color: #3b82f6; }

.od-sb-info { flex: 1; min-width: 0; }
.od-sb-item-title { font-size: 13px; line-height: 1.4; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.od-sb-item.done .od-sb-item-title { color: #6b7280; }
.od-sb-item-meta { font-size: 11px; color: #9ca3af; display: block; margin-top: 1px; text-transform: capitalize; }

/* ══════════════════════════════════════════
   AUTO-ADVANCE OVERLAY
   ══════════════════════════════════════════ */
.od-upnext {
  position: fixed; bottom: 20px; right: 20px; z-index: 1000;
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease; pointer-events: none;
}
.od-upnext.od-upnext-show { opacity: 1; transform: translateY(0); pointer-events: auto; }

.od-upnext-inner {
  background: #1e1b4b; color: #fff; border-radius: 14px;
  padding: 18px 22px; min-width: 280px; max-width: 360px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.od-upnext-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #a5b4fc; margin-bottom: 6px; }
.od-upnext-title { font-size: 15px; font-weight: 600; line-height: 1.4; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.od-upnext-timer { font-size: 13px; color: #c4b5fd; margin-bottom: 14px; }
.od-upnext-sec { font-weight: 700; color: #fbbf24; font-size: 15px; }
.od-upnext-actions { display: flex; align-items: center; gap: 10px; }

.od-upnext-go {
  display: inline-block; background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff; padding: 8px 18px; border-radius: 8px; font-size: 13px;
  font-weight: 600; text-decoration: none; transition: background 0.2s;
}
.od-upnext-go:hover { background: linear-gradient(135deg, #6d28d9, #5b21b6); color: #fff; text-decoration: none; }

.od-upnext-cancel {
  background: none; border: 1px solid rgba(255,255,255,0.2); color: #c4b5fd;
  padding: 7px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; transition: background 0.2s;
}
.od-upnext-cancel:hover { background: rgba(255,255,255,0.08); }

/* ══════════════════════════════════════════
   LANDING / SALES PAGE
   ══════════════════════════════════════════ */
.od-landing {
  max-width: 1100px; margin: 0 auto; padding: 0 20px 40px;
  -webkit-font-smoothing: antialiased;
}

.od-hero {
  background: linear-gradient(135deg, #faf5ff 0%, #ede9fe 50%, #e0e7ff 100%);
  border-radius: 20px; padding: 48px 40px; margin-bottom: 32px;
}

.od-hero-inner { display: flex; gap: 40px; align-items: flex-start; }
.od-hero-left { flex: 1; min-width: 0; }
.od-hero-right { width: 300px; flex-shrink: 0; }
.od-hero-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.od-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 6px; letter-spacing: 0.04em; }
.od-badge-level { background: #fef3c7; color: #92400e; }
.od-badge-mode { background: #d1fae5; color: #065f46; }
.od-badge-session { background: #e0e7ff; color: #3730a3; }

.od-hero-title { font-size: 32px; font-weight: 800; color: #111827; margin: 0 0 12px; line-height: 1.2; }
.od-hero-desc { font-size: 16px; color: #4b5563; line-height: 1.65; margin: 0 0 20px; }

.od-hero-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.od-meta-item { font-size: 14px; color: #374151; }
.od-meta-dot { color: #d1d5db; font-size: 10px; }

.od-hero-instructor { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }

.od-instructor-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 17px;
}

.od-instructor-name { font-weight: 600; color: #111827; font-size: 14px; }
.od-instructor-role { font-size: 12px; color: #6b7280; }

.od-hero-cta-wrap { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.od-cta-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #7c3aed, #6d28d9); color: #fff;
  padding: 13px 28px; border-radius: 12px; font-size: 15px; font-weight: 600;
  text-decoration: none; box-shadow: 0 4px 14px rgba(124,58,237,0.25);
  transition: transform 0.2s, box-shadow 0.2s;
}
.od-cta-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,58,237,0.35); color: #fff; text-decoration: none; }

.od-cta-secondary {
  display: inline-block; padding: 12px 24px; border: 1.5px solid #7c3aed;
  color: #7c3aed; border-radius: 12px; font-size: 14px; font-weight: 600;
  text-decoration: none; transition: background 0.2s;
}
.od-cta-secondary:hover { background: rgba(124,58,237,0.06); text-decoration: none; color: #6d28d9; }

.od-preview-card { background: #fff; border-radius: 16px; box-shadow: 0 8px 30px rgba(0,0,0,0.08); overflow: hidden; }
.od-preview-card-header { padding: 24px; text-align: center; background: #faf5ff; border-bottom: 1px solid #f3e8ff; }
.od-preview-card-body { display: flex; justify-content: space-around; padding: 16px 20px; border-bottom: 1px solid #f3f4f6; }

.od-preview-stat { text-align: center; }
.od-preview-stat-num { display: block; font-size: 20px; font-weight: 700; color: #7c3aed; }
.od-preview-stat-lbl { font-size: 11px; color: #9ca3af; }

.od-preview-card-features { padding: 16px 20px; }
.od-feature-item { font-size: 13px; color: #374151; padding: 6px 0; border-bottom: 1px solid #f9fafb; }
.od-feature-item:last-child { border-bottom: none; }

.od-preview-thumb { width: 100%; height: 180px; object-fit: cover; display: block; }

.od-rating-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.od-rating-stars { display: flex; gap: 2px; }
.od-rating-text { font-size: 14px; color: #6b7280; font-weight: 500; }

.od-free-badge {
  display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 6px;
  background: #d1fae5; color: #065f46; font-size: 11px; font-weight: 600;
}

.od-section { background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; padding: 28px; margin-bottom: 24px; }
.od-section-title { font-size: 20px; font-weight: 700; margin: 0 0 18px; color: #111827; }
.od-curriculum-summary { font-size: 13px; color: #6b7280; margin-bottom: 16px; }
.od-learn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
.od-learn-item { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: #374151; line-height: 1.5; }
.od-learn-check { flex-shrink: 0; margin-top: 3px; }

.od-bottom-cta {
  text-align: center; padding: 40px 20px;
  background: linear-gradient(135deg, #f5f3ff, #ede9fe); border-radius: 16px; margin-top: 8px;
}
.od-bottom-cta h3 { font-size: 22px; font-weight: 700; color: #111827; margin: 0 0 8px; }
.od-bottom-cta p { font-size: 14px; color: #6b7280; margin: 0 0 20px; }

.od-cart-toast {
  position: fixed; top: 24px; right: 24px; z-index: 9999;
  padding: 14px 22px; border-radius: 12px; background: #1e1b4b;
  color: #fff; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2); transform: translateY(-20px);
  opacity: 0; transition: all 0.4s cubic-bezier(0.16,1,0.3,1);
  pointer-events: none; display: flex; align-items: center; gap: 10px;
}
.od-cart-toast.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.od-toast-icon { color: #a5f3fc; font-size: 16px; }
.od-cart-toast a { color: #c4b5fd; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ══════════════════════════════════════════
   FIX #1: PAYMENT PENDING BANNER
   ══════════════════════════════════════════ */
.od-pending-banner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 28px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  border-radius: 16px;
  margin-bottom: 8px;
}

.od-pending-icon {
  font-size: 32px;
  flex-shrink: 0;
  line-height: 1;
}

.od-pending-text strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 6px;
}

.od-pending-text p {
  font-size: 14px;
  color: #78350f;
  line-height: 1.6;
  margin: 0;
}

/* ══════════════════════════════════════════
   FIX #6: STUDENT REVIEWS
   ══════════════════════════════════════════ */
.od-reviews-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.od-review-card {
  padding: 16px 0;
  border-bottom: 1px solid #f3f4f6;
}

.od-review-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.od-review-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.od-review-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4338ca;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.od-review-meta {
  flex: 1;
  min-width: 0;
}

.od-review-name {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
}

.od-review-stars {
  font-size: 13px;
  color: #f59e0b;
  letter-spacing: 1px;
}

.od-review-date {
  font-size: 12px;
  color: #9ca3af;
  margin-left: 8px;
  letter-spacing: 0;
}

.od-review-text {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.65;
  margin: 0;
}

/* ══════════════════════════════════════════
   FIX #3: ENROLLED BADGE ON DISCOVER PAGE
   ══════════════════════════════════════════ */
.od-badge-enrolled {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #065f46;
}

.od-card-enrolled-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #e5e7eb;
}

.od-card-enrolled-bar {
  height: 100%;
  background: linear-gradient(90deg, #059669, #10b981);
  border-radius: 0 2px 2px 0;
  transition: width 0.3s ease;
}

/* ══════════════════════════════════════════
   COURSE DISCOVERY PAGE
   ══════════════════════════════════════════ */
.od-course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.od-course-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 16px;
  overflow: hidden; text-decoration: none; color: inherit;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex; flex-direction: column;
}
.od-course-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.08); text-decoration: none; color: inherit; }

.od-card-thumb {
  height: 160px; overflow: hidden; background: #f9fafb; position: relative;
}
.od-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.od-card-thumb-placeholder { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #ede9fe, #e0e7ff); }
.od-card-thumb-placeholder span { font-size: 36px; font-weight: 800; color: #7c3aed; opacity: 0.4; }

.od-card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.od-card-badges { display: flex; gap: 6px; margin-bottom: 10px; }

.od-card-title {
  font-size: 16px; font-weight: 700; color: #111827; line-height: 1.35;
  margin: 0 0 6px; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

.od-card-instructor { font-size: 13px; color: #6b7280; margin: 0 0 8px; }

.od-card-rating { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; font-size: 13px; }
.od-card-rating-num { font-weight: 700; color: #92400e; }
.od-card-rating-stars { color: #f59e0b; letter-spacing: 1px; }
.od-card-rating-count { color: #9ca3af; }

.od-card-meta { display: flex; gap: 4px; font-size: 12px; color: #9ca3af; margin-top: auto; }

/* ══════════════════════════════════════════
   TAG FILTER BAR
   ══════════════════════════════════════════ */
.od-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
  padding: 0 8px;
}

.od-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  background: #fff;
  border: 1px solid #e5e7eb;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.od-filter-pill:hover {
  border-color: #7c3aed;
  color: #7c3aed;
  text-decoration: none;
  background: #faf5ff;
}

.od-filter-pill.active {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff;
  border-color: transparent;
}

.od-filter-pill.active:hover {
  color: #fff;
  background: linear-gradient(135deg, #6d28d9, #5b21b6);
}

.od-filter-count {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0,0,0,0.08);
  min-width: 18px;
  text-align: center;
}

.od-filter-pill.active .od-filter-count {
  background: rgba(255,255,255,0.25);
}

.od-filter-active {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 10px 16px;
  background: #f5f3ff;
  border-radius: 10px;
  font-size: 13px;
  color: #4b5563;
}

.od-filter-clear {
  color: #7c3aed;
  font-weight: 600;
  text-decoration: none;
  font-size: 13px;
}

.od-filter-clear:hover {
  color: #5b21b6;
  text-decoration: none;
}

/* ══════════════════════════════════════════
   CARD DESCRIPTION & TAGS
   ══════════════════════════════════════════ */
.od-card-desc {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.od-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.od-card-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: #f3f4f6;
  color: #6b7280;
  letter-spacing: 0.02em;
}

/* ══════════════════════════════════════════
   MOBILE
   ══════════════════════════════════════════ */
@media (max-width: 900px) {
  .od-sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; z-index: 200;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  .od-sidebar-open .od-sidebar { transform: translateX(0); margin-left: 0; }
  .od-sidebar-toggle {
    left: 8px; top: auto; bottom: 70px; transform: none;
    border-radius: 50%; padding: 10px; width: 44px; height: 44px; justify-content: center;
  }
  .od-toggle-progress { display: none; }
  .od-sidebar-open::after {
    content: ''; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 190;
  }
  .od-upnext { bottom: 12px; right: 12px; left: 12px; }
  .od-upnext-inner { min-width: auto; max-width: none; }

  .od-hero { padding: 28px 20px; }
  .od-hero-inner { flex-direction: column; gap: 24px; }
  .od-hero-right { width: 100%; }
  .od-hero-title { font-size: 24px; }
  .od-learn-grid { grid-template-columns: 1fr; }
  .od-section { padding: 20px; }
  .od-course-grid { grid-template-columns: 1fr; }
  .od-pending-banner { flex-direction: column; gap: 10px; }
  .od-filter-bar { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
  .od-filter-active { flex-direction: column; gap: 6px; text-align: center; }
}

/* Admin: hide virtual lessons */
body.lcm-ondemand-admin .lcm-lesson-row[data-virtual="1"],
body.lcm-ondemand-admin [data-lesson-title^="__virtual__"] { display: none !important; }
