/* =============================================
   ENGLISH UP! — dashboard.css
   Student dashboard, teacher panel, layouts
   ============================================= */


/* ══════════════════════════════════════════
   SHARED DASHBOARD BASE
   ══════════════════════════════════════════ */

.dashboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-lg) var(--space-3xl);
}

.dashboard--wide {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 var(--space-lg) var(--space-3xl);
}


/* ══════════════════════════════════════════
   STUDENT DASHBOARD
   ══════════════════════════════════════════ */

/* Welcome Header */
.welcome-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
  padding: var(--space-2xl);
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.welcome-header::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(88,204,2,0.12), transparent 70%);
  pointer-events: none;
}

.welcome-header__left { flex: 1; }

.welcome-greeting {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.welcome-greeting span { color: var(--accent-green); }

.welcome-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-family: var(--font-ui);
  margin-bottom: var(--space-lg);
}

.welcome-stats {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.welcome-stat {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.welcome-stat__icon { font-size: 1.3rem; }

.welcome-stat__info { line-height: 1.2; }

.welcome-stat__value {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--text-primary);
}

.welcome-stat__label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

.welcome-header__right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

/* Overall XP Ring */
.xp-ring-wrap {
  position: relative;
  width: 100px; height: 100px;
}

.xp-ring-svg {
  transform: rotate(-90deg);
  width: 100%; height: 100%;
}

.xp-ring-bg {
  fill: none;
  stroke: var(--bg-secondary);
  stroke-width: 8;
}

.xp-ring-fill {
  fill: none;
  stroke: var(--accent-green);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.xp-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.xp-ring-value {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}

.xp-ring-unit {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-green);
}


/* Module Grid */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

/* Module Detail View */
.module-detail {
  max-width: 800px;
  margin: 0 auto;
}

.module-detail__header {
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  margin-bottom: var(--space-xl);
  color: white;
  position: relative;
  overflow: hidden;
}

.module-detail__header::after {
  content: attr(data-emoji);
  position: absolute;
  right: var(--space-xl);
  bottom: -10px;
  font-size: 7rem;
  opacity: 0.18;
  line-height: 1;
  pointer-events: none;
}

.module-detail__back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  margin-bottom: var(--space-md);
  transition: color var(--transition-fast);
  cursor: pointer;
}

.module-detail__back:hover { color: white; }

.module-detail__title {
  font-size: 1.8rem;
  font-weight: 900;
  color: white;
  margin-bottom: var(--space-sm);
}

.module-detail__meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.module-detail__progress-section {
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

.module-detail__progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
}

.module-detail__progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.25);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.module-detail__progress-fill {
  height: 100%;
  background: white;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lessons-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

/* Missions Section */
.missions-section { margin-bottom: var(--space-2xl); }

.missions-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Recent Badges */
.badges-section { margin-bottom: var(--space-2xl); }

.badges-recent {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
}

.badges-recent::-webkit-scrollbar { height: 4px; }

/* Continue Learning Banner */
.continue-banner {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  background: linear-gradient(135deg, var(--accent-green), #3fa800);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-2xl);
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  color: white;
  box-shadow: 0 4px 20px rgba(88,204,2,0.3);
}

.continue-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(88,204,2,0.4);
}

.continue-banner__icon { font-size: 2.5rem; }

.continue-banner__text { flex: 1; }

.continue-banner__label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.85;
  margin-bottom: 2px;
  color: white;
}

.continue-banner__title {
  font-size: 1.05rem;
  font-weight: 900;
  color: white;
}

.continue-banner__arrow {
  font-size: 1.5rem;
  opacity: 0.8;
  transition: transform var(--transition-fast);
}

.continue-banner:hover .continue-banner__arrow {
  transform: translateX(4px);
}


/* ══════════════════════════════════════════
   TEACHER PANEL
   ══════════════════════════════════════════ */

.teacher-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-xl);
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 var(--space-lg) var(--space-3xl);
  align-items: start;
}

/* Teacher Sidebar */
.teacher-sidebar {
  position: sticky;
  top: calc(var(--navbar-height) + var(--space-lg));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.teacher-sidebar__title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 0 var(--space-sm);
  margin-bottom: var(--space-sm);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-nav-item:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.sidebar-nav-item.active {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.sidebar-nav-item__icon { font-size: 1.1rem; width: 20px; text-align: center; }

.sidebar-badge {
  margin-left: auto;
  background: var(--accent-orange);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* Teacher Main Content */
.teacher-main { min-width: 0; }

.teacher-section-title {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: var(--space-xl);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Module Manager */
.module-manager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.module-manager-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition-base);
}

.module-manager-card:hover { box-shadow: var(--shadow-md); }

.module-manager-card__top { height: 8px; }

.module-manager-card__body { padding: var(--space-md) var(--space-lg); }

.module-manager-card__title {
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.module-manager-card__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  font-family: var(--font-ui);
}

.module-manager-card__actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* Add New Card */
.add-new-card {
  background: var(--bg-secondary);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-2xl);
  cursor: pointer;
  transition: all var(--transition-base);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.9rem;
  min-height: 160px;
}

.add-new-card:hover {
  border-color: var(--accent-green);
  color: var(--accent-green);
  background: var(--accent-green-light);
}

.add-new-card__icon { font-size: 2rem; }

/* Lesson Editor */
.lesson-editor {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-xl);
}

.lesson-editor__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.lesson-editor__title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-primary);
}

.lesson-editor__actions {
  display: flex;
  gap: var(--space-sm);
}

.lesson-editor__mode-toggle {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.mode-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.mode-btn.active {
  background: var(--accent-green);
  color: white;
}

.lesson-editor__body { padding: var(--space-lg); }

/* Quill override in dark mode */
[data-theme="dark"] .ql-toolbar {
  background: var(--bg-secondary);
  border-color: var(--border) !important;
}

[data-theme="dark"] .ql-container {
  border-color: var(--border) !important;
  background: var(--bg-primary);
  color: var(--text-primary);
}

[data-theme="dark"] .ql-editor         { color: var(--text-primary); }
[data-theme="dark"] .ql-stroke         { stroke: var(--text-secondary) !important; }
[data-theme="dark"] .ql-fill           { fill: var(--text-secondary) !important; }
[data-theme="dark"] .ql-picker-label   { color: var(--text-secondary); }
[data-theme="dark"] .ql-picker-options { background: var(--bg-elevated); border-color: var(--border); }

/* Teacher Students Table */
.students-table { width: 100%; border-collapse: collapse; }

.students-table th {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  background: var(--bg-secondary);
}

.students-table td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-primary);
}

.students-table tr:last-child td { border-bottom: none; }

.students-table tr:hover td { background: var(--bg-secondary); }

/* Progress overview per student */
.student-progress-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.student-progress-row .progress-wrap { flex: 1; }

.student-progress-row span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}

/* Teacher Stats row */
.teacher-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
}

/* Submissions review */
.submission-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.submission-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.submission-card__student {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.submission-card__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.submission-card__name {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.submission-card__mission {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.submission-card__content {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: var(--space-md);
  font-family: var(--font-body);
  border: 1px solid var(--border);
}

.submission-grade-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.grade-input {
  width: 80px;
  text-align: center;
  font-weight: 800;
  font-size: 1.1rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-xs) var(--space-sm);
}

/* Color picker for modules */
.color-picker-row {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.color-swatch {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 3px solid transparent;
  transition: all var(--transition-fast);
}

.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--text-primary); transform: scale(1.1); }


/* ══════════════════════════════════════════
   PROFILE PAGE
   ══════════════════════════════════════════ */

.profile-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--space-xl);
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 var(--space-lg) var(--space-3xl);
  align-items: start;
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  text-align: center;
  position: sticky;
  top: calc(var(--navbar-height) + var(--space-lg));
}

.profile-avatar {
  width: 90px; height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--accent-green);
  margin: 0 auto var(--space-md);
}

.profile-name {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.profile-level {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: var(--space-lg);
  font-family: var(--font-ui);
}

.profile-xp-bar { margin-bottom: var(--space-lg); }

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.profile-stat {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  text-align: center;
  border: 1px solid var(--border);
}

.profile-stat__value {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text-primary);
}

.profile-stat__label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 700;
}


/* ══════════════════════════════════════════
   RESPONSIVE — Tablet (≤ 900px)
   ══════════════════════════════════════════ */

@media (max-width: 900px) {
  .teacher-layout {
    grid-template-columns: 1fr;
  }

  .teacher-sidebar {
    position: static;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-xs);
    padding: var(--space-sm);
  }

  .teacher-sidebar__title { display: none; }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-nav-item {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.82rem;
  }

  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-card { position: static; }

  .welcome-header {
    flex-direction: column;
  }

  .welcome-header__right {
    flex-direction: row;
    align-self: stretch;
    justify-content: center;
  }
}


/* ══════════════════════════════════════════
   RESPONSIVE — Mobile (≤ 640px)
   ══════════════════════════════════════════ */

@media (max-width: 640px) {
  .dashboard,
  .dashboard--wide {
    padding: 0 var(--space-md) var(--space-2xl);
  }

  /* Welcome header compact */
  .welcome-header {
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    border-radius: var(--radius-lg);
  }

  .welcome-greeting { font-size: 1.25rem; }

  .welcome-stats {
    gap: var(--space-sm);
  }

  .welcome-stat {
    flex: 1;
    min-width: 0;
    padding: var(--space-xs) var(--space-sm);
  }

  .welcome-stat__value { font-size: 0.95rem; }

  /* Modules: 1 column on mobile */
  .modules-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .teacher-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .tabs {
    width: 100%;
    overflow-x: auto;
  }

  .continue-banner {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    gap: var(--space-md);
  }

  .continue-banner__icon { font-size: 2rem; }

  /* Profile mobile */
  .profile-layout {
    padding: 0 var(--space-md) var(--space-2xl);
  }

  /* Teacher layout mobile */
  .teacher-layout {
    padding: 0 var(--space-md) var(--space-2xl);
  }
}