/* ============================================================
   RRPCO — Course Details Page
   ============================================================ */

:root{
  --brand:#0d6efd;
  --brand-dark:#0b5cd6;
  --brand-light:#3b82f6;
  --ink:#0f172a;
  --ink-soft:#475569;
  --muted:#94a3b8;
  --line:#e7eaf2;
  --bg:#f5f7fb;
  --card:#ffffff;
  --success:#16a34a;
  --radius-lg:18px;
  --radius-md:12px;
  --radius-sm:8px;
  --shadow-sm:0 2px 8px rgba(15,23,42,0.05);
  --shadow-md:0 10px 30px rgba(15,23,42,0.07);
  --shadow-lg:0 20px 50px rgba(13,110,253,0.12);
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family:'Plus Jakarta Sans','Segoe UI',sans-serif;
  background:var(--bg);
  color:var(--ink);
  -webkit-font-smoothing:antialiased;
}

a{ text-decoration:none; }
ul{ margin:0; padding:0; }

/* ===== NAVBAR ===== */
.header{
  position:fixed;
  top:0; left:0;
  width:100%;
  height:64px;
  background:linear-gradient(120deg,#0b5cd6 0%, #0d6efd 45%, #3b82f6 100%);
  display:flex;
  align-items:center;
  z-index:1000;
  box-shadow:0 6px 24px rgba(13,110,253,0.18);
}

.header .container{
  width:100%;
  max-width:1400px;
  margin:0 auto;
  padding:0 24px;
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.header h5{
  margin:0;
  font-weight:700;
  letter-spacing:0.2px;
  color:#fff;
  font-size:16px;
  display:flex;
  align-items:center;
  gap:8px;
}

.header h5::before{
  content:"";
  width:8px;
  height:8px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 0 0 4px rgba(255,255,255,0.25);
}

.btn-back{
  background:rgba(255,255,255,0.95);
  color:var(--brand);
  padding:8px 16px;
  border-radius:50px;
  font-weight:600;
  font-size:13.5px;
  transition:.2s;
}
.btn-back:hover{ transform:translateY(-1px); box-shadow:0 6px 16px rgba(0,0,0,0.15); }

/* ===== PAGE OFFSET ===== */
.page{ margin-top:64px; }

/* ===== MOBILE MENU BUTTON ===== */
.mobile-menu{
  position:fixed;
  top:76px;
  left:16px;
  display:flex;
  align-items:center;
  gap:8px;
  background:linear-gradient(120deg,var(--brand-dark),var(--brand-light));
  color:#fff;
  padding:10px 16px;
  border-radius:50px;
  font-weight:600;
  font-size:14px;
  box-shadow:0 8px 20px rgba(13,110,253,0.3);
  cursor:pointer;
  z-index:1100;
  transition:.2s;
}
.mobile-menu:active{ transform:scale(0.96); }

@media (min-width:992px){
  .mobile-menu{ display:none; }
}

/* ===== WRAPPER / GRID LAYOUT ===== */
.wrapper{
  max-width:1400px;
  margin:0 auto;
  padding:24px;
  display:grid;
  grid-template-columns:260px minmax(0,1fr) 290px;
  gap:24px;
  align-items:start;
}

@media (max-width:1200px){
  .wrapper{ grid-template-columns:240px minmax(0,1fr) 270px; }
}

@media (max-width:992px){
  .wrapper{
    grid-template-columns:1fr;
    padding:20px 16px 40px;
    padding-top:64px;
  }
}

/* ===== SIDEBAR (LEFT) ===== */
.course-list{
  position:sticky;
  top:84px;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius-lg);
  padding:18px;
  box-shadow:var(--shadow-sm);
  max-height:calc(100vh - 104px);
  overflow-y:auto;
}

.course-list::-webkit-scrollbar{ width:5px; }
.course-list::-webkit-scrollbar-thumb{ background:#dbe2f0; border-radius:10px; }

.sidebar-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:14px;
  padding-bottom:12px;
  border-bottom:1px solid var(--line);
}

.sidebar-header h6{
  margin:0;
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:0.6px;
  color:var(--muted);
  font-weight:700;
}

.close-btn{
  background:#f1f5ff;
  border:none;
  font-size:14px;
  width:30px; height:30px;
  border-radius:50%;
  cursor:pointer;
  color:var(--brand);
}

#courseList li{
  list-style:none;
  padding:12px 14px;
  border-radius:var(--radius-sm);
  margin-bottom:6px;
  cursor:pointer;
  font-size:14px;
  font-weight:500;
  color:var(--ink-soft);
  transition:.18s;
  display:flex;
  align-items:center;
  gap:10px;
  line-height:1.3;
}

#courseList li::before{
  content:"";
  width:6px; height:6px;
  border-radius:50%;
  background:var(--muted);
  flex-shrink:0;
  transition:.18s;
}

#courseList li:hover{
  background:#f1f5ff;
  color:var(--brand-dark);
}

#courseList li.active{
  background:linear-gradient(120deg,var(--brand-dark),var(--brand-light));
  color:#fff;
  font-weight:600;
  box-shadow:0 8px 18px rgba(13,110,253,0.25);
}

#courseList li.active::before{
  background:#fff;
}

/* ===== MAIN ===== */
.main{ min-width:0; }

.box{
  background:var(--card);
  padding:24px;
  border-radius:var(--radius-lg);
  margin-bottom:20px;
  border:1px solid var(--line);
  box-shadow:var(--shadow-sm);
}

/* ----- Course header card ----- */
.course-head-top{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  margin-bottom:12px;
}

.pill-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  background:linear-gradient(120deg,#eaf1ff,#f3f7ff);
  color:var(--brand-dark);
  font-size:12px;
  font-weight:700;
  padding:6px 12px;
  border-radius:50px;
  letter-spacing:0.3px;
}

.pill-badge.level{
  background:#f1fbf4;
  color:var(--success);
}

#courseTitle{
  font-size:clamp(24px,3vw,32px);
  font-weight:800;
  margin:6px 0 10px;
  color:var(--ink);
  letter-spacing:-0.3px;
}

#courseDesc{
  color:var(--ink-soft);
  font-size:15px;
  line-height:1.7;
  margin:0 0 18px;
  max-width:720px;
}

.meta-row{
  display:flex;
  flex-wrap:wrap;
  gap:14px;
}

.meta-chip{
  display:flex;
  align-items:center;
  gap:10px;
  background:var(--bg);
  border:1px solid var(--line);
  border-radius:var(--radius-md);
  padding:10px 16px;
  font-size:13.5px;
  color:var(--ink-soft);
}

.meta-chip strong{
  color:var(--ink);
  font-weight:700;
  display:block;
  font-size:14.5px;
}

.meta-chip .icon{
  width:34px; height:34px;
  border-radius:10px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(120deg,var(--brand-dark),var(--brand-light));
  color:#fff;
  font-size:16px;
  flex-shrink:0;
}

/* ----- Search + Toggle box ----- */
.search-toggle{
  display:flex;
  flex-direction:column;
  gap:12px;
}

@media (min-width:768px){
  .search-toggle{ flex-direction:row; align-items:center; }
}

.search-wrap{
  position:relative;
  flex:1;
}

.search-wrap .icon-search{
  position:absolute;
  left:14px;
  top:50%;
  transform:translateY(-50%);
  color:var(--muted);
  font-size:14px;
}

#chapterSearch{
  width:100%;
  padding:12px 14px 12px 38px;
  border-radius:50px;
  border:1px solid var(--line);
  background:var(--bg);
  font-size:14px;
  outline:none;
  transition:.2s;
}
#chapterSearch:focus{
  border-color:var(--brand);
  background:#fff;
  box-shadow:0 0 0 4px rgba(13,110,253,0.1);
}

.btn-toggle-all{
  border:none;
  background:linear-gradient(120deg,var(--brand-dark),var(--brand-light));
  color:#fff;
  padding:12px 20px;
  border-radius:50px;
  font-weight:600;
  font-size:13.5px;
  cursor:pointer;
  white-space:nowrap;
  transition:.2s;
  box-shadow:0 8px 18px rgba(13,110,253,0.2);
}
.btn-toggle-all:hover{ transform:translateY(-1px); }
.btn-toggle-all:active{ transform:scale(0.97); }

/* ----- Course content box ----- */
.content-head{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  margin-bottom:6px;
}

.content-head h4{
  margin:0;
  font-size:19px;
  font-weight:800;
}

.content-head span{
  font-size:13px;
  color:var(--muted);
  font-weight:600;
}

#chapters{ margin-top:10px; }

.chapter{
  border-bottom:1px solid var(--line);
}
.chapter:last-child{ border-bottom:none; }

.chapter-header{
  cursor:pointer;
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-weight:600;
  padding:16px 4px;
  font-size:14.5px;
  color:var(--ink);
  transition:.15s;
}
.chapter-header:hover{ color:var(--brand-dark); }

.chapter-title{
  display:flex;
  align-items:center;
  gap:12px;
}

.chapter-num{
  font-size:12px;
  font-weight:800;
  color:var(--brand);
  background:#eaf1ff;
  width:28px; height:28px;
  border-radius:8px;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}

.toggle-icon{
  width:26px; height:26px;
  border-radius:50%;
  background:var(--bg);
  border:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:15px;
  color:var(--brand);
  flex-shrink:0;
}

.subtopics{
  max-height:0;
  overflow:hidden;
  transition:max-height 0.3s ease;
  padding-left:40px;
}

.subtopics li{
  list-style:none;
  font-size:13.8px;
  color:var(--ink-soft);
  padding:7px 0;
  position:relative;
  padding-left:18px;
}

.subtopics li::before{
  content:"";
  position:absolute;
  left:0;
  top:14px;
  width:6px; height:6px;
  border-radius:50%;
  background:var(--brand-light);
}

#emptyState{
  display:none;
  text-align:center;
  padding:30px 10px;
  color:var(--muted);
  font-size:14px;
}

/* ===== RIGHT SIDEBAR ===== */
.sidebar{
  position:sticky;
  top:84px;
}

.price-box{
  text-align:center;
  background:linear-gradient(160deg,#ffffff 0%, #f4f8ff 100%);
}

.price-row{
  display:flex;
  align-items:baseline;
  justify-content:center;
  gap:10px;
  margin-bottom:4px;
}

.price{
  font-size:32px;
  font-weight:800;
  color:var(--brand-dark);
}

.old-price{
  font-size:16px;
  color:var(--muted);
  text-decoration:line-through;
}

.price-note{
  font-size:12.5px;
  color:var(--muted);
  margin-bottom:18px;
}

.btn-buy{
  display:block;
  width:100%;
  background:linear-gradient(120deg,var(--brand-dark),var(--brand-light));
  color:#fff;
  font-weight:700;
  font-size:15px;
  padding:14px;
  border-radius:50px;
  text-align:center;
  box-shadow:0 10px 24px rgba(13,110,253,0.3);
  transition:.2s;
  border:none;
}
.btn-buy:hover{ transform:translateY(-2px); box-shadow:0 14px 28px rgba(13,110,253,0.38); color:#fff;}
.btn-buy:active{ transform:scale(0.98); }

.features{
  text-align:left;
  margin-top:22px;
  padding-top:18px;
  border-top:1px solid var(--line);
}

.features li{
  list-style:none;
  font-size:13.8px;
  color:var(--ink-soft);
  margin-bottom:12px;
  display:flex;
  align-items:center;
  gap:10px;
}

.features li .check{
  width:20px; height:20px;
  border-radius:50%;
  background:#e9f9ee;
  color:var(--success);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:11px;
  flex-shrink:0;
}

.help-box{
  text-align:center;
  padding:20px;
}

.help-box .icon-help{
  font-size:24px;
  margin-bottom:8px;
}

.help-box p{
  font-size:13px;
  color:var(--ink-soft);
  margin:0 0 12px;
}

.help-box a{
  font-size:13.5px;
  font-weight:700;
  color:var(--brand);
}

/* ===== OVERLAY ===== */
.overlay{
  position:fixed;
  top:0; left:0;
  width:100%; height:100%;
  background:rgba(15,23,42,0.45);
  opacity:0;
  visibility:hidden;
  transition:.3s;
  z-index:950;
}
.overlay.show{ opacity:1; visibility:visible; }

/* ===== MOBILE LAYOUT FIXES ===== */
@media (max-width:992px){

  .course-list{
    position:fixed;
    top:0; left:-300px;
    width:280px;
    height:100%;
    max-height:none;
    border-radius:0;
    z-index:1200;
    transition:left .3s ease;
    padding-top:24px;
  }

  .course-list.active{ left:0; }

  .sidebar{ position:static; }

  .meta-row{ gap:10px; }
  .meta-chip{ flex:1 1 140px; }
}

@media (max-width:576px){
  .header .container{ padding:0 16px; }
  .header h5{ font-size:14px; }
  .btn-back{ padding:7px 12px; font-size:12.5px; }

  .box{ padding:18px; }
  #courseTitle{ font-size:24px; }
  .meta-chip{ flex:1 1 100%; }
  .price{ font-size:28px; }
}