:root {
  --primary-accent: #4f46e5;
  --primary-accent-rgb: 79, 70, 229;
  --primary-hover: #4338ca;
  --primary-light: rgba(var(--primary-accent-rgb), 0.08);
  --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  --text-on-accent: #ffffff;
  --text-link: var(--primary-accent);
  --border-highlight: var(--primary-accent);
  --bg-body: #f8f9fa;
  --bg-content: #ffffff;
  --bg-alt: #f3f4f6;
  --bg-element: #e5e7eb;
  --bg-content-rgb: 255, 255, 255;
  --text-headings: #111827;
  --text-primary: #374151;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: #e5e7eb;
  --border-strong: #d1d5db;
  --success-color: #059669;
  --success-bg: rgba(5, 150, 105, 0.1);
  --success-border: rgba(5, 150, 105, 0.3);
  --warning-color: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.1);
  --warning-border: rgba(217, 119, 6, 0.3);
  --danger-color: #dc2626;
  --danger-hover: #b91c1c;
  --danger-bg: rgba(220, 38, 38, 0.1);
  --danger-border: rgba(220, 38, 38, 0.3);
  --info-color: #2563eb;
  --info-bg: rgba(37, 99, 235, 0.1);
  --info-border: rgba(37, 99, 235, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07),
    0 2px 4px -2px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08),
    0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --shadow-accent: 0 4px 14px rgba(var(--primary-accent-rgb), 0.2);
  --header-height: 65px;
  --sidebar-width: 260px;
  --font-primary: "Inter", sans-serif;
  --font-headings: "Poppins", sans-serif;
  --font-brand: "Baloo 2", "Poppins", sans-serif;
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --transition-default: 0.25s ease-in-out;
  --transition-fast: 0.15s ease-in-out;
  --prism-bg: #f9fafb;
  --prism-text: #374151;
  --prism-comment: #6b7280;
  --prism-punctuation: #9ca3af;
  --prism-property: #dc2626;
  --prism-keyword: var(--primary-accent);
  --prism-string: #059669;
  --prism-function: #d97706;
  --prism-boolean: #dc2626;
  --prism-number: #059669;
  --prism-operator: #9ca3af;
  --prism-variable: #4338ca;
  --prism-class-name: #d97706;
  --cert-border-gold: #d97706;
  --cert-border-light-gold: rgba(217, 119, 6, 0.3);
  --cert-title-gold: #b45309;
  --cert-download-bg: linear-gradient(135deg, #d97706, #b45309);
  --cert-text-color: #374151;
  --cert-line-color: #d1d5db;
  --cert-bg: #ffffff;
  --modal-image-bg: rgba(17, 24, 39, 0.9);
  --modal-image-caption: #d1d5db;
  --modal-image-close: #f9fafb;
  --modal-image-close-hover: #e5e7eb;
}
[data-theme="dark"] {
  --primary-accent: #818cf8;
  --primary-accent-rgb: 129, 140, 248;
  --primary-hover: #6366f1;
  --primary-light: rgba(var(--primary-accent-rgb), 0.1);
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --text-on-accent: #ffffff;
  --bg-body: #111827;
  --bg-content: #1f2937;
  --bg-alt: #374151;
  --bg-element: #374151;
  --bg-content-rgb: 31, 41, 55;
  --text-headings: #f9fafb;
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border-color: #374151;
  --border-strong: #4b5563;
  --success-color: #34d399;
  --success-bg: rgba(52, 211, 153, 0.1);
  --success-border: rgba(52, 211, 153, 0.3);
  --warning-color: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --warning-border: rgba(251, 191, 36, 0.3);
  --danger-color: #f87171;
  --danger-hover: #ef4444;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --danger-border: rgba(248, 113, 113, 0.3);
  --info-color: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.1);
  --info-border: rgba(96, 165, 250, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3),
    0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4),
    0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-accent: 0 4px 14px rgba(var(--primary-accent-rgb), 0.2);
  --prism-bg: #1f2937;
  --prism-text: #e5e7eb;
  --prism-comment: #6b7280;
  --prism-punctuation: #9ca3af;
  --prism-property: #f87171;
  --prism-keyword: #818cf8;
  --prism-string: #34d399;
  --prism-function: #fbbf24;
  --prism-boolean: #f87171;
  --prism-number: #34d399;
  --prism-operator: #9ca3af;
  --prism-variable: #60a5fa;
  --prism-class-name: #fbbf24;
  --cert-border-gold: #fbbf24;
  --cert-border-light-gold: rgba(251, 191, 36, 0.3);
  --cert-title-gold: #fcd34d;
  --cert-download-bg: linear-gradient(135deg, #fbbf24, #d97706);
  --cert-text-color: #e5e7eb;
  --cert-line-color: #6b7280;
  --cert-bg: #1f2937;
}
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}
body {
  display: flex;
  padding-top: var(--header-height);
  font-family: var(--font-primary);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary);
  background-color: var(--bg-body);
  transition: background-color var(--transition-default),
    color var(--transition-default);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.no-scroll {
  overflow: hidden;
  height: 100vh;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
}
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}
.hidden {
  display: none !important;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-element);
}
::-webkit-scrollbar-thumb {
  background-color: var(--border-strong);
  border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--primary-accent);
}
.lucide {
  width: 1.4em;
  height: 1.4em;
  stroke-width: 1.5;
  vertical-align: middle;
}
.page-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1250;
  width: 100%;
  height: var(--header-height);
  padding: 0 16px;
  background-color: var(--bg-content);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  transition: background-color var(--transition-default),
    border-color var(--transition-default);
}
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0 auto;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-brand);
  font-size: 1.5em;
  font-weight: 700;
  text-decoration: none;
  position: relative;
  letter-spacing: -0.5px;
}

/* Container logo simple coins arrondis */
.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon-img {
  height: 28px;
  width: auto;
}

/* Texte de marque LearnBlox */
.brand-text {
  font-family: var(--font-brand);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo-text .logo-learn,
.brand-text .logo-learn,
.brand-text .learn {
  color: var(--text-headings);
  font-weight: 800;
}

.logo-text .logo-blox,
.brand-text .logo-blox,
.brand-text .blox {
  color: var(--primary-accent);
  font-weight: 800;
}
.menu-toggle-course,
.theme-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  font-size: 1.3em;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: color var(--transition-fast),
    background-color var(--transition-fast);
}
.theme-switch {
  font-size: 1.2rem;
  color: var(--text-primary);
}
.menu-toggle-course {
  display: flex;
}
@media (min-width: 769px) {
  .menu-toggle-course {
    display: flex;
  }
}
.menu-toggle-course:hover,
.theme-switch:hover {
  color: var(--primary-accent);
  background-color: var(--primary-light);
}
.user-dropdown {
  position: relative;
}
.user-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-on-accent);
  background-color: var(--primary-accent);
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  overflow: visible !important;
  position: relative;
  z-index: 100;
}
.user-toggle:hover {
  background-color: var(--primary-hover);
}
.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 1100;
  display: none;
  min-width: 240px;
  padding: 8px;
  background-color: var(--bg-content);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  animation: slideDown 0.2s ease-out;
}

.user-dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-header {
  padding: 12px 16px;
  background-color: var(--bg-alt);
  border-radius: 8px;
  margin-bottom: 8px;
}

.dropdown-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-user-name {
  font-weight: 700;
  color: var(--text-headings);
  font-size: 0.95rem;
}

.dropdown-user-role {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 6px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.dropdown-item i {
  width: 18px;
  text-align: center;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.dropdown-item:hover {
  background-color: var(--bg-alt);
  color: var(--primary-accent);
}

.dropdown-item:hover i {
  color: var(--primary-accent);
}

.dropdown-item.danger {
  color: var(--danger-color);
}

.dropdown-item.danger i {
  color: var(--danger-color);
}

.dropdown-item.danger:hover {
  background-color: var(--danger-bg);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  z-index: 1000;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background-color: var(--bg-content);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-default),
    background-color var(--transition-default),
    border-color var(--transition-default);
}
.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-width)));
}
.sidebar-progress-container {
  padding: 20px 25px 15px 25px;
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.sidebar-progress-container:hover {
  background-color: var(--bg-alt);
}
.sidebar-nav {
  flex-grow: 1;
  overflow-y: auto;
  padding: 0 8px;
  overscroll-behavior: contain;

  /* Indicateur de scroll intelligent (ombres) */
  background: 
    /* Ombre du haut */ linear-gradient(
      var(--bg-content) 30%,
      rgba(255, 255, 255, 0)
    ),
    linear-gradient(rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0)),
    linear-gradient(rgba(255, 255, 255, 0), var(--bg-content) 70%) 0 100%,
    linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.05)) 0 100%;

  background-repeat: no-repeat;
  background-color: var(--bg-content);
  background-size: 100% 40px, 100% 10px, 100% 40px, 100% 10px;
  background-attachment: local, scroll, local, scroll;
}

[data-theme="dark"] .sidebar-nav {
  background: linear-gradient(var(--bg-content) 30%, rgba(31, 41, 55, 0)),
    linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0)),
    linear-gradient(rgba(31, 41, 55, 0), var(--bg-content) 70%) 0 100%,
    linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2)) 0 100%;
  background-repeat: no-repeat;
  background-color: var(--bg-content);
  background-size: 100% 40px, 100% 10px, 100% 40px, 100% 10px;
  background-attachment: local, scroll, local, scroll;
}

.sidebar-footer {
  padding: 10px 8px;
  flex-shrink: 0;
}
.sidebar-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}
.sidebar-progress-value {
  color: var(--primary-accent);
  font-weight: 600;
}
.sidebar-progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--bg-element);
  border-radius: 999px;
  overflow: hidden;
}
.sidebar-progress-bar-fill {
  height: 100%;
  background-color: var(--primary-accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.sidebar-heading {
  padding: 10px 17px 5px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.sidebar-divider {
  height: 1px;
  margin: 12px 25px;
  background-color: var(--border-color);
  border: none;
}
.sidebar-nav a,
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  margin-bottom: 2px;
  position: relative;
  border: 1px solid transparent;
}
.sidebar-nav a:hover,
.sidebar-footer a:hover {
  background-color: var(--bg-alt);
  color: var(--text-primary);
  transform: translateX(3px);
}
.sidebar-nav a.active,
.sidebar-footer a.active {
  background-color: rgba(var(--primary-accent-rgb), 0.08);
  color: var(--primary-accent);
  font-weight: 600;
  border-color: rgba(var(--primary-accent-rgb), 0.1);
}
/* Indicateur visuel actif (barre gauche) */
.sidebar-nav a.active::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  height: 20px;
  width: 4px;
  background-color: var(--primary-accent);
  border-radius: 0 4px 4px 0;
}

.sidebar-nav .lucide,
.sidebar-footer .lucide {
  stroke: var(--text-muted);
  stroke-width: 2.2;
  transition: color var(--transition-fast), stroke var(--transition-fast);
}
.sidebar-nav a:hover .lucide,
.sidebar-footer a:hover .lucide {
  stroke: var(--text-primary);
}
.sidebar-nav a.active .lucide,
.sidebar-footer a.active .lucide {
  stroke: var(--primary-accent);
}
.sidebar-nav {
  scrollbar-width: thin;
  scrollbar-color: var(--primary-accent) transparent;
}
.sidebar-nav::-webkit-scrollbar {
  width: 8px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background-color: var(--primary-accent);
  border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background-color: var(--primary-hover);
}
.sidebar-nav a[data-module="welcome"] .lucide {
  stroke: #3a52c4;
}

.main-content {
  position: relative;
  width: calc(100% - var(--sidebar-width));
  margin-left: var(--sidebar-width);
  padding: 20px;
  background-color: var(--bg-body);
  transition: margin-left var(--transition-default),
    width var(--transition-default);
}
.sidebar.collapsed + .main-content {
  width: 100%;
  margin-left: 0;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1050;
  display: none;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  display: flex;
  animation: fadeInModal 0.3s ease;
}
@keyframes fadeInModal {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.modal-content {
  background-color: var(--bg-content);
  color: var(--text-primary);
  padding: 30px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 90%;
  position: relative;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 15px;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
}
.modal-close:hover {
  color: var(--primary-accent);
}
body.modal-open {
  overflow: hidden;
}
.linear-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 950;
  display: none;
  transform: translateY(100%);
  background-color: rgba(var(--bg-content-rgb), 0.75);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border-color);
  padding: 10px 15px;
  transition: transform 0.4s ease, opacity 0.4s ease;
  opacity: 0;
  flex-direction: column;
  gap: 10px;
}
.linear-controls.active {
  transform: translateY(0);
  opacity: 1;
}
.linear-controls:hover {
  background-color: rgba(var(--bg-content-rgb), 0.95);
}
#linearProgress {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}
@media (max-width: 1024px) {
  .sidebar {
    width: 240px;
  }
  .main-content {
    margin-left: 240px;
    width: calc(100% - 240px);
    padding: 15px;
  }
  .container {
    max-width: 95%;
  }
}
@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  .page-header {
    padding: 0 15px;
  }
  .header-left,
  .header-right {
    gap: 8px;
  }
  .menu-toggle-course {
    display: flex !important;
  }
  .sidebar {
    position: fixed;
    top: 0 !important;
    left: 0;
    width: 100%;
    height: 100vh !important;
    height: 100dvh !important;
    transform: translateX(-100%);
    z-index: 1200;
    margin: 0;
    padding-top: var(--header-height);
  }

  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    width: 100%;
    margin-left: 0;
    padding: 10px;
    padding-bottom: 90px !important;
  }
  .dropdown-menu {
    position: fixed;
    top: calc(var(--header-height) + 10px);
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
  }
  .linear-controls {
    display: block;
  }
}
@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
  .page-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
    padding: 0 10px;
  }
  .logo {
    font-size: 1.2em;
    gap: 6px;
  }
  .logo-icon-img {
    height: 28px;
  }
  .main-content {
    padding: 10px;
  }
  .dropdown-menu {
    right: 5px;
    left: 5px;
  }
}

/* Settings Modal Styles */

.modal-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background-color: var(--bg-element);
  color: var(--text-primary);
}

.settings-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.2rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 12px 12px 12px 40px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.form-group input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  gap: 1rem;
}
@media (max-width: 768px) {
  #userName {
    display: none;
  }
}

/* Dropdown Menu Links Styling */
.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--border-radius-md);
  transition: background-color var(--transition-fast),
    color var(--transition-fast);
  font-size: 0.95rem;
  font-weight: 500;
}

.dropdown-menu a:hover {
  background-color: var(--bg-alt);
  color: var(--primary-accent);
}

.dropdown-menu a i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  opacity: 0.8;
}

.dropdown-menu a:hover i {
  opacity: 1;
}
#adminPanelBtn {
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
  padding-top: 12px;
}

#adminPanelBtn i {
  color: var(--warning-color);
}
:root {
  --info-color: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);
  --info-border: rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] {
  --info-color: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.1);
  --info-border: rgba(96, 165, 250, 0.3);
}

/* =========================================
   SYSTÃˆME XP & GRADES - NOUVEAUX STYLES
   ========================================= */

/* Badges de Grade */
.grade-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.2s ease;
}

.grade-badge:hover {
  transform: scale(1.05);
}

/* Podium Styles */

.username {
  font-weight: 600;
  color: var(--text-primary);
}

/* DÃ©fis Quotidiens */
.daily-challenge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.daily-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.daily-type-badge.mini_quiz {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}
.daily-type-badge.drag_drop {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}
.daily-type-badge.code_challenge {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.daily-xp-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: white;
  border-radius: 20px;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.daily-question-title {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--text-headings);
}

.daily-no-challenge {
  text-align: center;
  padding: 3rem;
  background: var(--bg-alt);
  border-radius: 12px;
  color: var(--text-secondary);
}

/* Animation Level Up */
.level-up-modal {
  position: fixed;
  z-index: 10000;
}

.level-up-content {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
@media (max-width: 640px) {
  .username {
    font-size: 0.9rem;
  }

  .grade-badge {
    font-size: 0.7rem !important;
    padding: 2px 6px !important;
  }
}

@keyframes pulse-badge {
  0%,
  100% {
    box-shadow: 0 1px 4px rgba(var(--primary-accent-rgb), 0.4);
  }
  50% {
    box-shadow: 0 2px 10px rgba(var(--primary-accent-rgb), 0.6);
  }
}

@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 10px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: var(--primary-accent);
  }
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
  }

  /* --- Toast Notifications --- */
  .toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
  }

  .toast {
    background: var(--bg-content);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
    border-left: 4px solid var(--primary-accent);
  }

  .toast.visible {
    transform: translateX(0);
  }

  .toast.success {
    border-left-color: var(--success-color);
  }
  .toast.error {
    border-left-color: var(--danger-color);
  }
  .toast.info {
    border-left-color: var(--info-color);
  }

  .toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .toast-content {
    flex: 1;
  }

  .toast-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
  }

  .toast-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
  }
}

/* --- Generic Modal --- */

/* ============================================
   TOAST NOTIFICATIONS SYSTEM
   ============================================ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background: var(--bg-content);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  min-width: 320px;
  max-width: 420px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  position: relative;
  overflow: hidden;
}

.toast.visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast.success .toast-icon {
  background: var(--success-bg);
  color: var(--success-color);
}

.toast.error .toast-icon {
  background: var(--danger-bg);
  color: var(--danger-color);
}

.toast.info .toast-icon {
  background: var(--info-bg);
  color: var(--info-color);
}

.toast.xp-toast {
  border: 2px solid var(--primary-accent);
  box-shadow: 0 10px 25px -5px rgba(var(--primary-accent-rgb), 0.3);
}

.toast.xp-toast .toast-icon {
  background: var(--primary-light);
  color: var(--primary-accent);
}

.toast-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toast-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-headings);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-message {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.xp-amount {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--primary-accent);
}

.xp-boost-label {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.xp-source {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 2px;
}

.xp-total {
  color: #ef4444;
  font-weight: 900;
  font-size: 1.1em;
}

/* ============================================
   GLOBAL RESPONSIVE STYLES
   ============================================ */

/* Force proper width constraints */
.main-content {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Remove bullet points from sidebar */
.sidebar ul,
.sidebar-nav ul,
.sidebar-main-modules ul {
  list-style: none !important;
  padding-left: 0 !important;
  margin: 0;
}

.sidebar li,
.sidebar-nav li,
.sidebar-main-modules li {
  list-style: none !important;
}

/* Fix pre/code blocks globally */
pre,
code,
.snippet-card pre,
.template-card pre,
.code-card pre {
  max-width: 100%;
  overflow-x: auto;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.snippet-card,
.template-card {
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}
body.hide-smart-nav .smart-nav-bar {
  display: none !important;
}

/* ============================================
   TABLET & MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .toast-container {
    top: 70px;
    right: 10px;
    left: 10px;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  .properties-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .property-header {
    font-size: 0.95rem;
    padding: 0.85rem;
  }

  .property-content {
    padding: 1rem;
  }

  .page-header {
    padding: 0 1rem;
    height: 60px;
  }

  .header-content {
    width: 100%;
    padding: 0;
  }

  .header-left {
    gap: 0.8rem;
    min-width: 0;
  }

  .header-right {
    gap: 0.5rem;
  }

  .logo-text {
    font-size: 1.1rem;
    white-space: nowrap;
  }

  .course-hero-card {
    padding: 1.5rem;
    margin-bottom: 2rem;
  }

  .hero-title-group h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
  }

  .toolbox-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .snippet-card,
  .template-card {
    padding: 1rem;
    max-width: 100%;
  }

  .snippet-card pre,
  .template-card pre {
    font-size: 0.85rem;
    max-height: 250px;
    overflow-x: auto;
  }

  .grid-two-columns {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Module nav pills - styles gérés dans cours.css */
  .module-nav-pills-container {
    display: flex;
    width: 100%;
    padding: 0 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
  }

  .module-nav-pills {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    width: 100%;
    max-width: 100%;
    padding: 0.4rem 0.6rem;
  }

  .nav-pill {
    flex: 1 0 auto;
    min-width: auto;
    white-space: nowrap;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
  }

  .settings-modal-content {
    grid-template-columns: 1fr !important;
    height: auto !important;
    max-height: 90vh !important;
  }

  .settings-sidebar {
    flex-direction: row !important;
    overflow-x: auto !important;
    padding: 1rem !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    gap: 0.5rem !important;
  }

  .settings-nav-item {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-size: 0.85rem !important;
    padding: 0.65rem 0.85rem !important;
  }

  .settings-main {
    padding: 1.5rem 1rem !important;
  }

  .smart-nav-bar {
    padding: 0.75rem 0.5rem !important;
    gap: 0.5rem !important;
  }
}

@media (max-width: 480px) {
  .page-header {
    padding: 0.5rem 0.75rem;
  }

  .logo-icon-img {
    width: 24px;
    height: 24px;
  }

  .logo-text {
    font-size: 1.1rem;
  }

  .theme-switch {
    padding: 0.4rem;
    font-size: 1rem;
  }

  .course-hero-card {
    padding: 1.2rem;
    margin-bottom: 1.5rem;
  }

  .hero-title-group h1 {
    font-size: 1.5rem;
  }

  .daily-option-btn {
    font-size: 0.9rem;
    padding: 0.8rem;
  }

  .snippet-card,
  .template-card {
    padding: 0.75rem;
  }

  .snippet-card pre,
  .template-card pre {
    font-size: 0.75rem;
    max-height: 200px;
  }

  .copy-btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
  }
}

@media (max-width: 360px) {
  .logo-text {
    display: none;
  }
}
