* {
  box-sizing: border-box;
}

:root {
  --bg: #f4f7fb;
  --sidebar: #0d1320;
  --sidebar-soft: #182033;
  --text: #101828;
  --muted: #667085;
  --white: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --border: #e5e7eb;
  --success: #16a34a;
  --warning: #f59e0b;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
  --radius: 18px;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.15), transparent 25%),
    radial-gradient(circle at bottom right, rgba(13, 19, 32, 0.12), transparent 30%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 480px;
  background: var(--white);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #111827);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.brand-logo.small {
  width: 44px;
  height: 44px;
  font-size: 14px;
}

.login-card h1,
.sidebar h2,
.topbar h1,
.panel h2 {
  margin: 0;
}

.login-card p,
.sidebar p,
.topbar p,
.panel-header span {
  color: var(--muted);
}

.role-switch {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.role-btn {
  flex: 1;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}

.role-btn.active {
  background: #eef4ff;
  border-color: #bfdbfe;
  color: var(--primary);
  font-weight: bold;
}

.form-group {
  margin-top: 18px;
}

.form-group label,
.profile-item label,
.modal-content label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: #344054;
}

.form-group input,
.topbar-actions input,
.profile-item input,
textarea,
.modal-content input,
.modal-content textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 15px;
  outline: none;
  background: #fff;
}

.form-group input:focus,
.topbar-actions input:focus,
.profile-item input:focus,
textarea:focus,
.modal-content input:focus,
.modal-content textarea:focus {
  border-color: var(--primary);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.primary-btn,
.secondary-btn,
.logout-btn,
.menu-item {
  border: none;
  cursor: pointer;
  transition: 0.2s ease;
  font-size: 14px;
}

.primary-btn {
  background: var(--primary);
  color: var(--white);
  padding: 12px 16px;
  border-radius: 14px;
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.secondary-btn {
  background: #eef4ff;
  color: var(--primary);
  padding: 11px 15px;
  border-radius: 14px;
}

.secondary-btn:hover {
  background: #dbeafe;
}

.full-width {
  width: 100%;
  margin-top: 22px;
}

.login-note {
  margin-top: 12px;
  font-size: 13px;
}

.app {
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: var(--white);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 22px;
}

.menu-item {
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  background: transparent;
  color: #d0d5dd;
}

.menu-item:hover,
.menu-item.active {
  background: var(--sidebar-soft);
  color: var(--white);
}

/* .support-box {
  background: var(--sidebar-soft);
  border-radius: 18px;
  padding: 16px;
}

.support-box p {
  font-size: 13px;
  line-height: 1.45;
} */

.logout-btn {
  width: 100%;
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  background: #25314a;
  color: #fff;
}

.logout-btn:hover {
  background: #334155;
}

.main {
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.topbar-actions input {
  min-width: 260px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card,
.panel,
.course-card,
.invoice-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 20px;
}

.stat-card span {
  color: var(--muted);
  font-size: 14px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
}

.panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.course-card {
  padding: 18px;
  border: 1px solid rgba(229, 231, 235, 0.8);
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef4ff;
  color: var(--primary);
  margin-bottom: 10px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 999px;
}

.card-actions,
.quick-actions,
.action-wrap {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.live-box {
  background: linear-gradient(135deg, #0f172a, #1d4ed8);
  color: #fff;
  border-radius: 22px;
  padding: 22px;
}

.live-box p {
  color: #dbeafe;
}

.mini-list,
.docs-list,
.message-list,
.table-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mini-item,
.doc-item,
.message-item,
.table-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.table-row span {
  flex: 1;
}

.table-head {
  font-weight: bold;
  background: #f8fafc;
}

.billing-grid,
.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.invoice-card {
  padding: 18px;
}

.status {
  display: inline-block;
  margin-top: 10px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.status.paid {
  background: #dcfce7;
  color: var(--success);
}

.status.pending {
  background: #fef3c7;
  color: var(--warning);
}

.profile-item {
  display: flex;
  flex-direction: column;
}

.mt-20 {
  margin-top: 20px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-content {
  background: #fff;
  width: 100%;
  max-width: 460px;
  padding: 24px;
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 20px;
}

.modal-content textarea {
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.section-head-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.full-span {
  grid-column: 1 / -1;
}

.panel-inline {
  width: 100%;
}

@media (max-width: 1150px) {
  .stats-grid,
  .cards-grid,
  .billing-grid,
  .profile-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions input {
    min-width: auto;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 18px;
  }

  .stats-grid,
  .cards-grid,
  .billing-grid,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .mini-item,
  .doc-item,
  .message-item,
  .table-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-row span {
    width: 100%;
  }

  .modal-content {
    padding: 18px;
  }
}

/* ===== CORRECTION DASHBOARD ÉLÈVE SANS LIVE ===== */

.content-grid {
  grid-template-columns: 1fr;
}

.content-grid .panel {
  width: 100%;
}

#student-dashboard .panel {
  min-height: 420px;
}

#studentCoursesGrid {
  width: 100%;
}

/* Pleine largeur uniquement pour la page Leçons */
#studentCoursesGrid.lessons-view {
  grid-template-columns: 1fr;
}

#studentCoursesGrid.lessons-view .course-card {
  width: 100%;
  max-width: 100%;
}

/* Desktop */
@media (min-width: 993px) {
  #student-dashboard .content-grid {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* Mobile / tablette */
@media (max-width: 992px) {
  .content-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ===== LEÇONS : pleine largeur uniquement dans la vue leçons ===== */
#studentCoursesGrid.lessons-view {
  grid-template-columns: 1fr !important;
}

#studentCoursesGrid.lessons-view .course-card {
  width: 100%;
  max-width: 100%;
}

#studentCoursesGrid.lessons-view .course-card p {
  line-height: 1.6;
}

#studentCoursesGrid.lessons-view .assignment-box {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f8fafc;
}

#studentCoursesGrid.lessons-view .assignment-box input {
  width: 100%;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.mt-10 {
  margin-top: 10px;
}
