/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  /* Dark mode values (default) */
  --bg-primary: #0b0f19;
  --bg-secondary: #161e2e;
  --bg-tertiary: #242f41;
  --bg-sidebar: rgba(11, 15, 25, 0.8);
  --border-color: rgba(255, 255, 255, 0.06);
  
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --accent: #4f46e5; /* Premium Indigo */
  --accent-light: rgba(79, 70, 229, 0.15);
  --accent-hover: #4338ca;
  --accent-glow: rgba(79, 70, 229, 0.4);
  
  --success: #10b981; /* Excel green */
  --success-light: rgba(16, 185, 129, 0.15);
  --success-hover: #059669;
  
  --error: #ef4444;
  --error-light: rgba(239, 68, 68, 0.15);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  
  --sidebar-width: 330px;
  --header-height: 70px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
}

[data-theme="light"] {
  --bg-primary: #f3f4f6;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e5e7eb;
  --bg-sidebar: rgba(243, 244, 246, 0.85);
  --border-color: rgba(0, 0, 0, 0.06);
  
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  
  --accent: #4f46e5;
  --accent-light: rgba(79, 70, 229, 0.08);
  --accent-hover: #3730a3;
  --accent-glow: rgba(79, 70, 229, 0.2);
  
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Layout */
.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
  position: relative;
}

/* Sidebar with Glassmorphism */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background-color: var(--bg-sidebar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent) 0%, var(--success) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  background: linear-gradient(135deg, var(--success) 0%, var(--accent) 100%);
  color: white;
  -webkit-text-fill-color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
}

/* Circular Progress Chart */
.progress-card {
  margin: 20px 24px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 16px;
}

.progress-circle-container {
  position: relative;
  width: 60px;
  height: 60px;
}

.progress-circle-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 5;
}

.progress-circle-bar {
  fill: none;
  stroke: var(--success);
  stroke-width: 5;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  stroke-dasharray: 172.7; /* 2 * PI * r (r=27.5) */
  stroke-dashoffset: 172.7;
  transition: stroke-dashoffset 0.8s ease-in-out;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 13px;
}

.progress-info h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.progress-info p {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Syllabus Navigation */
.syllabus-menu {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chapter-container {
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: var(--transition);
  background: transparent;
}

.chapter-header {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
}

.chapter-header:hover {
  background: var(--bg-tertiary);
}

.chapter-header .chevron {
  font-size: 12px;
  transition: transform 0.3s;
}

.chapter-container.expanded .chevron {
  transform: rotate(90deg);
}

.chapter-container.expanded .chapter-header {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.lessons-list {
  display: none;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.15);
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

.chapter-container.expanded .lessons-list {
  display: flex;
}

.lesson-item {
  padding: 10px 16px 10px 24px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.lesson-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.lesson-item.active {
  background: var(--accent-light);
  color: var(--text-primary);
  font-weight: 500;
  border-left: 3px solid var(--accent);
}

.lesson-status {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: transparent;
  transition: var(--transition);
}

.lesson-item.completed .lesson-status {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

/* Header */
.main-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
}

.header-title-container {
  display: flex;
  flex-direction: column;
}

.header-title-container h1 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
}

.header-title-container p {
  font-size: 12px;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Switch Theme Button */
.theme-toggle-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background: var(--bg-primary);
  transform: scale(1.05);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  padding: 6px 14px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--success) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 12px;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

/* Content Container */
.content-body {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Step Tabs (Visual representation of steps inside lesson) */
.step-navigation {
  display: flex;
  background: var(--bg-secondary);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 6px;
}

.step-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.step-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}

.step-tab.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.step-tab.completed {
  color: var(--success);
}

.step-icon {
  font-size: 16px;
}

/* Active Step Wrapper with Animation */
.active-step-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Content Card Elements */
.content-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  line-height: 1.6;
}

.content-card h2 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 20px;
}

.content-card h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 12px;
}

.content-card p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 15px;
}

.content-card ul, .content-card ol {
  margin-bottom: 20px;
  padding-left: 20px;
  color: var(--text-secondary);
}

.content-card li {
  margin-bottom: 8px;
  font-size: 15px;
}

/* Code and Cheatsheets */
pre {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 16px 0;
}

code {
  font-family: 'Consolas', 'Courier New', Courier, monospace;
  font-size: 14px;
  color: var(--accent);
  background: rgba(79, 70, 229, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

pre code {
  color: var(--text-primary);
  background: transparent;
  padding: 0;
}

/* Custom Tip Boxes */
.tip-box {
  background: rgba(79, 70, 229, 0.08);
  border-left: 4px solid var(--accent);
  padding: 16px 20px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 20px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.tip-box.info {
  background: rgba(16, 185, 129, 0.08);
  border-left-color: var(--success);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: var(--bg-tertiary);
  font-weight: 600;
  font-family: var(--font-heading);
  color: var(--text-primary);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

/* Video Player Card */
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 ratio */
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-description {
  margin-top: 16px;
  font-size: 15px;
  color: var(--text-secondary);
}

/* Quiz Styling */
.quiz-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.quiz-question {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-option-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
}

.quiz-option-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.quiz-option-btn.selected {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--text-primary);
}

.quiz-option-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  transition: var(--transition);
}

.quiz-option-btn.selected .quiz-option-indicator {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

/* Quiz Text Input */
.quiz-text-input-wrapper {
  position: relative;
}

.quiz-text-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-family: 'Consolas', monospace;
  font-size: 16px;
  transition: var(--transition);
}

.quiz-text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Quiz Action Buttons */
.quiz-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
}

.btn {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px var(--accent-glow);
  transform: translateY(-2px);
}

.btn-primary:disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-primary);
  transform: translateY(-2px);
}

/* Quiz Feedback Box */
.quiz-feedback {
  margin-top: 20px;
  padding: 20px;
  border-radius: var(--radius-md);
  display: none;
  animation: slideUpFade 0.3s ease;
}

.quiz-feedback.show {
  display: block;
}

.quiz-feedback.success {
  background: var(--success-light);
  border: 1px solid var(--success);
  color: var(--text-primary);
}

.quiz-feedback.error {
  background: var(--error-light);
  border: 1px solid var(--error);
  color: var(--text-primary);
}

.feedback-header {
  font-weight: 700;
  font-family: var(--font-heading);
  font-size: 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback-explanation {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Incorrect and Correct option styles (after validation) */
.quiz-option-btn.correct-choice {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--text-primary);
}
.quiz-option-btn.correct-choice .quiz-option-indicator {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

.quiz-option-btn.wrong-choice {
  border-color: var(--error);
  background: var(--error-light);
  color: var(--text-primary);
}
.quiz-option-btn.wrong-choice .quiz-option-indicator {
  border-color: var(--error);
  background: var(--error);
  color: white;
}

/* Footer Navigation between lessons */
.lesson-nav-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 30px;
  margin-top: 20px;
}

.nav-direction-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.nav-item-title {
  font-size: 14px;
  font-weight: 600;
}

.nav-btn-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.nav-btn-content.right {
  align-items: flex-end;
}

/* Completion Card (End of course) */
.completion-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
}

.trophy-icon {
  font-size: 64px;
  margin-bottom: 20px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.completion-card h3 {
  font-size: 26px;
  margin-bottom: 12px;
}

.completion-card ul {
  max-width: 500px;
  text-align: left;
  margin: 24px auto;
  font-size: 15px;
}

.final-words {
  font-weight: 600;
  color: var(--success) !important;
  font-size: 16px;
  margin-top: 20px;
}

/* Confetti Overlay */
.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 200;
}

/* Responsive CSS */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  
  .main-wrapper {
    margin-left: 0;
  }
  
  .hamburger-btn {
    display: block;
  }
  
  .main-header {
    padding: 0 20px;
  }
  
  .content-body {
    padding: 20px;
  }
}

@media (max-width: 640px) {
  .quiz-action-bar {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }
  
  .quiz-action-bar button {
    justify-content: center;
  }
  
  .lesson-nav-footer {
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
  }
  
  .lesson-nav-footer button {
    width: 100%;
    justify-content: space-between;
  }
  
  .nav-btn-content {
    align-items: flex-start !important;
  }
  
  .content-card {
    padding: 20px;
  }
  
  .step-navigation {
    flex-direction: column;
  }
}
