/* CSS Variables */
:root {
    --background: hsl(0, 13%, 94%);
    --foreground: #1a1a1a;
    --card: rgb(236, 233, 232);
    --primary: rgb(95, 45, 12);
    --primary-foreground: #ffffff;
    --primary-hover: #493e3b;
    --secondary: #dadada;
    --muted: #747474;
    --muted-foreground: rgb(142, 93, 65);
    --border: #e1c9b5;
    --input: #e5e7eb;
    --input-background: #d4d2d2;
    --success: #048132;
    --success-foreground: #f2f2f2;
    --login-bg: #f3dcd4;
    --keyword : #250b1682;
    --string: #133821;
    --function: #0e212f;
    --sign: #5f1a1a;
    --radius: 0.5rem;
    --glass: 2px 2px 10px rgb(214, 205, 205);
}

.dark {
    --background: rgb(37, 35, 34);
    --foreground: #bbb9b7;
    --card: rgb(31, 25, 25);
    --card-foreground: #806f6f;
    --primary: rgb(173, 108, 67);
    --primary-foreground: #d0d0d0;
    --primary-hover: #5d453c;
    --muted: #9e9e9e;
    --muted-foreground: rgb(162, 112, 72);
    --border: #4b301d;
    --input: rgb(227, 98, 24);
    --input-background: #292727;
    --login-bg: #130500;
    --keyword : #f3ebee82;
    --string: #498761;
    --function: #6b8a9f;
    --sign: #8b4848;
    --glass: 2px 2px 20px rgb(41, 32, 32);
}

/* Reset */
* {
    margin: 0px;
    padding: 0px;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.5;
    padding: 0px;
}

/* Hide footer on login screen */
body.login-active footer {
    display: none;
}

.intro{
    color: var(--foreground);
}

/* Dark mode icons */
.sun-icon {
    display: none;
}

.dark .sun-icon {
    display: block;
}

.dark .moon-icon {
    display: none;
}

/* Main App */
.main-app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0px;
}


/* App Body */
.app-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    position: fixed;
    top: 5rem;
    left: 1rem;
    z-index: 50;
    padding: 0.5rem;
    background-color: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: none;
}

.mobile-menu-btn .close-icon {
    display: none;
}

.mobile-menu-btn.active .menu-icon {
    display: none;
}

.mobile-menu-btn.active .close-icon {
    display: block;
}

/* Sidebar */
.sidebar {
    width: 25vw;
    background-color: var(--background);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    transition: transform 0.3s;
}

.sidebar-content {
    padding: 8px;
}

.sidebar-content h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--foreground);
}

/*scrollbars for body and side-bar*/
body::-webkit-scrollbar{
    height: 0px;
    display: none;
}

.sidebar::-webkit-scrollbar , .main-content::-webkit-scrollbar{
  height: 3px;
  width: 3px;
    background: var(--background);
}

.sidebar::-webkit-scrollbar-thumb , .main-content::-webkit-scrollbar-thumb{
  background: var(--muted-foreground);
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: #9d9d9d;
}

.modules-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.module-item {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.module-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    padding-left: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: left;
    color: var(--foreground);
}

.module-header:hover {
    background-color: var(--muted);
}

.module-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.module-header-left svg {
    flex-shrink: 0;
    color: var(--muted-foreground);
}

.module-title-text {
    font-size: 0.875rem;
    font-weight: 500;
}

.module-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.module-progress {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.module-completed-icon {
    color: var(--success);
}

.lessons-list {
    background-color: rgba(255, 107, 53, 0.05);
    display: none;
}

.lessons-list.expanded {
    display: block;
}

.lesson-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px;
    padding-left: 25px;
    background: transparent;
    border: none;
    border-left: 4px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: left;
    color: var(--foreground);
    font-size: 0.875rem;
}

.lesson-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.lesson-item.active {
    background-color: rgba(255, 107, 53, 0.1);
    border-left-color: var(--muted-foreground);
    color: var(--muted-foreground);
    font-weight: 500;
}

.lesson-item svg {
    flex-shrink: 0;
}

.lesson-completed {
    color: var(--success);
}

.lesson-incomplete {
    color: var(--foreground);
    background-color: var(--background);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 30;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px 35px;
    overflow-y: auto;
    background-color: var(--background);
    margin: 0px;
}

.content-container {
    background-color: var(--background);
    max-width: 56rem;
    margin: 5px;
}

.lesson-header {
    padding: 5px;
    margin-bottom: 1.5rem;
    color: var(--foreground)
}

.module-title {
    font-size: 1.25rem;
    color: var(--muted-foreground);
    margin-bottom: 0.5rem;
}

.lesson-title {
    font-size: 1.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.completed-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--success);
    font-size: 0.89rem;
    font-weight: 500;
}

.lesson-content {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 10px;
    margin-bottom: 2rem;
    width: 100%;
}

.lesson-text {
    color: var(--foreground);
    line-height: 1.75;
    margin-bottom: 1.5rem;
}

.learning-points {
    margin-top: 2rem;
}

.learning-points h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--foreground);
}

.learning-points ul {
    list-style: disc;
    padding-left: 1.5rem;
}

.learning-points li {
    color: var(--muted-foreground);
    margin-bottom: 0.5rem;
}

.practice-section {
    background-color: var(--secondary);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-top: 2rem;
}

.practice-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.practice-section p {
    color: var(--muted-foreground);
}

.lesson-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.btn-complete {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-complete:hover {
    background-color: var(--primary-hover);
}

.completed-message {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        margin-top: 0.75rem;
    }

    .header-title {
        font-size: 1.125rem;
    }

    .welcome-text {
        font-size: 0.875rem;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        z-index: 40;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        padding: 2px;
    }

    .lesson-title {
        font-size: 1.5rem;
    }

    .lesson-content {
        padding: 1.5rem;
    }

    .lesson-actions {
        align-items: center;
    }

    .progress-bar-container {
        flex: 1;
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }

    .header-title {
        font-size: 1.5rem;
    }

    .header {
        padding: 1rem 1.5rem;
    }
}


/* Mobile sidebar */
@media (max-width: 768px) {
    body{
        padding: 5px;
    }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;          /* FULL viewport height */
    width: 85%;
    max-width: 320px;

    overflow-y: auto;       /* 🔑 THIS enables sidebar scrolling */
    -webkit-overflow-scrolling: touch;

    background: var(--background);
    z-index: 1001;
  }
  .mobile-menu-btn{
    z-index: 100000000;
  }
  .welcome-text{
    display: none;
  }
  .login-screen .dark-mode-toggle {
    top: 1rem;
    right: 1rem;
    padding: 0.75rem;}
}
    
.code-header {
    background: var(--background);
    color: var(--muted-foreground);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    border-radius: 5px 5px 0px 0px;
}

.code-language {
    font-weight: 600;
    font-size: 0.9em;
    letter-spacing: 1px;
}

.copy-btn {
    background: var(--background);
    color: var(--muted-foreground);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

svg.copy{
    fill: var(--foreground);
}

.copy-btn:hover {
    background: var(--background);
    transform: scale(1.05);
    border: 1 px solid var(--primary-foreground);
    border-radius: 5px;
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn.copied {
    background: var(--background);
}

pre {
    margin: 0;
    padding: 20px;
    overflow-x: auto;
    border-radius: 0px 0px 5px 5px;
}

.code-box{
    border-radius: 5px;
    background-color: var(--background);
}

code {
    color: var(--muted-foreground);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95em;
    line-height: 1.6;
    display: block;
    white-space: pre;
}

.keyword {
    color: var(--keyword);
}

.string {
    color: var(--string);
}

.function {
    color: var(--function);
}

.comment {
    color: #718096;
    font-style: italic;
}

.sign{
    color: var(--sign);
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }

    .code-header {
        flex-direction: row;
        align-items:  center;
        justify-content: space-between;
    }

    .copy-btn {
        align-self: stretch;
        justify-content: center;
    }
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--background);
    color: var(--foreground);
    padding: 10px;
    border-radius: 8px;
    box-shadow: var(--glass);
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    pointer-events: none;
    font-weight: 600;
    z-index: 1000;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* =========================
   COURSE EXPLORER FOOTER
========================= */
.cx-footer {
  background: var(--card);
  color: var(--foreground);
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem 2rem;
}

.cx-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* ---------- TOP ---------- */
.cx-footer-top {
  display: flex;
  flex-direction: column;
}

.cx-footer-brand {
  max-width: 360px;
}

.cx-footer-logo img {
  max-width: 200px;
  display: block;
  margin-bottom: 1rem;
}

.cx-footer-tagline {
  color: var(--muted-foreground);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ---------- COLUMNS ---------- */
.cx-footer-columns {
  display: flex;
  justify-content: space-between;
}

.cx-footer-column h4 {
  font-size: 0.95rem;
  margin-bottom: 5px;
  color: var(--foreground);
  letter-spacing: 0.5px;
}

.cx-footer-column ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cx-footer-column li {
  margin-bottom: 3px;
}

.cx-footer-column a {
  color: var(--foreground);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.cx-footer-column a:hover {
  color: var(--primary-hover);
}

/* ---------- BOTTOM ---------- */
.cx-footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.cx-footer-legal a {
  margin-right: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted-foreground);
  text-decoration: none;
}

.cx-footer-legal a:hover {
  color: var(--primary);
}

.cx-footer-copy {
  font-size: 0.85rem;
  color: var(--muted-foreground);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .cx-footer-top {
    grid-template-columns: 1fr;
  }

  .cx-footer-columns {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .cx-footer-columns {
    grid-template-columns: 1fr;
  }

  .cx-footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

.content{
  color: var(--foreground);
  margin: 5px;
}

.lesson-number{
    color: var(--muted-foreground);
}

header h1 {
  color: var(--muted-foreground);
  font-size: 2em;
}

.intro {
  font-style: italic;
  color: #555;
}

.timeline ul {
  list-style-type: none;
  padding: 0;
}

.timeline li {
  background: #e0f7fa;
  margin: 8px 0;
  padding: 10px;
  border-left: 4px solid #00796b;
}


.funfact {
  background: var(--background);
  padding: 15px;
  margin-top: 20px;
  color: var(--foreground)
}

.quiz {
  background: #fef2f2;
  padding: 15px;
  border-left: 4px solid #ef4444;
  margin-top: 20px;
}

.resources{
    margin-top: 20px;
    background-color: var(--background);
    padding: 10px;
    border-radius: 10px;
    box-shadow: var(--glass);
}

.resources ul {
  list-style-type: square;
  padding-left: 20px;
}

.resources a {
  color: var(--foreground);
  text-decoration: none;
}

.resources a:hover {
  text-decoration: underline;
}

body .app-active{
    padding: 10px;
}



/* Completion Badge */
.completed-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--background);
    color: #1f7a3f;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
}

/* Completion Message */
.fun-fact {
    background: var(--background);
    border: 1px solid var(--muted-foreground);
    padding: 14px;
    border-radius: 8px;
    margin-top: 12px;
    animation: fadeIn 0.3s ease;
    margin-top: 6px;
    font-size: 0.9rem;
    color: var(--foreground);
}


/* Complete Button */
.complete-btn {
    margin-top: 16px;
    padding: 10px 16px;
    background: var(--background);
    color: var(--foreground);
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
}

.complete-btn:hover {
    background: var(--primary-hover);
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fun-fact {
    transition: opacity 0.5s ease;
}