:root {
  --primary-color: #388f3c;
  --secondary-color: #f0fdf4;
  --text-color: #1f2937;
  --light-gray: #f3f4f6;
  --gray: #6b7280;
  --white: #ffffff;
  --red: #e63835;
  --red-light: #fef2f2;
  --green-light: #f0fdf4;
  --border-radius: 12px;
  --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

body {
  font-family: 'Inter', sans-serif;
  margin: 0;
  background-color: var(--light-gray);
  color: var(--text-color);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container { width: 90%; max-width: 1200px; margin: 0 auto; padding: 16px; }

/* Header */
.header-block {
  background-color: var(--white);
  padding: 24px;
  margin-bottom: 16px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  text-align: center;
}
.header-block h1 { font-size: 2.5rem; margin: 0 0 16px 0; font-weight: 800; }

/* Header right rail (progress bar + auth slot) */
.header-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
@media (min-width: 768px) {
  .header-right {
    flex-direction: row;
    justify-content: center;
    gap: 24px;
  }
}

/* Auth slot */
.auth-slot { display: flex; align-items: center; justify-content: center; }
.auth-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: var(--white);
  color: var(--text-color);
  border: 1px solid #d1d5db;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  box-shadow: var(--box-shadow);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.auth-login-btn:hover { box-shadow: 0 6px 12px -2px rgba(0,0,0,0.15); transform: translateY(-1px); }
.auth-login-btn svg { display: block; }

.auth-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  background-color: var(--white);
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  box-shadow: var(--box-shadow);
}
.auth-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background-color: var(--primary-color);
  color: var(--white);
}
.auth-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}
.auth-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  max-width: 180px;
  overflow: hidden;
}
.auth-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-email {
  font-size: 0.75rem;
  color: var(--gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-logout {
  margin-left: 4px;
  padding: 4px 10px;
  font-size: 0.8rem;
  color: var(--gray);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: border-color 0.15s, color 0.15s;
}
.auth-logout:hover { color: var(--red); border-color: var(--red); }

.progress-bar-container {
  background-color: var(--light-gray);
  border-radius: 999px;
  overflow: hidden;
  width: 100%;
  margin-bottom: 8px;
  position: relative;
  height: 28px;
}
#xpProgressBar {
  background-color: var(--primary-color);
  width: 0%;
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease-in-out;
}
#xpLabel {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--white);
  font-weight: bold;
  font-size: 0.9rem;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
}

/* Syllabus */
.syllabus-section {
  background-color: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: 16px;
  padding: 16px;
}
.top-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--light-gray);
  padding-bottom: 16px;
}
.top-tab-button {
  padding: 12px 24px;
  border: none;
  background-color: var(--light-gray);
  cursor: pointer;
  border-radius: 8px;
  font-weight: 600;
  transition: background-color 0.3s, color 0.3s;
}
.top-tab-button.active { background-color: var(--primary-color); color: var(--white); }
.top-tab-content { display: none; }
.top-tab-content.active { display: block; }

.grid-container { display: grid; gap: 16px; }
.grid-item {
  background-color: var(--secondary-color);
  padding: 24px;
  border-radius: var(--border-radius);
  border: 1px solid #d1fae5;
}
.grid-item h3 {
  margin-top: 0;
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.grid-item ul { padding-left: 0; list-style: none; margin: 0; }
.grid-item li { margin-bottom: 8px; text-align: left; }

.profile-section { display: flex; flex-direction: column; align-items: center; text-align: center; }
.profile-photo img {
  width: 150px; height: 150px; border-radius: 50%;
  object-fit: cover; border: 4px solid var(--primary-color); margin-bottom: 16px;
}
.profile-details h4 { margin: 0 0 8px 0; font-size: 1.25rem; }
.profile-details ul { padding: 0 0 0 20px; margin: 0; text-align: left; }
.profile-details li { margin-bottom: 4px; }

/* SMART Goals To-Do List */
#todo-list { list-style-type: none; padding: 0; }
#todo-list li {
  background-color: var(--white);
  margin-bottom: 8px; padding: 12px; border-radius: 8px;
  display: flex; align-items: center; border: 1px solid var(--light-gray);
}
#todo-list input[type="checkbox"] { margin-right: 12px; }
#todo-list label { flex-grow: 1; }

/* Course Modules */
.course-layout { 
  display: flex; 
  flex-direction: column; 
  gap: 0; 
  background-color: var(--white); 
  border-radius: var(--border-radius); 
  box-shadow: var(--box-shadow); 
  overflow: hidden;
  margin-top: 16px;
}

.sidebar {
  padding: 24px 16px; 
  width: 100%; 
  box-sizing: border-box;
  background-color: #fcfcfc; /* Subtle light gray for sidebar area */
}

.sidebar-nav { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li a {
  display: block; padding: 12px 16px; text-decoration: none; color: var(--text-color);
  border-radius: 8px; font-weight: 500; transition: background-color 0.3s, color 0.3s; margin-bottom: 4px;
}
.sidebar-nav li a:hover { background-color: var(--secondary-color); }
.sidebar-nav li a.active { background-color: var(--primary-color); color: var(--white); }

.main-content {
  flex: 1; padding: 32px; min-width: 0;
  background-color: var(--white);
}
.module-container { display: block; }

.module-content-area .content-tab { display: none; }
.module-content-area .content-tab.active { display: block; }
.module-header h2 { text-align: center; font-size: 2rem; margin-bottom: 16px; }

.video-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--border-radius); margin-bottom: 16px; }
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

.completion-button {
  display: block; width: 100%; padding: 12px; border: none; border-radius: 8px;
  font-size: 1rem; font-weight: 600; cursor: pointer; transition: background-color 0.3s; margin-bottom: 16px;
}
.mark-complete-btn { background-color: var(--red); color: white; }
.mark-complete-btn.completed { background-color: var(--primary-color); }

.content-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px;
  border-bottom: 2px solid var(--light-gray); padding-bottom: 16px;
}
.content-tab-button {
  padding: 10px 20px; border: none; background-color: var(--light-gray);
  cursor: pointer; border-radius: 8px; font-weight: 600; transition: background-color 0.3s, color 0.3s;
}
.content-tab-button.active { background-color: var(--primary-color); color: var(--white); }

/* Highlights */
.highlights-container { display: flex; flex-direction: column; gap: 12px; }
.highlight-card { padding: 16px; border-radius: var(--border-radius); border-left: 5px solid; }
.highlight-card p { margin: 0; }
.highlight-card strong { display: inline-block; margin-right: 8px; }

/* Quiz & Boolean */
.quiz-container { text-align: center; }
.quiz-navigation { display: flex; justify-content: center; gap: 10px; margin-bottom: 20px; }
.quiz-navigation button {
  padding: 10px 20px; border: 1px solid var(--primary-color); background-color: var(--white);
  color: var(--primary-color); border-radius: 8px; cursor: pointer; font-weight: bold;
}
.quiz-navigation button:hover { background-color: var(--secondary-color); }
.quiz-question { margin-bottom: 20px; font-size: 1.2rem; }
.quiz-options, .boolean-options { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.quiz-options li button, .boolean-options li button {
  width: 100%; padding: 15px; text-align: left; border: 2px solid var(--light-gray);
  background-color: #fff; border-radius: 8px; cursor: pointer; transition: all 0.2s;
}
.quiz-options li button:hover, .boolean-options li button:hover { border-color: var(--primary-color); }
.quiz-options li button.correct, .boolean-options li button.correct {
  background-color: var(--green-light); border-color: var(--primary-color); color: var(--primary-color); font-weight: bold;
}
.quiz-options li button.incorrect, .boolean-options li button.incorrect {
  background-color: var(--red-light); border-color: var(--red); color: var(--red); font-weight: bold;
}
.quiz-explanation { margin-top: 15px; padding: 15px; background-color: var(--secondary-color); border-radius: 8px; }
.quiz-results { padding: 20px; background-color: var(--secondary-color); border-radius: var(--border-radius); }
.restart-btn { padding: 12px 24px; margin-top: 20px; cursor: pointer; border: none; background-color: var(--primary-color); color: white; border-radius: 8px; font-size: 1rem; font-weight: bold; }

/* Flashcards */
.flashcard-container { perspective: 1000px; width: 100%; height: 250px; margin: 0 auto; }
.flashcard { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.6s; cursor: pointer; }
.flashcard.is-flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; width: 100%; height: 100%; backface-visibility: hidden;
  display: flex; justify-content: center; align-items: center; padding: 20px; box-sizing: border-box;
  border-radius: var(--border-radius); box-shadow: var(--box-shadow); text-align: center;
}
.flashcard-front { background: linear-gradient(135deg, #f0fdf4, #d1fae5); }
.flashcard-back { background: linear-gradient(135deg, #e0f2fe, #bae6fd); transform: rotateY(180deg); }
.flashcard-status { margin-top: 16px; text-align: center; }

/* PDF Viewer */
.pdf-container { width: 100%; height: 80vh; border: 1px solid var(--light-gray); border-radius: var(--border-radius); }

/* Assignment */
.assignment-section {
  background-color: var(--white); padding: 24px; border-radius: var(--border-radius);
  box-shadow: var(--box-shadow); margin-top: 16px; margin-bottom: 16px;
}
.assignment-section h2 { text-align: center; margin-bottom: 24px; }
.assignment-section p, .assignment-section ol { text-align: left; }

#upload-form {
  margin-top: 24px; padding: 24px; border: 2px dashed var(--light-gray);
  border-radius: var(--border-radius); text-align: center;
}
#file-upload-area {
  padding: 40px; border: 2px dashed var(--primary-color); border-radius: var(--border-radius);
  background-color: var(--secondary-color); cursor: pointer;
}
#submit-assignment {
  margin-top: 16px; padding: 12px 24px; background-color: var(--primary-color);
  color: var(--white); border: none; border-radius: 8px; cursor: pointer;
}
#upload-status, #submission-result { margin-top: 16px; }

/* Highlight card colors */
.highlight-card[data-type="tip"] { background-color: #f0fdf4; border-color: var(--primary-color); }
.highlight-card[data-type="warning"] { background-color: #fef2f2; border-color: var(--red); }
.highlight-card[data-type="info"] { background-color: #eff6ff; border-color: #3b82f6; }

/* Module navigation */
.module-nav {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  border-top: 1px solid var(--light-gray);
  margin-top: 24px;
}
.module-nav a {
  padding: 10px 20px;
  background-color: var(--light-gray);
  color: var(--text-color);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
}
.module-nav a:hover { background-color: var(--primary-color); color: white; }

/* Footer */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--gray);
  font-size: 0.9rem;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--light-gray) 25%, #e5e7eb 50%, var(--light-gray) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 8px;
}
@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Mobile Sidebar Toggle */
.mobile-sidebar-toggle {
  display: block; width: 100%; padding: 16px; background-color: var(--primary-color);
  color: white; border: none; border-radius: 8px; font-size: 1.1rem;
  font-weight: bold; cursor: pointer; margin-bottom: 8px; text-align: left;
}
.mobile-sidebar-toggle::after { content: '▼'; float: right; transition: transform 0.3s; }
.mobile-sidebar-toggle.active::after { transform: rotate(180deg); }

.sidebar-content { display: none; margin-top: 16px; }
.sidebar-content.active { display: block; }

/* Responsive */
@media (min-width: 768px) { .grid-container { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { 
  .course-layout { flex-direction: row; align-items: stretch; min-height: 800px; } 
  .sidebar { width: 350px; flex-shrink: 0; border-right: 1px solid var(--light-gray); overflow-y: auto; position: sticky; top: 0; max-height: 100vh; } 
  .main-content { padding: 40px; }
  .mobile-sidebar-toggle { display: none; }
  .sidebar-content { display: block; margin-top: 0; }
}
