/* RESET */

.container { max-width:1180px; margin:0 auto; padding:0 18px; }

/* ========== GLOBAL RESET & TYPOGRAPHY ========== */
:root {
    --primary-color: #0f1c61;
    --accent-color: #4f6df5;
    --secondary-color: #ff6b6b;
    --light-bg: #f9f9f9;
    --card-bg: #fff;
    --dark-text: #333;
    --light-text: #fff;
    --footer-bg: #09001c;
    --accent-yellow: #f1c40f;
    --link-color: #f1c40f;

}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Poppins", Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark-text);
    background: var(--light-bg);
  min-height: 100vh;

  align-items: center;
  justify-content: center;

}

a {
    text-decoration: none;
    color: var(--link-color);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-yellow);
}

/* ========== TOPBAR ========== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--primary-color);
    color: var(--light-text);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.topbar .logo a {
    color: var(--light-text);
    font-weight: 800;
    font-size: 1.3rem;
    text-decoration: none;
}

nav {
    display: flex;
    gap: 15px;
}

nav a {
    color: var(--light-text);
    text-decoration: none;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}
nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Hamburger button (hidden on desktop) */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    cursor: pointer;
    gap: 5px;
}
.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--light-text);
    border-radius: 2px;
    transition: 0.3s;
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

@media (max-width: 768px) {
    nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--primary-color);
        padding: 15px 20px;
        box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    }
    nav.active { display: flex; }

    .hamburger { display: flex; }}



/* HERO */
.cd-hero {
  background: linear-gradient(90deg, #ffffff 0%, #f3f7ff 100%);
  padding:28px 0;
  border-bottom:1px solid #e6eef7;
}
.cd-hero-inner {
  display:flex;
  gap:20px;
  align-items:center;
  flex-wrap:wrap;
}
.cd-hero-left { flex:1 1 250px; }
.cd-hero-right { flex:0 0 300px; text-align:center; }
.course-thumb {
  width:100%;
  max-width:300px;
  border-radius:10px;
  box-shadow:0 8px 24px rgba(13,30,60,0.08);
}
.cd-hero h1 { margin:0 0 8px; font-size:clamp(20px, 3vw, 28px); color:#0f1c61; }
.lead { color:#374151; margin-top:10px; font-size:clamp(14px, 2vw, 16px); }
.meta { color:#6b7280; font-size:0.9rem; margin-bottom:6px; }
.cta-row {
  margin-top:14px;
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
}
.btn {
  display:inline-block;
  padding:10px 14px;
  border-radius:8px;
  text-decoration:none;
  font-weight:600;
  font-size:0.9rem;
}
.btn-primary { background:#0077ff; color:#fff; }
.price { font-weight:700; color:#16a34a; }


img {
  max-width: 100%;
  height: auto;
}

/* MAIN LAYOUT */
.cd-main {
  /*display:grid;*/
  grid-template-columns: 260px 1fr;
  gap:22px;
  padding:28px 18px;
  align-items:start;
}
.toc {
  position:sticky;
  top:84px;
  align-self:start;
}
.toc-box {
  background:#fff;
  padding:12px;
  border-radius:8px;
  box-shadow:0 6px 18px rgba(6,24,63,0.06);
}
.toc-box h3 { margin:0 0 8px; font-size:1rem; }
.toc-box ul { list-style:none; padding:0; margin:0; }
.toc-box li a {
  display:block;
  padding:6px;
  color:#0f1c61;
  text-decoration:none;
  border-radius:6px;
  font-size:0.9rem;
}
.toc-box li a:hover { background:#f1f5ff; }

/* CONTENT */
.topic {
  background:#fff;
  padding:18px;
  border-radius:10px;
  margin-bottom:18px;
  box-shadow:0 6px 18px rgba(6,24,63,0.04);
}
.topic h3{
    margin-top: 15px;
}
.topic-head {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.topic-head h2 {
  margin:0;
  font-size:clamp(16px, 2.5vw, 20px);
  color:#0f1c61;
}
.toggle-btn {
  background:transparent;
  border:1px solid #e6eef7;
  padding:6px 8px;
  border-radius:6px;
  cursor:pointer;
  font-size:0.85rem;
}
.topic-body { margin-top:12px; font-size:0.95rem; }
.note { color:#374151; }
.preview {
  color:#4b5563;
  font-style:italic;
  background:#fff8f0;
  padding:10px;
  border-radius:6px;
  border:1px solid #ffedd5;
}
.locked-overlay {
  margin-top:12px;
  padding:12px;
  background:#fff7ed;
  border-left:4px solid #f59e0b;
  border-radius:6px;
}

.topic.locked {
    background: #f9f9f9;
    border: 1px dashed #ccc;
    padding: 12px;
    border-radius: 6px;
    color: #555;
    font-style: italic;
}



/* CODE */
.code-block {
  position: relative; /* needed for absolute positioning of button */
  background: #0b1220;
  color: #e6eef8;
  padding: 12px;
  border-radius: 8px;
  overflow: auto;
  font-family: monospace;
  font-size: 0.85rem;
  margin-top: 16px;
}

.code-block pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
}

/* Copy button at top-right inside code block */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  z-index: 10;
  transition: background 0.2s;
}

.copy-btn:hover {
  background: #3730a3;
}

code {
  /*white-space: pre-wrap;*/
  word-wrap: break-word;
  overflow-x: auto;
}
.note, .preview {
  word-wrap: break-word;
  overflow-wrap: break-word;
}




/* RELATED */
.related { margin-top:28px; }
.related-grid { display:flex; gap:12px; flex-wrap:wrap; margin-bottom: 10px;}
.related-card {
  display:flex;
  gap:10px;
  align-items:center;
  background:#fff;
  padding:8px;
  border-radius:8px;
  text-decoration:none;
  color:inherit;
  border:1px solid #eef2ff;
  min-width:180px;
  /*flex:1;*/
  font-size: 0.8rem;
}
.related-card img {
  width:72px;
  height:48px;
  object-fit:cover;
  border-radius:6px;
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 1024px) {
  .cd-main { grid-template-columns: 220px 1fr; }
}
@media (max-width: 900px) {
  .cd-main { grid-template-columns: 1fr; }
  .toc { position:relative; top:auto; margin-bottom:16px; }
}
@media (max-width: 600px) {
  .cd-hero-inner { flex-direction:column; text-align:center; }
  .cd-hero-right { flex:1 1 auto; }
  .cta-row { flex-direction:column; align-items:stretch; }
  .btn { width:100%; text-align:center; }
  .topic { padding:14px; }
  .related-card { flex:1 1 100%; }
}
/* ----------------- Pagination ----------------- */
.pagination-wrapper {
  width: 100%;
  overflow-x: auto; /* horizontal scroll if too wide */
  -webkit-overflow-scrolling: touch;
}

.pagination {
  display: flex;
  flex-wrap: wrap; /* wrap if needed */
  justify-content: center;
  gap: 4px;
  padding: 10px 0;
  list-style: none;
}

.pagination a.page-link {
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
  min-width: 30px;
  text-align: center;
  flex: 0 0 auto; /* prevent shrinking */
}

.pagination a.page-link.active {
  background-color: #007bff;
  color: #fff;
  border-color: #007bff;
}

.pagination .dots {
  padding: 6px 12px;
  color: #888;
}

@media (max-width: 767px) {
  .pagination {
    flex-wrap: nowrap; /* keep in one line if scrolling */
  }

  .pagination a.page-link,
  .pagination .dots {
    flex: 0 0 auto;
    padding: 4px 8px;
    font-size: 14px;
  }
}

/* ----------------- TOC Sidebar ----------------- */
.toc {
  flex: 0 0 250px; /* sidebar width on desktop */
  margin-right: 20px;
  position: sticky; /* sticky on desktop */
  top: 80px;
  max-height: calc(85vh - 100px);
  overflow-y: auto;
  padding-right: 8px;
}

.toc-box {
  background: #fff;
  border: 1px solid #ddd;
  padding: 12px;
  border-radius: 6px;
}

.toc-box ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.toc-box li {
  margin-bottom: 6px;
}

.toc-link {
  text-decoration: none;
  color: #333;
  display: block;
  padding: 2px 4px;
  border-radius: 3px;
}

.toc-link.active,
.toc-link.highlight {
  font-weight: bold;
  color: #007bff;
  background: #eef5ff;
  border-radius: 4px;
  padding: 2px 4px;
}

/* ----------------- Main Layout ----------------- */


/* ----------------- Responsive ----------------- */
/* Desktop / Tablet */
@media (min-width: 768px) {
  .toc {
    position: sticky; /* sticky on desktop */
    top: 80px;
    max-height: calc(95vh - 100px);
    overflow-y: auto;
    flex: 0 0 250px;
    margin-right: 20px;
    padding-right: 8px;
  }
  
  .toc-box {
    background: #fff;
    border: 1px solid #ddd;
    padding: 12px;
    border-radius: 6px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .toc {
    position: revert; /* not sticky */
    max-height: 250px;   /* scrollable within card */
    overflow-y: auto;
    flex: 1 1 100%;
    margin-bottom: 20px;
    margin-right: 0;
    padding-right: 4px;
  }

  .toc-box {
    border: 1px solid #ddd;
    padding: 8px;
    border-radius: 6px;
    background: #fff;
  }

  .content-area {
    flex: 1 1 100%;
  }
}


.locked-msg.big-lock {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    padding: 70px 20px;
    border-radius: 8px;
    font-size: 1.5rem;
    text-align: center;
    color: #856404;
    margin: 20px 0;
    height: 30vh;
}
.locked-msg.big-lock a {
    font-weight: bold;
    color: #4f46e5;
    text-decoration: underline;
}







.course-details {
  display: flex;
  gap: 30px; /* space between summary and learning points */
  margin-top: 30px;
  align-items: baseline;
  background: #fbf3ff;
}

/* Left side: Summary */
.course-details .summary {
  flex: 1; /* takes equal width */
  font-size: 16px;
  color: #444;
  line-height: 1.6;
  text-align: justify;

}

/* Right side: Learning Points */
.course-details .learning_points {
  flex: 1;

  padding: 20px;
  border-radius: 8px;
  text-align: justify;
}

.course-details .learning_points strong {
  font-size: 18px;
  color: #222;
  display: block;
  margin-bottom: 10px;
}

.course-details .learning_points ul {
  list-style: disc;
  padding-left: 20px;
  margin: 0;
}

.course-details .learning_points li {
  margin-bottom: 8px;
  line-height: 1.5;
  font-size: 15px;
}
@media (max-width: 768px) {
  .course-details {
    flex-direction: column;
  }
}



.video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin: 1rem 0;
  border-radius: 10px;
}
.video-wrap video,
.video-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}


/* Quiz Section */
.quiz-section {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.quiz-section:hover {
    transform: translateY(-2px);
}

.quiz-section h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 15px;
    border-bottom: 2px solid #af4c4c;
    padding-bottom: 5px;
}

/* Individual Questions */
.quiz-question {
    margin-bottom: 20px;
    padding: 15px;
    border-left: 5px solid #af4c4c;
    background: #fff;
    border-radius: 8px;
    transition: all 0.3s;
}

.quiz-question p {
    font-weight: 500;
    color: #222;
    margin-bottom: 10px;
}

/* Options List */
.quiz-options {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quiz-options li {
    margin-bottom: 10px;
}

.quiz-options label {
    display: block;
    position: relative;
    padding: 10px 15px;
    background: #f1f1f1;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s, box-shadow 0.3s;
    user-select: none;
}

.quiz-options label:hover {
    background: #e0f7fa;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.quiz-options input[type="radio"] {
    margin-right: 10px;
    accent-color: #4CAF50; /* Modern green radio */
}

/* Feedback */
.quiz-feedback {
    margin-top: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Correct / Wrong / Warning colors */
.quiz-feedback span {
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-block;
}

.quiz-feedback span[style*="green"] {
    background: #d4edda;
    color: #155724;
}

.quiz-feedback span[style*="red"] {
    background: #f8d7da;
    color: #721c24;
}

.quiz-feedback span[style*="orange"] {
    background: #fff3cd;
    color: #856404;
}

/* Submit Button */
.quiz-form button[type="submit"] {
    background: #4CAF50;
    color: #fff;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.quiz-form button[type="submit"]:hover {
    background: #45a049;
    transform: translateY(-2px);
}




/* ==================== Like & Comment Section ==================== */
/* Comment input + submit button */
.comment-section .comment-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.comment-section textarea {
    flex: 1;
    min-height: 80px;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    resize: vertical;
    transition: all 0.2s ease;
}

.comment-section textarea:focus {
    border-color: #4f6df5;
    outline: none;
    box-shadow: 0 0 6px rgba(79,109,245,0.3);
}

.comment-section button.submitComment {
    background: #4f6df5;
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-end;
}

.comment-section button.submitComment:hover {
    background: #3b53c9;
}

/* Like button below */
.comment-section .like-section {
    margin-bottom: 12px;
}


.likeBtn.liked {
  color: #fff;
  background-color: #4f6df5;
  border-color: #4f6df5;
}

.comment-section .like-section button.likeBtn {
    background: #ffcc005c;
    color: #000;
    font-size: 10px;
    font-weight: 500;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comment-section .like-section button.likeBtn:hover {
    background: #e6b800;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .comment-section .comment-input-wrapper {
        flex: 1;
    }

    .comment-section button.submitComment {
        /*width: 100%;*/
    }

    .comment-section .like-section button.likeBtn {
        /*width: 100%;*/
    }
}

