﻿/* Google Fonts loaded via preconnected HTML link tag for maximum performance */

/* ==========================================================================
   CSS CUSTOM PROPERTIES & VARIABLES
   ========================================================================== */
:root {
  /* Common Palette */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-dark: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.08);
  --primary-glass: rgba(37, 99, 235, 0.05);
  --success: #10b981;
  --success-hover: #059669;
  --success-light: rgba(16, 185, 129, 0.1);
  --error: #ef4444;
  --error-hover: #dc2626;
  --error-light: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.08);
  --info: #06b6d4;
  --font-main: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --font-heading: 'Manrope', sans-serif;
  --font-arabic: 'Noto Naskh Arabic', sans-serif;
  
  /* Light Theme Variables */
  --bg-app: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  --bg-sidebar: rgba(255, 255, 255, 0.95);
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-solid: #ffffff;
  --card-bg: #ffffff;
  --bg-input: #ffffff;
  --text-main: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #475569;
  --text-inverse: #ffffff;
  --border-color: rgba(148, 163, 184, 0.28);
  --border-light: rgba(148, 163, 184, 0.3);
  --border-focus: rgba(37, 99, 235, 0.5);
  --shadow-sm: 0 2px 8px -1px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 20px 40px -15px rgba(15, 23, 42, 0.15);
  --glass-blur: 0px;
  --item-bg-hover: rgba(226, 232, 240, 0.6);
  --option-border: rgba(148, 163, 184, 0.2);
  --option-bg: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] {
  /* Dark Theme Variables */
  --bg-app: linear-gradient(135deg, #090d16 0%, #0f172a 100%);
  --bg-sidebar: rgba(15, 23, 42, 0.95);
  --bg-card: rgba(22, 28, 45, 0.85);
  --bg-card-solid: #131a2b;
  --card-bg: #131a2b;
  --bg-input: rgba(15, 23, 42, 0.9);
  --text-main: #f8fafc;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  --border-color: rgba(255, 255, 255, 0.14);
  --border-light: rgba(255, 255, 255, 0.15);
  --border-focus: rgba(37, 99, 235, 0.6);
  --shadow-sm: 0 2px 8px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  --item-bg-hover: rgba(148, 163, 184, 0.08);
  --option-border: rgba(148, 163, 184, 0.1);
  --option-bg: rgba(30, 41, 59, 0.7);
  --warning-light: rgba(245, 158, 11, 0.15);
}

/* ==========================================================================
   RESET & SYSTEM STYLES
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Apply transitions ONLY to specific small interactive controls - exclude tree-row and heavy card lists */
button, a, input, select, textarea,
.btn, .tab-btn, .pill-btn, .nav-link, .option-item,
.theme-toggle-btn, .action-btn, .tool-btn,
.custom-dropdown, .dropdown-toggle, .checkbox-custom {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.15s ease;
}

body {
  font-family: var(--font-main);
  background: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.app-container {
  display: flex !important;
  flex-direction: row !important;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* Sidebar Styling */
.main-sidebar {
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  flex-shrink: 0 !important;
  z-index: 50;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s;
  position: sticky !important;
  top: 0 !important;
  height: 100vh !important;
  height: 100dvh !important;
  overflow-y: auto;
}

.main-sidebar.collapsed {
  width: 76px !important;
  min-width: 76px !important;
  max-width: 76px !important;
}

/* ==========================================================================
   SIDEBAR BRAND / LOGO HEADER (QCMs PNS)
   ========================================================================== */
.sidebar-brand-card {
  display: block;
  text-decoration: none;
  margin-bottom: 14px;
  padding: 4px 6px;
  border-radius: 16px;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.sidebar-brand-card:hover {
  text-decoration: none;
}

.sidebar-brand-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

/* Modern Coordinated Ring Surrounding QCMs PNS Logo */
.sidebar-brand-logo-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 2.5px;
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 40%, #06b6d4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.32), 0 0 0 1px rgba(6, 182, 212, 0.3);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  cursor: pointer;
}

.sidebar-brand-logo-ring::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.45), rgba(6, 182, 212, 0.45));
  z-index: -1;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.sidebar-brand-card:hover .sidebar-brand-logo-ring {
  transform: scale(1.06) rotate(3deg);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.48), 0 0 0 2px rgba(6, 182, 212, 0.45);
}

.sidebar-brand-card:hover .sidebar-brand-logo-ring::before {
  opacity: 1;
}

.sidebar-brand-logo-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
}

.sidebar-brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  transition: transform 0.3s ease;
}

.sidebar-brand-card:hover .sidebar-brand-logo-img {
  transform: scale(1.05);
}

/* Brand Copy & Professional Typography */
.sidebar-brand-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex: 1;
}

.brand-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.brand-title-text {
  font-family: 'Montserrat', 'Plus Jakarta Sans', var(--font-heading), sans-serif;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.15;
  color: var(--text-main);
  transition: color 0.2s ease;
}

.brand-title-accent {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
  letter-spacing: -0.2px;
}

[data-theme="dark"] .brand-title-accent {
  background: linear-gradient(135deg, #38bdf8 0%, #3b82f6 50%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle-badge {
  display: none !important;
}

/* User Profile Card (Field 1) */
.profile-card {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--primary-light);
  border: 1px solid rgba(37, 99, 235, 0.18);
  margin-bottom: 14px;
  position: relative;
  overflow: visible; /* Required so accounts popover displays outside without clipping */
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  box-sizing: border-box;
}

.profile-main-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.profile-avatar-wrapper {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, var(--primary) 0%, #06b6d4 100%);
  flex-shrink: 0;
  margin: 0;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.2);
  cursor: pointer;
  transition: transform 0.2s ease;
  box-sizing: border-box;
}

.profile-avatar-wrapper:hover {
  transform: scale(1.05);
}

.profile-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  background: #fff;
  display: block;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1;
  text-align: left;
  box-sizing: border-box;
}

.profile-name-row {
  display: flex;
  align-items: center;
  width: 100%;
}

.profile-name {
  font-family: var(--font-heading);
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

.profile-actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  width: 100%;
  flex-wrap: nowrap;
  box-sizing: border-box;
}

/* Mes comptes button */
.btn-accounts-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 25px;
  padding: 0 7px;
  font-size: 10.5px;
  font-weight: 700;
  font-family: var(--font-main);
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 7px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
  line-height: 1;
}

.btn-accounts-toggle:hover,
.btn-accounts-toggle.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
}

.btn-accounts-toggle .dropdown-arrow {
  font-size: 8.5px;
  transition: transform 0.25s ease;
}

.btn-accounts-toggle.active .dropdown-arrow {
  transform: rotate(180deg);
}

/* Control Buttons (Theme Toggle & Sidebar Close) */
.profile-action-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 11px;
  padding: 0;
  flex-shrink: 0;
  box-sizing: border-box;
  line-height: 1;
}

.profile-action-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--item-bg-hover);
  transform: translateY(-1px);
}

.profile-action-btn:active {
  transform: translateY(0);
}

/* Modern Accounts Popover Menu (Contained 100% Inside Left Sidebar) */
.accounts-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  width: auto;
  background: var(--bg-card-solid, rgba(17, 26, 54, 0.98));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(37, 99, 235, 0.12);
  z-index: 1200;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  box-sizing: border-box;
}

[data-theme="dark"] .accounts-menu {
  background: rgba(17, 26, 54, 0.96);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.accounts-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.account-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 8px;
  text-decoration: none;
  background: var(--primary-light);
  border: 1px solid rgba(37, 99, 235, 0.12);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-main);
  box-sizing: border-box;
}

.account-btn:hover {
  background: var(--item-bg-hover);
  border-color: var(--primary);
  transform: translateX(2px);
}

.account-btn-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}

.account-btn-icon.tg-icon {
  background: linear-gradient(135deg, #229ED9 0%, #0088cc 100%);
}

.account-btn-icon.fb-icon {
  background: linear-gradient(135deg, #1877F2 0%, #0d65d9 100%);
}

.account-btn-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  flex: 1;
  text-align: left;
}

.account-btn-arrow {
  font-size: 9px;
  color: var(--text-muted);
  opacity: 0.6;
  transition: all 0.2s ease;
}

.account-btn:hover .account-btn-arrow {
  opacity: 1;
  color: var(--primary);
  transform: translate(1px, -1px);
}

/* Field 2: Dedicated Quote Card */
.sidebar-quote-card {
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(14, 165, 233, 0.04) 100%);
  border: 1px solid rgba(37, 99, 235, 0.15);
  margin-bottom: 14px;
  flex-shrink: 0;
  transition: all 0.25s ease;
  box-sizing: border-box;
}

[data-theme="dark"] .sidebar-quote-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(14, 165, 233, 0.06) 100%);
  border-color: rgba(37, 99, 235, 0.22);
}

.sidebar-quote-card .profile-quote {
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--text-secondary);
  font-style: italic;
  text-align: left;
  border-top: none;
  padding: 0;
  margin: 0;
}

.sidebar-brand-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 0 8px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.brand-text {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-main) 30%, var(--primary) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-actions {
  display: flex;
  gap: 4px;
}

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  background: transparent;
}

.action-btn:hover {
  background: var(--item-bg-hover);
  color: var(--text-main);
}

.sidebar-nav {
  flex: 1;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
}

.nav-link:hover {
  background: var(--item-bg-hover);
  color: var(--text-main);
}

.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

#qcmsPnsTrigger,
#qcmsPnsTrigger.active,
#pagesPnsTrigger,
#pagesPnsTrigger.active {
  background: transparent !important;
  color: var(--text-muted) !important;
}

#qcmsPnsTrigger:hover,
#pagesPnsTrigger:hover {
  background: var(--item-bg-hover) !important;
  color: var(--text-main) !important;
}

#qcmsPnsTrigger i,
#qcmsPnsTrigger.active i,
#pagesPnsTrigger i,
#pagesPnsTrigger.active i {
  color: var(--text-muted) !important;
}

#qcmsPnsTrigger:hover i,
#pagesPnsTrigger:hover i {
  color: var(--text-main) !important;
}

.nav-link i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* Submenu Styling */
.has-submenu {
  display: block;
}

.submenu-arrow {
  margin-left: auto;
  font-size: 11px !important;
  transition: transform 0.2s;
}

.submenu {
  list-style: none;
  padding-left: 36px;
  margin-top: 4px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease-out;
}

.submenu.open {
  max-height: 250px;
}

.submenu a,
.submenu .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  border-radius: 8px;
}

.submenu a:hover,
.submenu .nav-link:hover {
  color: var(--text-main) !important;
  background: var(--item-bg-hover) !important;
}

.submenu a.active,
.submenu .nav-link.active {
  background: transparent !important;
  color: var(--text-muted) !important;
}

.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Condensed Sidebar Mode */
.main-sidebar.collapsed {
  width: 76px;
  padding: 16px 8px;
}

.main-sidebar.collapsed .sidebar-brand-copy,
.main-sidebar.collapsed .sidebar-quote-card,
.main-sidebar.collapsed .accounts-menu,
.main-sidebar.collapsed .brand-text,
.main-sidebar.collapsed .nav-text,
.main-sidebar.collapsed .submenu-arrow,
.main-sidebar.collapsed .profile-name-row,
.main-sidebar.collapsed .btn-accounts-toggle {
  display: none !important;
}

.main-sidebar.collapsed .sidebar-brand-card {
  padding: 4px 0;
  margin-bottom: 10px;
  display: flex;
  justify-content: center;
}

.main-sidebar.collapsed .sidebar-brand-head {
  justify-content: center;
  gap: 0;
  width: auto;
}

.main-sidebar.collapsed .sidebar-brand-logo-ring {
  width: 38px;
  height: 38px;
}

.main-sidebar.collapsed .profile-card {
  padding: 6px 2px;
  margin-bottom: 12px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
}

.main-sidebar.collapsed .profile-main-row {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.main-sidebar.collapsed .profile-avatar-wrapper {
  margin: 0 auto;
}

.main-sidebar.collapsed .profile-info {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0;
}

.main-sidebar.collapsed .profile-actions-row {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

/* Ensure expand button is on top, visible and rotates to point right */
.main-sidebar.collapsed .collapse-sidebar-btn {
  display: flex !important;
  order: 1;
}

.main-sidebar.collapsed .theme-toggle-btn {
  display: flex !important;
  order: 2;
}

.main-sidebar.collapsed .collapse-sidebar-btn i {
  transform: rotate(180deg);
}

/* Navigation items in collapsed mode */
.main-sidebar.collapsed .sidebar-nav {
  width: 100%;
}

.main-sidebar.collapsed .sidebar-nav ul {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0;
  margin: 0;
  list-style: none;
  width: 100%;
}

.main-sidebar.collapsed .has-submenu {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.main-sidebar.collapsed .has-submenu + .has-submenu {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
}

.main-sidebar.collapsed .submenu {
  display: none !important;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0 !important;
  margin: 0 !important;
  width: 100%;
  list-style: none;
}

.main-sidebar.collapsed .submenu.open {
  display: flex !important;
  margin: 3px 0 !important;
}

.main-sidebar.collapsed .submenu li {
  width: 100%;
  display: flex;
  justify-content: center;
}

.main-sidebar.collapsed .nav-link,
.main-sidebar.collapsed .submenu a,
.main-sidebar.collapsed .submenu .nav-link {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0 !important;
  margin: 1px auto !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  gap: 0 !important;
  box-sizing: border-box;
}

.main-sidebar.collapsed .nav-link i,
.main-sidebar.collapsed .submenu a i,
.main-sidebar.collapsed .submenu .nav-link i {
  font-size: 16px;
  width: auto;
  text-align: center;
  margin: 0;
}

/* Main Content Area */
.main-content,
body.sidebar-collapsed .main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  padding: 24px 32px 60px;
  margin-left: 0 !important;
}

/* Remove padding when test player panel is active */
.main-content.player-active,
body.player-active .main-content {
  padding: 0 !important;
  margin: 0 !important;
}

/* Content Header & Tabs */
.content-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 12px;
  width: 100%;
}

.content-header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 14px;
  flex-wrap: wrap;
}

.content-header-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
  flex-wrap: nowrap;
}

@media (max-width: 768px) {
  .content-header-subrow {
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: center !important;
  }
  .pns-year-stats-container {
    margin: 4px auto 0 !important;
    justify-content: center !important;
  }
}

/* Statistics (Moved to the Right, Modern Code Typography, Professional Grey Underline) */
.pns-year-stats-container {
  display: inline-flex !important;
  align-items: center !important;
  margin-left: auto !important;
  box-sizing: border-box !important;
  padding: 4px 8px 6px 8px !important;
  gap: 8px !important;
  background: transparent !important;
  border: none !important;
  border-bottom: 2px solid #cbd5e1 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  flex-shrink: 0 !important;
  transition: border-color 0.2s ease, opacity 0.2s ease !important;
}

.pns-year-stats-container:hover {
  border-bottom-color: var(--primary, #2563eb) !important;
}

[data-theme="dark"] .pns-year-stats-container {
  background: transparent !important;
  border: none !important;
  border-bottom: 2px solid rgba(148, 163, 184, 0.28) !important;
  box-shadow: none !important;
}

[data-theme="dark"] .pns-year-stats-container:hover {
  border-bottom-color: #38bdf8 !important;
}

.stat-main-label {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #475569 !important;
  letter-spacing: -0.02em !important;
  white-space: nowrap !important;
  user-select: none !important;
}

[data-theme="dark"] .stat-main-label {
  color: #94a3b8 !important;
}

.stat-main-count {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace !important;
  font-size: 16px !important;
  font-weight: 800 !important;
  color: #b47806 !important; /* Milky golden amber (moderate / deep) */
  letter-spacing: 0.02em !important;
  font-variant-numeric: tabular-nums !important;
  white-space: nowrap !important;
  user-select: none !important;
}

[data-theme="dark"] .stat-main-count {
  color: #f5c563 !important; /* Soft creamy milky gold */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* Remove / hide language badges on course rows */
.course-lang-badge {
  display: none !important;
}

/* Hide requested filters in Nouveau Test & Répétition Espacée */
#dropdownFaculte,
#dropdownSource,
#dropdownAuteur,
#dropdownRepetitionMode,
#dropdownRepetitionSource,
#dropdownRepetitionFaculte,
#dropdownRepetitionAuteur {
  display: none !important;
}

/* Accueil view contents sit directly on the page without enclosed container card */
.accueil-tab-content,
#accueilViewCoursContent,
#modeExamenViewContent,
#residanatViewContent {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* ==========================================================================
   MODULE TABS & COURS PNS STYLE LISTS (NOUVEAU TEST)
   ========================================================================== */

/* Outer scrollable container for the tabs bar */
.module-tabs-container {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  padding: 8px 6px 4px 6px !important;
  box-sizing: border-box !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
  -webkit-overflow-scrolling: touch !important;
  margin-bottom: 6px !important;
}
.module-tabs-container::-webkit-scrollbar {
  display: none !important;
}

/* Selection Summary Bar (Red Rectangle Area: Year Total + Module Breakdown) */
.year-selection-summary-bar {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  padding: 6px 12px 6px 12px !important;
  box-sizing: border-box !important;
  width: 100% !important;
  animation: fadeInSummary 0.18s ease-out !important;
}

@keyframes fadeInSummary {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

.summary-chip {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 4px 11px !important;
  border-radius: 99px !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  transition: all 0.15s ease !important;
  font-family: var(--font-main, 'Plus Jakarta Sans', sans-serif) !important;
}

.summary-chip.year-chip {
  background: rgba(37, 99, 235, 0.10) !important;
  color: var(--primary, #2563eb) !important;
  border: 1px solid rgba(37, 99, 235, 0.22) !important;
}
[data-theme="dark"] .summary-chip.year-chip {
  background: rgba(56, 189, 248, 0.12) !important;
  color: #38bdf8 !important;
  border-color: rgba(56, 189, 248, 0.28) !important;
}

.summary-chip.module-chip {
  background: var(--bg-card, #ffffff) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.25)) !important;
  cursor: pointer !important;
}
[data-theme="dark"] .summary-chip.module-chip {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  color: #e2e8f0 !important;
}
.summary-chip.module-chip:hover {
  border-color: var(--primary, #2563eb) !important;
  background: rgba(37, 99, 235, 0.06) !important;
  transform: translateY(-1px) !important;
}

.chip-module-icon {
  width: 16px !important;
  height: 16px !important;
  border-radius: 4px !important;
  object-fit: contain !important;
  flex-shrink: 0 !important;
}

.chip-divider {
  opacity: 0.35 !important;
  font-size: 10px !important;
}

.chip-qcms {
  color: var(--primary, #2563eb) !important;
  font-weight: 800 !important;
}
[data-theme="dark"] .chip-qcms {
  color: #38bdf8 !important;
}

/* Outer scrollable container for the tabs bar */
.module-tabs-container {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  padding: 6px 12px 4px 12px !important;
  box-sizing: border-box !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
  -webkit-overflow-scrolling: touch !important;
  margin-bottom: 6px !important;
}
.module-tabs-container::-webkit-scrollbar {
  display: none !important;
}

/* Select All Modules Checkbox: Removed on computer & mobile as requested */
.module-tabs-select-all {
  display: none !important;
}

/* Floating full course title tip when clicking truncated course titles */
.pns-course-title-tip {
  position: absolute;
  background: var(--bg-card, #1e293b);
  color: var(--text-main, #ffffff);
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.3));
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  z-index: 99999;
  max-width: 320px;
  word-break: break-word;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.15s ease;
  pointer-events: none;
}
.pns-course-title-tip.visible {
  opacity: 1;
  transform: translateY(0);
}
[data-theme="dark"] .pns-course-title-tip {
  background: #0f172a;
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.15);
}

/* Horizontal pill bar containing module tabs (Matches Year Header background gradient) */
.module-tabs-row {
  display: inline-flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  width: fit-content !important;
  max-width: 100% !important;
  background: linear-gradient(135deg, rgba(37,99,235,.10) 0%, rgba(6,182,212,.06) 100%) !important;
  padding: 3px !important;
  border-radius: 99px !important;
  gap: 3px !important;
  border: 1px solid rgba(37,99,235,.15) !important;
  box-sizing: border-box !important;
}

[data-theme="dark"] .module-tabs-row {
  background: linear-gradient(135deg, rgba(37,99,235,.16) 0%, rgba(6,182,212,.08) 100%) !important;
  border: 1px solid rgba(37,99,235,.20) !important;
}

/* Individual Module Tab Button */
.module-tab {
  padding: 5px 9px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  border-radius: 99px !important;
  color: var(--text-muted) !important;
  white-space: nowrap !important;
  display: inline-flex;
  align-items: center !important;
  gap: 7px !important;
  border: none !important;
  background: transparent !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  user-select: none !important;
  font-family: var(--font-main, 'Plus Jakarta Sans', sans-serif) !important;
  height: 34px !important;
  min-height: unset !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}

.module-tab:hover {
  color: var(--text-main) !important;
  background: rgba(255, 255, 255, 0.4) !important;
}

[data-theme="dark"] .module-tab:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

/* Active Module Tab (Cours PNS Highlight Style) */
.module-tab.active {
  background: var(--bg-input, #ffffff) !important;
  color: var(--primary, #2563eb) !important;
  box-shadow: var(--shadow-sm, 0 2px 6px rgba(0, 0, 0, 0.08)) !important;
  font-weight: 800 !important;
}

[data-theme="dark"] .module-tab.active {
  background: var(--bg-card, #1e293b) !important;
  color: #60a5fa !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

/* Module Tab Checkbox on the left */
.module-tab .module-tab-cb {
  width: 15px !important;
  height: 15px !important;
  border-radius: 4px !important;
  flex-shrink: 0 !important;
  cursor: pointer !important;
}

/* Module Tab Icon */
.module-tab-icon {
  width: 20px !important;
  height: 20px !important;
  border-radius: 6px !important;
  object-fit: contain !important;
  flex-shrink: 0 !important;
}

/* Never show duplicate fallback icon when image exists */
.module-tab-fallback {
  display: none !important;
}

/* Tab States: Default (inactive) hides label */
.module-tab:not(.active) .module-tab-label {
  display: none !important;
}

/* Active Tab: show module name */
.module-tab.active .module-tab-label {
  display: inline-flex !important;
}

/* Module Panels Container */
.module-panels-container {
  width: 100%;
}

.tree-module-panel {
  display: none;
  animation: fadeInModule 0.18s ease;
}
.tree-module-panel.active {
  display: block !important;
}

@keyframes fadeInModule {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Remove all vertical lines and indent gaps in modules & courses */
.tree-modules-container,
.tree-courses-container,
.tree-groups-container,
.tree-children {
  border-left: none !important;
  margin-left: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Course Index Number (1., 2., 3.) - Cours PNS Style */
.course-index-num {
  font-family: var(--font-heading, Manrope, sans-serif) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: var(--primary, #2563eb) !important;
  min-width: 20px !important;
  display: inline-block !important;
  text-align: left !important;
  flex-shrink: 0 !important;
  margin-right: 4px !important;
}
[data-theme="dark"] .course-index-num {
  color: #60a5fa !important;
}

/* Course Row - Clean Row Style */
.tree-lesson-row {
  padding: 7px 10px !important;
  margin: 2px 4px !important;
  border-radius: 8px !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12) !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  transition: background 0.15s ease !important;
  box-sizing: border-box !important;
}
.tree-lesson-row:last-child {
  border-bottom: none !important;
}
.tree-lesson-row:hover {
  background: rgba(37, 99, 235, 0.05) !important;
}
[data-theme="dark"] .tree-lesson-row {
  border-bottom-color: rgba(255, 255, 255, 0.06) !important;
}
[data-theme="dark"] .tree-lesson-row:hover {
  background: rgba(37, 99, 235, 0.12) !important;
}

/* Group Folder Card - Cours PNS Style */
.tree-group-card {
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  border-radius: 10px !important;
  margin: 6px 4px !important;
  background: var(--bg-card, #ffffff) !important;
  box-shadow: none !important;
  overflow: hidden !important;
}
[data-theme="dark"] .tree-group-card {
  background: rgba(15, 23, 42, 0.50) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}
.tree-group-row {
  padding: 8px 12px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  cursor: pointer !important;
  background: transparent !important;
}
.tree-group-card.open .tree-group-row {
  border-bottom: 1px solid rgba(148, 163, 184, 0.15) !important;
}
[data-theme="dark"] .tree-group-card.open .tree-group-row {
  border-bottom-color: rgba(255, 255, 255, 0.06) !important;
}
.tree-group-card .tree-courses-container {
  padding: 4px 6px !important;
  margin: 0 !important;
  border-left: none !important;
}

/* Tree Courses Pill (e.g. 6 📖 instead of (6 cours)) */
.tree-courses-pill {
  font-size: 11px !important;
  font-weight: 700 !important;
  color: var(--text-muted) !important;
  background: rgba(148, 163, 184, 0.12) !important;
  padding: 2px 7px !important;
  border-radius: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  white-space: nowrap !important;
}
[data-theme="dark"] .tree-courses-pill {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #94a3b8 !important;
}

body.mode-examen-active #pnsYearStatsContainer,
body.residanat-active #pnsYearStatsContainer,
body.test-player-active #pnsYearStatsContainer {
  display: none !important;
}

.accueil-view-tabs,
.exam-modes-tabs {
  display: inline-flex;
  align-items: center;
  background: var(--border-color);
  padding: 4px;
  border-radius: 99px;
  gap: 3px;
}

.accueil-view-tabs .tab-btn,
.exam-modes-tabs .tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 99px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.accueil-view-tabs .tab-label-short {
  display: none;
}

.accueil-view-tabs .tab-label-full {
  display: inline;
}

.accueil-view-tabs .tab-btn:hover,
.exam-modes-tabs .tab-btn:hover {
  color: var(--text-main);
}

.accueil-view-tabs .tab-btn.active,
.exam-modes-tabs .tab-btn.active {
  background: var(--bg-input);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.accueil-view-tabs .tab-btn .badge {
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 800;
  margin-left: 2px;
}

/* ===== SUB-TABS (Transparent Background, Gray Border, 44px Equal Height) ===== */
.header-tabs,
#mainHeaderTabs {
  display: inline-flex !important;
  align-items: center !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  box-sizing: border-box !important;
  gap: 0 !important;
  flex-wrap: nowrap !important;
  background: transparent !important;
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.35)) !important;
  border-radius: 12px !important;
  padding: 4px !important;
  max-width: max-content !important;
  transition: opacity 0.25s ease, transform 0.25s ease !important;
  align-self: center !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
  flex-shrink: 0 !important;
}

.header-tabs .tab-btn {
  height: 34px !important;
  box-sizing: border-box !important;
  padding: 0 16px !important;
  border: none;
  background: transparent;
  color: #0f172a !important;
  font-family: inherit;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
  border-radius: 0;
}

.header-tabs .tab-btn + .tab-btn {
  border-left: 1px solid var(--border-color, rgba(148, 163, 184, 0.28)) !important;
}

.header-tabs .tab-btn:first-child {
  border-radius: 8px 0 0 8px !important;
}

.header-tabs .tab-btn:last-child {
  border-radius: 0 8px 8px 0 !important;
}

.header-tabs .tab-btn:only-child {
  border-radius: 8px !important;
}

.header-tabs .tab-btn i {
  font-size: 12px;
  color: #0f172a !important;
  opacity: 0.9;
}

.header-tabs .tab-btn:hover {
  color: var(--primary, #2563eb) !important;
  background: rgba(37, 99, 235, 0.08) !important;
}

.header-tabs .tab-btn:hover i {
  color: var(--primary, #2563eb) !important;
}

.header-tabs .tab-btn.active,
#mainHeaderTabs .tab-btn.active,
[data-theme="dark"] .header-tabs .tab-btn.active,
[data-theme="dark"] #mainHeaderTabs .tab-btn.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  box-shadow: 0 3px 12px rgba(37, 99, 235, 0.35) !important;
}

.header-tabs .tab-btn.active i,
#mainHeaderTabs .tab-btn.active i,
[data-theme="dark"] .header-tabs .tab-btn.active i,
[data-theme="dark"] #mainHeaderTabs .tab-btn.active i {
  color: #ffffff !important;
  opacity: 1 !important;
}

[data-theme="dark"] .header-tabs,
[data-theme="dark"] #mainHeaderTabs {
  background: transparent !important;
  border-color: var(--border-color, rgba(255, 255, 255, 0.14)) !important;
}

[data-theme="dark"] .header-tabs .tab-btn + .tab-btn {
  border-left-color: var(--border-color, rgba(255, 255, 255, 0.14)) !important;
}

[data-theme="dark"] .header-tabs .tab-btn {
  color: #f8fafc !important;
}

[data-theme="dark"] .header-tabs .tab-btn i {
  color: #f8fafc !important;
}

/* View Panels */
.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
  will-change: opacity, transform;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.section-header-row .section-title {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

/* ==========================================================================
   FORM & FILTERS DESIGN
   ========================================================================== */

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-btn {
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.pill-btn:hover {
  transform: translateY(-1px);
}

.pill-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* Search Box style */
.search-bar-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 20px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.search-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  box-shadow: var(--shadow-sm);
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(148, 163, 184, 0.2);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
}
.search-clear-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ==========================================================================
   ACCORDION TREE COMPONENT
   ========================================================================== */
/* ==========================================================================
   ACCORDION TREE COMPONENT — Notes PNS style, modern + space-efficient
   Year = big title / Module = small title + Module icon / Lesson = normal text
   ========================================================================== */
.accordion-tree {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  margin-bottom: 20px;
  max-height: none !important;
  overflow: visible !important;
  padding: 2px 2px 12px;
  transform: translateZ(0);
}

.accordion-tree::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
}

.loading-state {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
}

/* ---- Year card : big modern title ---- */
.tree-year-card {
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: var(--bg-card-solid, #fff);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  overflow: hidden;
}
[data-theme="dark"] .tree-year-card { background: var(--bg-card-solid, #131a2b); }

.tree-year-card:last-child { margin-bottom: 2px; }

.tree-row {
  display: flex !important;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  cursor: pointer;
  user-select: none;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  transition: background .13s ease, color .13s ease;
  position: relative;
}

.tree-year-row {
  padding: 11px 14px;
  gap: 10px;
  border-radius: 0;
  background: linear-gradient(135deg, rgba(37,99,235,.10) 0%, rgba(6,182,212,.06) 100%);
  border-bottom: 1px solid var(--border-color);
}
[data-theme="dark"] .tree-year-row {
  background: linear-gradient(135deg, rgba(37,99,235,.16) 0%, rgba(6,182,212,.08) 100%);
}

.tree-year-row:hover { background: linear-gradient(135deg, rgba(37,99,235,.16) 0%, rgba(6,182,212,.10) 100%); }

.tree-year-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 15px;
  background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  box-shadow: 0 4px 10px rgba(37,99,235,.28);
}

.tree-year-label {
  font-family: var(--font-heading, Manrope, sans-serif);
  font-size: 15px !important;
  font-weight: 800 !important;
  letter-spacing: -.4px;
  color: var(--text-main);
  flex: 1;
}

.tree-module-row {
  padding: 8px 10px;
  margin: 2px 6px;
  border-radius: 10px;
}
.tree-module-row:hover { background: var(--item-bg-hover); }

.tree-module-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  overflow: hidden;
}
[data-theme="dark"] .tree-module-icon { background: rgba(30,41,59,.8); }
.tree-module-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 2px;
}
.tree-module-icon i { font-size: 14px; color: var(--primary); }
.tree-module-icon .tree-icon-fallback { display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 100%; }

.tree-module-label {
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: -.2px;
  color: var(--text-main);
}

.tree-lesson-row {
  padding: 4px 8px 4px 6px;
  margin: 1px 4px;
  font-weight: 500;
  gap: 6px;
  background: transparent !important;
  border-radius: 8px;
}
.tree-lesson-row:hover { background: rgba(37,99,235,.07); }
.tree-lesson-row.active, .tree-row.active { background: rgba(37,99,235,.10); }

.tree-lesson-icon { color: #94a3b8; font-size: 13px; width: 18px; justify-content: center; }
.tree-lesson-row:hover .tree-lesson-icon { color: var(--primary); }
.tree-lesson-label {
  font-size: 12.5px !important;
  font-weight: 500 !important;
  color: var(--text-secondary);
  letter-spacing: -.1px;
}
.tree-lesson-row:hover .tree-lesson-label { color: var(--text-main); }

.group-tag,
.c-tag.group-tag,
.tree-row .group-tag {
  display: none !important;
}

/* ---- Modern checkbox ---- */
.checkbox-custom {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  border: 2px solid rgba(148,163,184,.65);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all .16s cubic-bezier(.4,0,.2,1);
  box-shadow: inset 0 1px 2px rgba(15,23,42,.06);
}
[data-theme="dark"] .checkbox-custom { background: rgba(15,23,42,.9); border-color: rgba(148,163,184,.5); }
.checkbox-custom:hover { border-color: var(--primary); transform: scale(1.07); box-shadow: 0 0 0 3px var(--primary-light); }

.tree-row.checked .checkbox-custom,
.checkbox-custom.checked {
  border-color: var(--primary);
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 3px 8px rgba(37,99,235,.35);
}

.tree-row.checked .checkbox-custom::after,
.checkbox-custom.checked::after {
  content: "\f00c"; /* FontAwesome Check */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 11px;
  color: #fff;
  line-height: 1;
}

.tree-row.partially-checked .checkbox-custom,
.checkbox-custom.partially-checked {
  border-color: var(--primary);
  background: #fff;
}
[data-theme="dark"] .tree-row.partially-checked .checkbox-custom,
[data-theme="dark"] .checkbox-custom.partially-checked { background: rgba(15,23,42,.9); }

.tree-row.partially-checked .checkbox-custom::after,
.checkbox-custom.partially-checked::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
}

.tree-label {
  font-size: 14px;
  font-weight: 700;
  flex: 1 1 auto;
  min-width: 0;
  opacity: 1 !important;
  color: var(--text-main, #f8fafc);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-badges-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
  white-space: nowrap;
}

.tree-badge {
  background: #f1f5f9;
  color: #64748b;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid rgba(148,163,184,.25);
}
[data-theme="dark"] .tree-badge { background: rgba(30,41,59,.8); color: #94a3b8; }

.tree-badge.select-count-badge { min-width: 24px; text-align: center; }
.tree-badge.selected-badge,
.tree-badge.select-count-badge:not(:empty) {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(37,99,235,.3);
}
.tree-total-badge { background: rgba(37,99,235,.07); }

.tree-chevron {
  width: 12px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #a5b4c9;
  font-size: 10px;
  flex-shrink: 0;
  transition: transform .18s ease;
}
.tree-node.open > .tree-row > .tree-chevron,
.tree-year-card.open > .tree-year-row > .tree-chevron,
.tree-module-card.open > .tree-module-row > .tree-chevron { transform: rotate(90deg); color: var(--primary); }
.tree-chevron-empty { display: none !important; width: 0 !important; }

.tree-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tree-icon svg { width: 14px; height: 14px; }

.expand-icon {
  color: var(--text-muted);
  font-size: 12px;
  transition: transform 0.2s;
  width: 16px;
  text-align: center;
}

.tree-year-card.open > .tree-row > .expand-icon,
.tree-year-card.open > .tree-year-row > .expand-icon { transform: rotate(180deg); }

/* Count selection input field */
.selection-count-input {
  width: 80px;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  outline: none;
  background: var(--bg-input);
  text-align: center;
}

.selection-count-input:focus {
  border-color: var(--primary);
}

/* Tree Nested Modules & Courses — Notes PNS indented style, space-efficient */
.tree-modules-container,
.tree-children {
  padding: 4px 6px 8px 6px !important;
  margin-left: 0 !important;
  border-left: none !important;
  background: transparent !important;
  display: none;
}
.tree-children { margin-top: 2px; }

.tree-year-card.open > .tree-modules-container,
.tree-year-card.open > .tree-children {
  display: block;
}

.tree-module-card,
.tree-module-panel {
  border: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.tree-module-card.open,
.tree-module-panel.open,
[data-theme="dark"] .tree-module-card.open,
[data-theme="dark"] .tree-module-panel.open {
  background: transparent !important;
  border: none !important;
}

/* ---- Dark mode: remove solid black fills, reveal night-blue ---- */
[data-theme="dark"] .tree-year-card {
  background: linear-gradient(135deg, rgba(37,99,235,.14) 0%, rgba(15,23,42,.55) 100%);
  border-color: rgba(96,165,250,.22);
}
[data-theme="dark"] .tree-lesson-row,
[data-theme="dark"] .tree-module-row,
[data-theme="dark"] .course-row {
  background: transparent !important;
}
[data-theme="dark"] .checkbox-custom {
  background: rgba(37,99,235,.10) !important;
  border-color: rgba(148,163,184,.55) !important;
  box-shadow: none !important;
}
[data-theme="dark"] .tree-module-icon {
  background: rgba(37,99,235,.12) !important;
  border-color: rgba(96,165,250,.25) !important;
}
[data-theme="dark"] .tree-badge,
[data-theme="dark"] .course-lang-badge {
  background: rgba(37,99,235,.10) !important;
  border-color: rgba(96,165,250,.22) !important;
  color: #93c5fd !important;
}
[data-theme="dark"] .tree-lesson-row:hover,
[data-theme="dark"] .tree-module-row:hover {
  background: rgba(37,99,235,.12) !important;
}

.tree-module-card:last-child {
  border-bottom: none;
}

.tree-row.course-row {
}

/* Zero available QCMs styling (when filters eliminate a course or group) */
.tree-row.zero-available {
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.tree-row.zero-available .checkbox-custom {
  cursor: not-allowed !important;
  opacity: 0.3 !important;
  pointer-events: none !important;
  border-color: rgba(148, 163, 184, 0.4) !important;
  background: rgba(148, 163, 184, 0.1) !important;
}

.tree-row.zero-available .tree-total-badge {
  background: rgba(148, 163, 184, 0.12) !important;
  color: #94a3b8 !important;
  border-color: rgba(148, 163, 184, 0.25) !important;
}

.tree-year-row.zero-available {
  opacity: 0.6;
}

.tree-year-row.zero-available .checkbox-custom {
  cursor: not-allowed !important;
  opacity: 0.3 !important;
  pointer-events: none !important;
}

/* Tree Search Visibility Helpers (Bulletproof show/hide) */
.is-search-hidden,
.course-row.is-search-hidden,
.course-row-ai.is-search-hidden,
.tree-lesson-row.is-search-hidden,
.tree-course-card.is-search-hidden,
.tree-group-card.is-search-hidden,
.tree-year-card.is-search-hidden,
.module-tab.is-search-hidden,
.tree-module-panel.is-search-hidden {
  display: none !important;
}

.tree-search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  gap: 12px;
  color: var(--text-muted);
}
.tree-search-empty-state i {
  font-size: 32px;
  color: var(--text-muted);
  opacity: 0.7;
}
.tree-search-empty-state .search-empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}
.tree-search-empty-state .search-empty-sub {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 360px;
}

.tree-courses-container {
  padding: 2px 4px 4px 4px !important;
  margin-left: 0 !important;
  border-left: none !important;
  background: transparent !important;
  display: none;
}

.tree-module-card.open > .tree-courses-container,
.tree-module-card.open > .tree-children {
  display: block;
}

.course-lang-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 2px 7px;
  border-radius: 6px;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

/* ==========================================================================
   AI EXPANDABLE LESSONS & INLINE CSV FILE MANAGER
   ========================================================================== */
.tree-course-card {
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  border-bottom: 1px solid var(--border-color, rgba(148, 163, 184, 0.16)) !important;
  background: transparent !important;
  transition: background 0.15s ease;
}

.tree-course-card:last-child {
  border-bottom: none !important;
}

.tree-course-card.open {
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid var(--border-color, rgba(148, 163, 184, 0.16)) !important;
}

[data-theme="dark"] .tree-course-card,
[data-theme="dark"] .tree-course-card.open {
  border: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.tree-course-card.open > .tree-course-header > .tree-chevron {
  transform: rotate(90deg);
  color: var(--primary, #2563eb) !important;
}

[data-theme="dark"] .tree-course-card.open > .tree-course-header > .tree-chevron {
  color: #38bdf8 !important;
}

.tree-course-card.open > .tree-course-header > .expand-icon {
  display: none !important;
}

.btn-tree-csv-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary, #2563eb);
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  margin: 0 4px;
}
[data-theme="dark"] .btn-tree-csv-pill {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.25);
}

.btn-tree-csv-pill:hover {
  background: rgba(37, 99, 235, 0.15);
  border-color: var(--primary, #2563eb);
  transform: scale(1.02);
}

.tree-course-csv-container {
  padding: 4px 12px 8px 12px !important;
  border: none !important;
  border-left: none !important;
  margin-left: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 2px !important;
  background: transparent !important;
  border-radius: 0 0 8px 8px !important;
}

.inline-csv-uploader-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  padding: 4px 0 !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  margin-bottom: 6px !important;
  flex-wrap: wrap !important;
}

[data-theme="dark"] .inline-csv-uploader-bar {
  background: transparent !important;
  border: none !important;
}

.btn-inline-upload {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: #10b981;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.btn-inline-upload:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}

.inline-upload-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.inline-csv-files-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inline-csv-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  gap: 10px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

[data-theme="dark"] .inline-csv-file-item {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(148, 163, 184, 0.18);
}

.inline-csv-file-item:hover {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.05);
}

.inline-csv-left {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.inline-csv-icon {
  color: #10b981;
  font-size: 15px;
  flex-shrink: 0;
}

.inline-csv-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.inline-csv-qcount {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

[data-theme="dark"] .inline-csv-qcount {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.inline-csv-date {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.inline-csv-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.btn-inline-action {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
}

.btn-inline-action:hover {
  color: var(--text-main);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.btn-inline-action.btn-inline-delete:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: #ef4444;
}

.btn-inline-action.btn-inline-download:hover {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border-color: #10b981;
}

.btn-inline-action.btn-inline-rename:hover {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border-color: #3b82f6;
}

.inline-csv-empty-box {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(148, 163, 184, 0.05);
  border-radius: 6px;
}


/* ==========================================================================
   TEST CREATION FOOTER & INPUTS
   ========================================================================== */
.test-creation-footer.compact-test-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px 14px;
  margin-top: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.compact-footer-main-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.compact-field-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-field-group.field-test-name {
  flex: 1;
  min-width: 180px;
}

.compact-field-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.compact-field-label i {
  color: var(--primary);
  font-size: 12px;
}

.compact-input-inner {
  flex: 1;
  display: flex;
  align-items: center;
}

.compact-input-inner input[type="text"] {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.compact-input-inner input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.compact-field-group.field-total-qcms {
  flex-shrink: 0;
}

.compact-input-inner.count-box input[type="number"] {
  width: 58px;
  height: 34px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  outline: none;
  transition: all 0.2s ease;
  -moz-appearance: textfield;
}

.compact-input-inner.count-box input[type="number"]::-webkit-outer-spin-button,
.compact-input-inner.count-box input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.compact-input-inner.count-box input[type="number"]:focus {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.compact-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-launch-session {
  height: 34px;
  min-width: 210px;
  padding: 0 18px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
  transition: background .2s ease, box-shadow .2s ease;
  transform: none !important;
}

.btn-launch-session i {
  font-size: 11px;
}

.btn-launch-session:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transform: none;
}

.btn-launch-session:active {
  transform: none;
}

.btn-launch-session:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Colored Download Box (PDF + ZIP + sommaire par groupes) */
.compact-pdf-toolbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
  width: 100%;
}
.compact-pdf-toolbar.pns-download-box {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.10) 0%, rgba(139, 92, 246, 0.10) 100%);
  border: 1.5px solid rgba(37, 99, 235, 0.30);
  border-radius: 14px;
  padding: 12px 14px;
  gap: 10px;
}
[data-theme="dark"] .compact-pdf-toolbar.pns-download-box {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16) 0%, rgba(139, 92, 246, 0.16) 100%);
  border-color: rgba(96, 165, 250, 0.35);
}

.pns-download-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
}

.pns-download-sub {
  color: var(--primary);
}
.pns-download-sub i {
  color: var(--primary);
}
.btn-zip.pns-download-sub i {
  color: #8b5cf6;
}

/* Split-by-groups option */
.pns-split-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 9px;
  padding: 5px 10px;
  transition: border-color 0.15s ease;
}
.pns-split-option:hover {
  border-color: var(--primary);
}
.pns-split-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.pns-split-option em {
  font-style: normal;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 10.5px;
}
.pns-split-check {
  width: 20px;
  height: 20px;
  border-radius: 7px;
  border: 2px solid rgba(148, 163, 184, 0.65);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.16s ease;
}
[data-theme="dark"] .pns-split-check {
  background: rgba(15, 23, 42, 0.9);
}
.pns-split-option input:checked + .pns-split-check {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.35);
}

/* ZIP chips (purple, same sizing as PDF chips) */
.btn-pdf-chip.btn-zip {
  border-color: rgba(139, 92, 246, 0.45);
}
.btn-pdf-chip.btn-zip i {
  color: #8b5cf6;
}
.btn-pdf-chip.btn-zip:hover {
  border-color: #8b5cf6;
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.08);
  transform: translateY(-1px);
}

@media (min-width: 769px) {
  .btn-pdf-chip#btnZip1,
  .btn-pdf-chip#btnZip2,
  .btn-pdf-chip#btnZip3 {
    flex: 1.25 1 0;
  }
  .btn-pdf-chip#btnZip4,
  .btn-pdf-chip#btnZip5 {
    flex: 0.85 1 0;
  }
}

@media (max-width: 768px) {
  .compact-pdf-chips .btn-pdf-chip#btnZip1 {
    grid-column: 1 / -1 !important;
    height: 32px !important;
  }
}

/* Image PDF chips (emerald/teal tone with photo/image icon) */
.btn-pdf-chip.btn-pdf-img {
  border-color: rgba(16, 185, 129, 0.45);
}
.btn-pdf-chip.btn-pdf-img i {
  color: #10b981;
}
.btn-pdf-chip.btn-pdf-img:hover {
  border-color: #10b981;
  color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  transform: translateY(-1px);
}

@media (min-width: 769px) {
  .btn-pdf-chip#btnPdfImg1,
  .btn-pdf-chip#btnPdfImg2,
  .btn-pdf-chip#btnPdfImg3 {
    flex: 1.25 1 0;
  }
  .btn-pdf-chip#btnPdfImg4,
  .btn-pdf-chip#btnPdfImg5 {
    flex: 0.85 1 0;
  }
}

@media (max-width: 768px) {
  .compact-pdf-chips .btn-pdf-chip#btnPdfImg1 {
    grid-column: 1 / -1 !important;
    height: 32px !important;
  }
}

.btn-pdf-mode-exam.btn-pdf-img,
.btn-pdf-residanat.btn-pdf-img {
  border-color: rgba(16, 185, 129, 0.45);
}
.btn-pdf-mode-exam.btn-pdf-img i,
.btn-pdf-residanat.btn-pdf-img i {
  color: #10b981;
}
.btn-pdf-mode-exam.btn-pdf-img:hover,
.btn-pdf-residanat.btn-pdf-img:hover {
  border-color: #10b981;
  color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

/* ---- Group level rows in Nouveau Test tree ---- */
.tree-groups-container {
  display: none;
  padding: 4px 12px 6px 12px !important;
  margin-left: 0 !important;
  border-left: none !important;
  background: transparent !important;
}
.tree-module-card.open > .tree-groups-container,
.tree-module-panel.open > .tree-groups-container {
  display: block !important;
}
.tree-module-panel > .tree-courses-container {
  padding: 4px 12px 6px 12px !important;
}
.tree-group-card.open > .tree-courses-container {
  display: block;
}
.tree-group-card .tree-courses-container {
  padding: 2px 4px 4px 4px !important;
  margin-left: 0 !important;
  border-left: none !important;
}
.tree-group-card {
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.2)) !important;
  border-radius: 10px !important;
  margin: 6px 0 !important;
  background: var(--bg-card, #ffffff) !important;
  overflow: hidden !important;
  box-shadow: none !important;
}
[data-theme="dark"] .tree-group-card {
  background: rgba(15, 23, 42, 0.50) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}
.tree-group-card.open {
  background: var(--bg-card, #ffffff) !important;
}
[data-theme="dark"] .tree-group-card.open {
  background: rgba(15, 23, 42, 0.50) !important;
}
.tree-row.tree-group-row {
  padding: 8px 12px !important;
}
.tree-group-card:not(.open) .tree-group-row {
  border-bottom: none !important;
}
.tree-group-card.open .tree-group-row {
  border-bottom: 1px solid rgba(148, 163, 184, 0.15) !important;
}
[data-theme="dark"] .tree-group-card.open .tree-group-row {
  border-bottom-color: rgba(255, 255, 255, 0.06) !important;
}
.tree-group-card:not(.open) > .tree-courses-container {
  display: none !important;
}
.tree-group-card.open > .tree-courses-container {
  display: block !important;
}
.tree-group-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.20);
  color: var(--primary, #2563eb);
  font-size: 12px;
}
.tree-group-icon i {
  font-size: 12px;
  color: var(--primary, #2563eb);
}
[data-theme="dark"] .tree-group-icon {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.25);
}
[data-theme="dark"] .tree-group-icon i {
  color: #38bdf8;
}
.tree-group-label {
  font-size: 12.5px !important;
  font-weight: 700 !important;
  color: var(--text-main);
}
.tree-group-card > .tree-group-row > .tree-chevron {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.tree-group-card.open > .tree-group-row > .tree-chevron {
  transform: rotate(90deg) !important;
  color: var(--primary, #2563eb) !important;
}
[data-theme="dark"] .tree-group-card.open > .tree-group-row > .tree-chevron {
  color: #60a5fa !important;
}

.compact-pdf-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.compact-pdf-label i {
  color: #ef4444;
  font-size: 12px;
}

.compact-pdf-chips {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
}

.btn-pdf-chip {
  flex: 1 1 0;
  min-width: 0;
  height: 28px;
  padding: 0 5px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  border-radius: 6px;
  font-size: clamp(9px, 0.72vw, 10.5px);
  font-weight: 600;
  letter-spacing: -0.2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.btn-pdf-chip i {
  color: #ef4444;
  font-size: 10px;
  flex-shrink: 0;
}

.btn-pdf-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  line-height: 1.1;
}

/* Proportional flex on desktop so longer titles (A4/notes/justif) have adequate room, while shorter (A5) don't waste space */
@media (min-width: 769px) {
  .btn-pdf-chip#btnPdf1,
  .btn-pdf-chip#btnPdf2,
  .btn-pdf-chip#btnPdf3 {
    flex: 1.25 1 0;
  }

  .btn-pdf-chip#btnPdf4,
  .btn-pdf-chip#btnPdf5 {
    flex: 0.85 1 0;
  }

  .btn-pdf-chip#btnPdfFc1,
  .btn-pdf-chip#btnPdfFc2,
  .btn-pdf-chip#btnPdfFc3 {
    flex: 1 1 0;
  }

  .btn-pdf-chip#btnPdfFc4 {
    flex: 1.3 1 0;
  }
}

@media (max-width: 1024px) and (min-width: 769px) {
  .btn-pdf-chip {
    font-size: 9px !important;
    letter-spacing: -0.25px !important;
    padding: 0 3px !important;
    gap: 3px !important;
  }
  .btn-pdf-chip i {
    font-size: 9px !important;
  }
}

.btn-pdf-chip:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
  transform: translateY(-1px);
}

.btn-pdf-chip-flashcards,
.btn-pdf-chip.btn-pdf-fc {
  border-color: rgba(239, 68, 68, 0.35);
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.03);
}

.btn-pdf-chip.btn-pdf-fc i {
  color: #ef4444;
}

.btn-pdf-chip.btn-pdf-fc:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .compact-pdf-chips {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .compact-pdf-chips .btn-pdf-chip#btnPdf1,
  .compact-pdf-chips .btn-pdf-chip#btnPdfFc4 {
    grid-column: 1 / -1 !important;
    height: 32px !important;
  }

  .compact-pdf-chips .btn-pdf-chip {
    width: 100% !important;
    height: 30px !important;
    font-size: 10.5px !important;
    padding: 0 5px !important;
    gap: 4px !important;
  }

  .compact-pdf-chips .btn-pdf-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.btn-pdf-chip-flashcards:hover {
  border-color: #10b981;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
}

@media (max-width: 820px) {
  .compact-footer-main-row {
    flex-wrap: wrap;
  }
  .compact-field-group.field-test-name {
    width: 100%;
    min-width: 100%;
  }
  .compact-field-group.field-total-qcms {
    flex: 1;
  }
  .compact-footer-actions {
    flex: 1;
  }
  .btn-launch-session {
    width: 100%;
    justify-content: center;
  }
}

/* General Buttons styling */
.btn {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--item-bg-hover);
}

.btn-danger {
  background: var(--error);
  color: #fff;
}

.btn-danger:hover {
  background: var(--error-hover);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-warning {
  background: #f59e0b;
  color: #fff;
}

.btn-warning:hover {
  background: #d97706;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.28);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ==========================================================================
   SAVED EXAMS VIEW
   ========================================================================== */
.saved-exams-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.saved-exams-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.saved-exams-filters {
  margin: 0;
}

.saved-exams-header .section-title {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.counter-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 99px;
  margin-left: 8px;
}

.saved-exams-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.saved-exams-controls .search-bar-wrapper {
  margin-bottom: 0;
  flex: 1;
}

.btn-filter {
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 700;
  border-radius: 12px;
  color: var(--text-muted);
}

.btn-filter:hover {
  background: var(--item-bg-hover);
  color: var(--text-main);
}

/* Advanced filters row */
.advanced-filters-row {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 18px;
  gap: 16px;
  flex-wrap: wrap;
}

.advanced-filters-row.open {
  display: flex;
}

.select-wrapper {
  display: flex;
  align-items: center;
  min-width: 180px;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}

.select-wrapper select {
  min-width: 130px;
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  outline: none;
}

/* Cards Grid */
.exams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
  width: 100%;
}


/* Card Styling */
.exam-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.exam-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--primary);
}

.exam-card.completed::before {
  background: var(--success);
}

.exam-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.exam-card-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;
}

.exam-card-year {
  background: var(--border-color);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
}

.exam-card-details {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.exam-card-details li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.exam-card-details i {
  color: var(--primary);
  width: 14px;
  text-align: center;
}

/* Progress bar inside card */
.progress-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.progress-text-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
}

.progress-label {
  color: var(--text-muted);
}

.progress-pct {
  color: var(--primary);
}

.progress-track {
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: var(--border-color);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
}

.score-display-box {
  margin-top: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
}

.score-lbl {
  color: var(--text-muted);
}

.score-val {
  color: var(--primary);
  font-size: 16px;
}

.exam-card-footer {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.btn-icon:hover {
  background: var(--item-bg-hover);
  color: var(--text-main);
}

.btn-icon.btn-danger-icon:hover {
  background: var(--error-light);
  color: var(--error);
  border-color: var(--error);
}

.btn-icon.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(99, 102, 241, 0.35);
}

.btn-icon:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.exam-card-submeta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.session-counter-chip {
  background: rgba(99, 102, 241, 0.08);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}

.exam-session-highlight {
  border: 1px solid var(--border-color);
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.05), rgba(99, 102, 241, 0.015));
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.exam-session-highlight.empty {
  background: var(--bg-input);
}

.exam-session-highlight-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.session-mini-label {
  display: inline-block;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.session-highlight-title {
  font-size: 15px;
  font-weight: 800;
}

.session-status-badge,
.session-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.session-status-badge.in-progress,
.session-status-pill.in-progress {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.session-status-badge.completed,
.session-status-pill.completed {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.session-status-badge.not-started,
.session-status-pill.not-started {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
}

.session-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.session-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.session-kpi span {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.session-kpi strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

.empty-session-state {
  display: flex;
  gap: 12px;
  align-items: center;
}

.empty-session-state i {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  flex-shrink: 0;
}

.empty-session-state h4 {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 4px;
}

.empty-session-state p {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.exam-sessions-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.exam-sessions-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.exam-sessions-panel-head h4 {
  font-size: 13px;
  font-weight: 800;
}

.exam-sessions-panel-head span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.exam-session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
}

.exam-session-row.empty-row {
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.exam-session-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exam-session-row-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.exam-session-row-top strong {
  font-size: 13px;
  font-weight: 800;
}

.exam-session-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.btn-open-session {
  white-space: nowrap;
}

/* Session Analysis Modal */
.session-analysis-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
}

.session-analysis-modal.open {
  display: block;
}

.session-analysis-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
}

.session-analysis-panel {
  position: relative;
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: 16px auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overflow: auto;
}

.session-analysis-header,
.session-analysis-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
}

.session-analysis-header {
  border-bottom: 1px solid var(--border-color);
}

.session-analysis-header-left {
  display: flex;
  align-items: center;
}

.session-analysis-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.session-analysis-header-actions .btn {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.session-analysis-header-actions .btn-secondary {
  background: var(--bg-input, #f1f5f9);
  color: var(--text-color, #1e293b);
  border: 1px solid var(--border-color, #cbd5e1);
}

.session-analysis-header-actions .btn-secondary:hover {
  background: var(--border-color, #e2e8f0);
}

.session-analysis-header-actions .btn-primary {
  background: var(--primary, #0284c7);
  color: #fff;
  border: 1px solid var(--primary, #0284c7);
}

.session-analysis-header-actions .btn-primary:hover {
  background: var(--primary-hover, #0369a1);
}

.session-analysis-top-actions {
  display: none;
}

.session-analysis-kicker {
  display: inline-block;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0;
}

.session-analysis-header h3 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 850;
}

.session-analysis-close {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.session-analysis-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.session-analysis-hero {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.session-score-ring {
  --score-progress: 0%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  margin: 0 auto;
  background: conic-gradient(var(--primary) var(--score-progress), rgba(148, 163, 184, 0.18) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.15);
}

.session-score-inner {
  width: 136px;
  height: 136px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}

.session-score-value {
  font-size: 30px;
  font-weight: 900;
  color: var(--text-main);
}

.session-score-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.session-analysis-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-summary-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.session-summary-head h4 {
  font-size: 20px;
  font-weight: 850;
}

.session-summary-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.session-summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.session-summary-metric {
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.session-summary-metric span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.session-summary-metric strong {
  font-size: 22px;
  font-weight: 900;
}

.session-stats-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.session-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  font-size: 13px;
}

.session-stats-row span {
  color: var(--text-muted);
  font-weight: 700;
}

.session-stats-row strong {
  font-weight: 900;
  color: var(--text-main);
}

.session-chart-card {
  border: 1px solid var(--border-color);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.04), rgba(148, 163, 184, 0.03));
  padding: 18px;
}

.session-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.session-chart-header h4 {
  font-size: 15px;
  font-weight: 850;
}

.session-chart-header span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.session-chart-svg-wrap {
  width: 100%;
  overflow: auto;
}

.session-chart-svg {
  width: 100%;
  min-width: 620px;
  height: auto;
}

.chart-axis {
  stroke: rgba(148, 163, 184, 0.65);
  stroke-width: 1.3;
}

.chart-grid {
  stroke: rgba(148, 163, 184, 0.18);
  stroke-width: 1;
}

.chart-line {
  stroke: var(--primary);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: var(--primary);
}

.chart-tick,
.chart-empty-label {
  fill: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.session-analysis-footer {
  border-top: 1px solid var(--border-color);
}

.session-bars-card {
  border: 1px solid var(--border-color);
  border-radius: 18px;
  background: var(--bg-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-bars-card h4 {
  font-size: 14px;
  font-weight: 850;
  margin: 0;
  color: var(--text-main);
}

.session-bars-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.session-bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-bar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.session-bar-track {
  height: 8px;
  background: rgba(148, 163, 184, 0.12);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.session-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.session-bar-fill.correct {
  background: var(--success);
}

.session-bar-fill.incorrect {
  background: var(--error);
}

.session-bar-fill.unanswered {
  background: var(--text-muted);
}

/* Grid Layout for modern dashboard in Desktop view */
@media (min-width: 769px) {
  .session-analysis-body {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  .session-analysis-hero {
    grid-column: span 2;
  }
  
  .session-stats-table {
    grid-column: span 1;
  }
  
  .session-bars-card {
    grid-column: span 1;
  }
  
  .session-chart-card {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .session-kpi-grid,
  .session-summary-metrics,
  .session-stats-table {
    grid-template-columns: 1fr;
  }

  .exam-session-row {
    flex-direction: column;
    align-items: stretch;
  }

  .session-analysis-panel {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin: 8px auto;
    border-radius: 18px;
  }

  .session-analysis-header,
  .session-analysis-footer,
  .session-analysis-body {
    padding: 16px;
  }

  .session-analysis-hero {
    grid-template-columns: 1fr;
  }

  .session-summary-head {
    align-items: flex-start;
  }
}

/* ==========================================================================
   TEST PLAYER VIEW
   ========================================================================== */
.player-sidebar-header h3 {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.question-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
}

.question-nav-item:hover {
  background: var(--item-bg-hover);
}

.question-nav-item.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.question-nav-item.correct-answered {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
}

.question-nav-item.error-answered {
  border-color: var(--error);
  background: var(--error-light);
  color: var(--error);
}

.question-nav-item.warning-state {
  border-color: var(--warning);
  background: var(--warning-light, rgba(245, 158, 11, 0.08));
  color: #ca8a04;
}

.nav-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 8px;
  flex-grow: 1;
}

.nav-item-time {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Workspace container */
.player-workspace {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overscroll-behavior: contain;
}

/* Header */
.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px 18px;
  border-radius: 16px;
  flex-wrap: wrap;
  gap: 16px;
}

.timer-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
}

.timer-display i {
  color: var(--primary);
}

.timer-display.question-timer i {
  color: var(--warning);
}

@media (max-width: 768px) {
  #testPlayerPanel .player-split-layout {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px 12px 96px !important;
  }

  #testPlayerPanel .player-workspace {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  #testPlayerPanel .player-sidebar {
    left: 0 !important;
    top: 0 !important;
    bottom: 72px !important;
    width: 100vw !important;
    max-width: none !important;
    transform: translateX(-100%) !important;
    visibility: hidden;
    opacity: 0;
    pointer-events: none !important;
    z-index: 120 !important;
  }

  #testPlayerPanel.mobile-sidebar-open .player-sidebar {
    transform: translateX(0) !important;
    visibility: visible;
    opacity: 1;
    pointer-events: auto !important;
  }

  #testPlayerPanel.mobile-sidebar-open .player-workspace {
    display: flex !important;
  }

  #testPlayerPanel .player-sidebar .search-bar-wrapper {
    margin-bottom: 12px;
  }

  #testPlayerPanel .player-sidebar .search-icon {
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    z-index: 1;
    pointer-events: none;
  }

  #testPlayerPanel .player-sidebar .search-input {
    padding-left: 46px;
  }
}

.stats-counter-group {
  display: flex;
  gap: 16px;
}

.stat-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

.stat-counter .count-val {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
}

.stat-counter .count-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-counter.correct .count-val {
  color: var(--success);
}

.stat-counter.incorrect .count-val {
  color: var(--error);
}

.stat-counter.score .count-val {
  color: var(--primary);
}

.player-header .header-search {
  max-width: 200px;
  margin-bottom: 0;
}

/* Active tags row */
.active-tags-row {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  max-width: 100%;
}
.active-tags-row::-webkit-scrollbar {
  display: none;
}

.active-tag {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  max-width: 180px;
  min-width: 0;
  flex-shrink: 1;
  white-space: nowrap;
  height: 30px;
  box-sizing: border-box;
}
.active-tag .tag-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}
.active-tag i {
  flex-shrink: 0;
}

.active-tag.clickable-tag {
  cursor: pointer;
}

.active-tag.clickable-tag:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.active-tag i {
  color: var(--text-muted);
}

.active-tag-input {
  gap: 8px;
  cursor: pointer;
}

/* Special styling for QCM number tag - Blue background */
.active-tag-qcm-number {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
}

.active-tag-qcm-number i {
  color: #ffffff !important;
}

.active-tag-qcm-number:hover {
  background: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
}

/* Filter Dropdown */
.filter-dropdown {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  min-width: 200px;
  max-width: 300px;
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-card-solid, rgba(17, 26, 54, 0.98));
}

.filter-dropdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s ease;
  gap: 12px;
}

.filter-dropdown-item:hover {
  background: var(--item-bg-hover);
}

.filter-dropdown-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.filter-dropdown-item .option-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-dropdown-item .option-count {
  font-size: 10px;
  font-weight: 800;
  background: var(--border-color);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  color: var(--text-muted);
}

.filter-dropdown-item.active .option-count {
  background: var(--primary);
  color: white;
}

/* Action Toolbar */
.player-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  gap: 4px;
}

.tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  border: 1px solid transparent;
}

.tool-btn:hover {
  background: var(--item-bg-hover);
  color: var(--text-main);
}

.tool-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.tool-btn.tool-todo-btn {
  background: transparent;
  color: #f59e0b;
  border-color: transparent;
}

.tool-btn.tool-todo-btn:hover {
  background: var(--item-bg-hover);
  color: #f59e0b;
}

.tool-btn.tool-todo-btn.active {
  background: transparent;
  color: #f59e0b;
  border-color: #f59e0b;
}

.tool-btn.prev-btn {
  background: transparent;
  color: var(--primary);
  border: 1px solid transparent;
}

.tool-btn.prev-btn:hover {
  background: var(--item-bg-hover);
  color: var(--primary-hover);
}

.tool-btn.next-btn {
  background: transparent;
  color: var(--primary);
  border: 1px solid transparent;
}

.tool-btn.next-btn:hover {
  background: var(--item-bg-hover);
  color: var(--primary-hover);
}

/* QCM Actions Bar (Précédent | Vérifier | Suivant) */
.qcm-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  margin-bottom: 12px;
  width: 100%;
  box-sizing: border-box;
}

.qcm-nav-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: unset !important;
  height: 38px !important;
  min-height: 38px !important;
  gap: 8px !important;
  padding: 8px 20px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  user-select: none !important;
  font-family: var(--font-main, inherit) !important;
  border: 1px solid var(--border-color) !important;
  background: var(--item-bg-hover) !important;
  color: var(--text-main) !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
}

.qcm-nav-btn:hover {
  background: var(--item-bg-hover) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.qcm-nav-btn:active {
  transform: translateY(0) !important;
}

/* Précédent & Suivant Buttons */
.qcm-nav-btn.btn-prev i,
.qcm-nav-btn.btn-next i {
  font-size: 13px !important;
  color: var(--primary) !important;
  transition: transform 0.2s ease !important;
}

.qcm-nav-btn.btn-prev:hover i {
  transform: translateX(-3px) !important;
}

.qcm-nav-btn.btn-next:hover i {
  transform: translateX(3px) !important;
}

/* Vérifier Button (Center Primary Button) */
.qcm-nav-btn.btn-verify,
#toolVerify.qcm-nav-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  border: 1px solid #10b981 !important;
  color: #ffffff !important;
  padding: 8px 28px !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28) !important;
}

.qcm-nav-btn.btn-verify i,
#toolVerify.qcm-nav-btn i {
  font-size: 14px !important;
  color: #ffffff !important;
}

.qcm-nav-btn.btn-verify:hover,
#toolVerify.qcm-nav-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  border-color: #047857 !important;
  color: #ffffff !important;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4) !important;
  transform: translateY(-1px) !important;
}

.qcm-nav-btn.btn-verify:active,
#toolVerify.qcm-nav-btn:active {
  transform: translateY(0) !important;
}

.qcm-nav-btn:disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  transform: none !important;
}

/* Gray divider line between action buttons and question meta */
.qcm-meta-divider {
  width: 100%;
  height: 1px;
  background: var(--border-color);
  margin: 10px 0 14px 0;
  opacity: 0.85;
}

/* Main Question Card */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
}

.question-meta {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* Question Info Inline (Une seule RJ / Plusieurs RJ) - styled EXACTLY like .question-lang-indicator */
.question-info-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--item-bg-hover);
  border: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.2px;
  transition: all 0.2s ease;
  margin: 0;
}

.question-info-inline i {
  color: var(--primary);
  font-size: 12px;
}

.ratings {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  gap: 12px;
}

.rating-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ratings .stars {
  display: inline-flex;
  gap: 2px;
  color: var(--warning);
}

.ratings .stars i {
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease;
}

.ratings .stars i:hover {
  transform: scale(1.15);
}

.question-lang-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--item-bg-hover);
  border: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.2px;
  transition: all 0.2s ease;
}

.question-lang-indicator i {
  color: var(--primary);
  font-size: 12px;
}

.question-lang-indicator.is-translated {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
}

.question-text {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.45;
  margin-bottom: 12px;
}

/* Arabic translation text styling */
.question-text.ar {
  direction: rtl;
  text-align: right;
  line-height: 1.7;
}

/* Options Container styling */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 24px;
  border-top: 1px solid var(--border-color);
}

.option-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  box-shadow: none;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  width: 100%;
  position: relative;
  flex-wrap: nowrap;
}

.option-item:hover {
  background: rgba(148, 163, 184, 0.05);
}

.option-letter {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 0;
  align-self: center;
}

.option-text {
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
  margin-top: 0;
  align-self: center;
}

.option-item.selected {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
}

.option-item.selected .option-text {
  color: var(--primary);
  font-weight: 800;
}

.option-item.selected .option-letter {
  background: var(--primary);
  color: #fff;
}

/* Strike button (X icon) */
.option-strike-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  margin-left: 8px;
  align-self: center;
}

.option-strike-btn:hover {
  background: var(--error-light);
  border-color: var(--error);
  color: var(--error);
  transform: scale(1.1);
}

/* Striked option style */
.option-item.striked {
  opacity: 0.5;
  position: relative;
}

.option-item.striked .option-text {
  text-decoration: line-through;
  text-decoration-color: var(--error);
  text-decoration-thickness: 2px;
}

.option-item.striked .option-letter {
  background: var(--error-light);
  color: var(--error);
}

/* Justification button */
.option-justify-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--warning);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  margin-left: 2px !important;
  margin-right: 0 !important;
  font-size: 15px;
  align-self: center;
  cursor: pointer;
  box-shadow: none;
  order: 3 !important;
}

.option-justify-btn:hover {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  transform: scale(1.15);
}

/* Justification content - GAP ELIMINATED */
.option-justification {
  width: 100%;
  margin-top: 4px;
  padding: 8px 36px 8px 12px;
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--warning);
  border-radius: 8px;
  animation: slideDown 0.18s ease-out;
  position: relative;
  box-sizing: border-box;
}

.justification-header {
  display: none;
}

.option-justification p,
.option-justification .justification-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-main);
  word-break: break-word;
}

.option-item.showing-justification {
  flex-wrap: wrap;
  row-gap: 2px;
}

.option-item.showing-justification .option-justification {
  order: 10;
  margin-top: 4px;
}

/* Copy buttons styling */
.btn-copy-action {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted, #94a3b8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
  padding: 0;
}

[data-theme="light"] .btn-copy-action {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

.btn-copy-action:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  transform: scale(1.08);
}

.btn-copy-action.copied {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  color: #10b981 !important;
  transform: scale(1.08);
}

.question-text-header {
  display: flow-root;
  width: 100%;
  margin-bottom: 12px;
}

.question-header-actions {
  float: right;
  float: inline-end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  margin-inline-start: 10px;
  margin-bottom: 4px;
  margin-block-end: 4px;
}

.question-text-header .question-text {
  margin-bottom: 0 !important;
}

.option-justification .btn-copy-justif {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.general-explanation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.general-explanation-header h4 {
  margin: 0;
}

/* Circular Confidence Dial (Modern Compact Meter) */
.option-confidence-dial {
  width: 30px;
  height: 30px;
  min-width: 30px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  margin-left: auto !important;
  margin-right: 4px !important;
  order: 1 !important;
  border-radius: 50%;
  transition: transform 0.15s ease;
  align-self: center;
}

.option-confidence-dial:hover {
  transform: scale(1.14);
}

.confidence-dial-svg {
  width: 30px;
  height: 30px;
  transform: rotate(-90deg);
  pointer-events: none;
}

.dial-track {
  fill: transparent;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 3;
}

[data-theme="light"] .dial-track {
  stroke: rgba(0, 0, 0, 0.1);
}

.dial-progress {
  fill: transparent;
  stroke: #06b6d4;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.12s ease, stroke 0.2s ease;
}

.dial-thumb {
  fill: #ffffff;
  stroke: #0284c7;
  stroke-width: 1.5;
  transition: cx 0.12s ease, cy 0.12s ease;
}

.dial-value-text {
  position: absolute;
  font-size: 8px;
  font-weight: 800;
  color: #94a3b8;
  pointer-events: none;
  letter-spacing: -0.3px;
  font-family: var(--font-heading, inherit);
  text-align: center;
}

[data-theme="light"] .dial-value-text {
  color: #475569;
}

.option-confidence-dial.has-value .dial-value-text {
  color: #38bdf8;
}

.option-confidence-dial.high-confidence .dial-progress {
  stroke: #10b981;
}
.option-confidence-dial.high-confidence .dial-thumb {
  stroke: #059669;
}
.option-confidence-dial.high-confidence .dial-value-text {
  color: #10b981;
}

.option-confidence-dial.mid-confidence .dial-progress {
  stroke: #3b82f6;
}
.option-confidence-dial.mid-confidence .dial-thumb {
  stroke: #2563eb;
}
.option-confidence-dial.mid-confidence .dial-value-text {
  color: #3b82f6;
}

.option-confidence-dial.low-confidence .dial-progress {
  stroke: #f59e0b;
}
.option-confidence-dial.low-confidence .dial-thumb {
  stroke: #d97706;
}
.option-confidence-dial.low-confidence .dial-value-text {
  color: #f59e0b;
}

.option-item.correct::after,
.option-item.incorrect::after,
.option-item.correct-missed::after {
  margin-left: 0 !important;
  margin-right: 4px !important;
  order: 2 !important;
  align-self: center !important;
  margin-top: 0 !important;
}

/* Meta AI Action Buttons */
.meta-ai-actions {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 0 0 auto !important;
  margin-left: 6px !important;
}

.btn-meta-ai {
  width: 26px !important;
  height: 26px !important;
  border-radius: 7px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 3px !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15) !important;
  flex-shrink: 0 !important;
}

[data-theme="light"] .btn-meta-ai {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

.btn-meta-ai:hover {
  transform: translateY(-2px) scale(1.12) !important;
  background: rgba(255, 255, 255, 0.18) !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25) !important;
}

.btn-meta-ai img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  border-radius: 4px !important;
  pointer-events: none !important;
}

/* Floating Text Selection Context Menu */
.text-selection-menu {
  position: fixed;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 8px 10px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 230px;
  animation: popSelectionMenu 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

@keyframes popSelectionMenu {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.selection-menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 6px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.selection-menu-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.menu-group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  white-space: nowrap;
}

.menu-group-label i {
  font-size: 11px;
  color: #38bdf8;
  width: 14px;
  text-align: center;
}

.color-options {
  display: flex;
  align-items: center;
  gap: 5px;
}

.color-dot {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.color-dot:hover {
  transform: scale(1.3);
  border-color: #fff;
}

.selection-menu-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 2px;
}

.action-item-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-item-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.action-item-btn.btn-strike:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}

/* Annotations inside text */
.qcm-highlight {
  border-radius: 3px;
  padding: 1px 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.qcm-underline {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

.qcm-text-color {
  font-weight: 700;
}

.qcm-strikethrough {
  text-decoration: line-through;
  text-decoration-color: #ef4444;
  text-decoration-thickness: 2px;
  opacity: 0.8;
}

/* Explication Générale Modal */
.explication-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.explication-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
}

.explication-panel {
  position: relative;
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.explication-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--primary-light);
}

.explication-header h3 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 850;
  color: var(--primary);
  margin: 0;
}

.explication-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.explication-close:hover {
  background: var(--error-light);
  border-color: var(--error);
  color: var(--error);
}

.explication-body {
  padding: 24px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

.explication-body p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-main);
  margin: 0;
}

/* Correct/Incorrect Verification States */
.option-item.correct {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
}

.option-item.correct .option-text {
  color: var(--success);
  font-weight: 800;
}

.option-item.correct .option-letter {
  background: var(--success);
  color: #fff;
}

.option-item.correct::after {
  content: "\f00c"; /* Check icon */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: var(--success);
  font-size: 14px;
  margin-left: auto;
  margin-top: 5px;
  order: 2;
}

.option-item.incorrect {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
}

.option-item.incorrect .option-text {
  color: var(--error);
  font-weight: 800;
}

.option-item.incorrect .option-letter {
  background: var(--error);
  color: #fff;
}

.option-item.incorrect::after {
  content: "\f00d"; /* Cross icon */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: var(--error);
  font-size: 14px;
  margin-left: auto;
  margin-top: 5px;
  order: 2;
}

.option-item.correct-missed {
  background: rgba(245, 158, 11, 0.05);
  border-bottom: 1px solid var(--border-color);
}

.option-item.correct-missed .option-text {
  color: #d97706;
  font-weight: 800;
}

.option-item.correct-missed .option-letter {
  background: #f59e0b;
  color: #fff;
}

.option-item.correct-missed::after {
  content: "\f06a"; /* Exclamation circle icon */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: #f59e0b;
  font-size: 14px;
  margin-left: auto;
  margin-top: 5px;
  order: 2;
}

/* ==========================================================================
   EXPLANATIONS SECTION
   ========================================================================== */
.explanations-card {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.3s ease-out;
  margin-top: 24px;
}

.explanations-card.open {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.explanations-card h3 {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--primary);
}

.options-feedback {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.option-feedback-item {
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 12px;
  border-left: 3px solid var(--border-color);
  background: var(--bg-input);
  border-radius: 0 8px 8px 0;
}

.option-feedback-item.correct-opt {
  border-left-color: var(--success);
}

.option-feedback-item.incorrect-opt {
  border-left-color: var(--error);
}

.feedback-letter {
  font-weight: 800;
  margin-right: 6px;
}

.general-explanation-box {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.general-explanation-box h4 {
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
}

.general-explanation-box p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ==========================================================================
   COMMENTS CARD & DIALOGS
   ========================================================================== */
.comments-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-top: 24px;
}

.comments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 800;
}

.comments-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.comments-counter {
  color: var(--text-muted);
}

.comment-textarea {
  width: 100%;
  min-height: 80px;
  max-height: 180px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  font-size: 13px;
  outline: none;
  resize: vertical;
  overflow-y: auto;
  margin-bottom: 12px;
  line-height: 1.5;
  box-sizing: border-box;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-textarea[contenteditable]:empty:before {
  content: attr(placeholder);
  color: var(--text-muted);
  pointer-events: none;
  opacity: 0.8;
}

.comment-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.comments-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

/* Facebook Style Comments */
.comments-list-wrapper {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 6px;
  margin-bottom: 16px;
}

.comments-list-wrapper::-webkit-scrollbar {
  width: 4px;
}

.comments-list-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.fb-comment {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.fb-comment-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}

.fb-comment-body-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.fb-comment-body {
  background: rgba(148, 163, 184, 0.1);
  padding: 8px 12px;
  border-radius: 16px;
  border-top-left-radius: 4px;
  display: inline-block;
  max-width: 95%;
  align-self: flex-start;
  word-wrap: break-word;
  box-sizing: border-box;
}

.fb-comment-author {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 2px;
}

.fb-comment-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.45;
}

.fb-comment-footer {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-left: 12px;
  margin-top: 2px;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.fb-comment-delete {
  color: var(--error);
  cursor: pointer;
  font-weight: 700;
  transition: color 0.2s;
}

.fb-comment-delete:hover {
  color: var(--error-hover, #ef4444);
  text-decoration: underline;
}

.delete-qcm-row {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

/* Bottom bar navigation (Mobile Player layout) */
.player-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
  justify-content: space-around;
  padding: 8px 0;
  z-index: 100;
  background: var(--bg-sidebar);
}

.bottom-bar-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 4px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  padding: 8px 0;
}

.bottom-bar-link i {
  font-size: 16px;
}

.bottom-bar-link.active {
  color: var(--primary);
}

.player-sidebar-mobile-header {
  display: none;
}

.player-sidebar-mobile-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}

.player-sidebar-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
}

/* ==========================================================================
   AI COURSE FILE MANAGER & CSV UPLOADER
   ========================================================================== */
.course-upload-panel {
  display: none;
  background: var(--bg-card);
  border: 1.5px dashed var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin: 8px 20px 16px 48px;
  animation: slideDown 0.2s ease-out;
}

.course-upload-panel.open {
  display: block;
}

.course-upload-panel h4 {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Upload Form */
.upload-form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.upload-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 140px;
}

.upload-field label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
}

.upload-field input[type="text"] {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  font-size: 12px;
  font-weight: 700;
  outline: none;
}

.upload-field input[type="text"]:focus {
  border-color: var(--primary);
}

/* File input override */
.file-select-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.file-select-label:hover {
  background: var(--item-bg-hover);
  color: var(--text-main);
}

/* Uploaded Files list */
.uploaded-files-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.uploaded-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 700;
  gap: 12px;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-grow: 1;
  min-width: 0;
}

.file-info i {
  color: var(--primary);
}

.file-name-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-rename-input {
  flex-grow: 1;
  padding: 4px 8px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--bg-input);
  font-size: 12px;
  font-weight: 700;
  outline: none;
}

.file-qcm-count {
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.file-actions-row {
  display: flex;
  gap: 4px;
}

.btn-file-action {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
}

.btn-file-action:hover {
  background: var(--item-bg-hover);
  color: var(--text-main);
}

.btn-file-action.btn-delete:hover {
  background: var(--error-light);
  color: var(--error);
}

/* ==========================================================================
   RESPONSIVE DESIGN RULES
   ========================================================================== */
@media (max-width: 768px) {
  /* Sidebar toggle details */
  .main-sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100vh;
    box-shadow: var(--shadow-lg);
  }
  
  .main-sidebar.open {
    left: 0;
  }

  .main-content {
    padding: 16px 16px 80px;
  }

  .content-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-tabs,
  #mainHeaderTabs {
    align-self: center;
    margin-left: auto;
    margin-right: auto;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .header-tabs::-webkit-scrollbar,
  #mainHeaderTabs::-webkit-scrollbar {
    display: none;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .filter-group.wide {
    grid-column: span 1;
  }

  .test-creation-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-inputs {
    flex-direction: column;
  }

  /* Test Player layout on mobile */
  .player-split-layout {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px 12px 96px !important;
  }

  .player-sidebar {
    display: grid;
    left: 0;
    top: 0;
    bottom: 72px;
    width: 100vw;
    max-width: none;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
    z-index: 120;
  }

  #testPlayerPanel.mobile-sidebar-open .player-sidebar {
    transform: translateX(0);
  }

  #testPlayerPanel.mobile-sidebar-open .player-workspace {
    display: flex !important;
  }

  #testPlayerPanel:not(.mobile-sidebar-open) .player-sidebar {
    pointer-events: none;
  }

  .player-bottom-bar {
    display: flex;
  }

  .player-sidebar-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
  }

  .player-workspace {
    width: 100%;
  }

  .player-header {
    flex-direction: column;
    align-items: stretch;
  }

  .player-header .header-search {
    max-width: none;
  }
}

/* ==========================================================================
   AI AND FLASHCARDS ACCORDION STYLING
   ========================================================================== */
.tree-course-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.tree-course-card:hover {
  border-color: var(--primary-light);
}

.course-row,
.course-row-ai {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px;
  padding: 6px 18px !important;
  background: var(--bg-card);
  font-weight: 700;
  transition: background 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.course-row-ai:hover {
  background: var(--item-bg-hover);
}

.course-expand-icon {
  color: var(--text-muted);
  width: 16px;
  transition: transform 0.2s ease;
}

.course-files-container {
  padding: 12px 18px;
  background: var(--bg-input);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-row:hover {
  border-color: var(--primary);
  background: var(--item-bg-hover);
}

.file-label {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.file-count-input {
  width: 60px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  font-size: 11px;
  text-align: center;
}

.file-actions {
  display: flex;
  gap: 6px;
}

.file-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.file-action-btn:hover {
  background: var(--item-bg-hover);
  color: var(--text-main);
}

.file-action-btn.delete-btn:hover {
  color: var(--error);
  background: var(--error-light);
}

.empty-files-text {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
  text-align: center;
}

/* Inline Upload Form */
.add-file-form {
  border-top: 1px dashed var(--border-color);
  padding-top: 12px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-file-inputs {
  display: flex;
  gap: 10px;
  align-items: center;
}

.add-file-name-input {
  flex-grow: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-main);
  outline: none;
  font-size: 12px;
}

.add-file-name-input:focus {
  border-color: var(--primary);
}

.btn-file-upload {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.btn-file-upload:hover {
  background: var(--item-bg-hover);
  color: var(--text-main);
}

.add-file-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.selected-file-name {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.btn-save-uploaded-file {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-save-uploaded-file:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-save-uploaded-file:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Flashcard player UI */
.flashcard-reveal-btn {
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  padding: 18px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px dashed var(--primary);
  width: 100%;
}

.flashcard-reveal-btn:hover {
  background: var(--primary);
  color: #fff;
}

.flashcard-answer-box {
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: 12px;
  padding: 16px;
  margin-top: 10px;
}

.flashcard-answer-box h4 {
  font-size: 14px;
  font-weight: 800;
  color: var(--success);
  margin-bottom: 6px;
}

.flashcard-answer-box p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-main);
}

.flashcard-eval-buttons {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  width: 100%;
}

.eval-btn {
  flex: 1;
  padding: 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  transition: all 0.2s ease;
}

.eval-btn.active {
  box-shadow: 0 0 0 3px var(--text-main);
  transform: scale(0.98);
}

/* ==========================================================================
   SPECIALTY TABS (Médecine / Dentaire / Pharmacie)
   ========================================================================== */
.specialty-tabs-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.specialty-tabs-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.specialty-tabs-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.specialty-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.specialty-tab-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(var(--primary-rgb, 99, 102, 241), 0.07);
  transform: translateY(-1px);
}

.specialty-tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark, #4f46e5));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.28);
}

.specialty-tab-btn[data-specialty="médecine"] i { color: inherit; }
.specialty-tab-btn[data-specialty="dentaire"] i { color: inherit; }
.specialty-tab-btn[data-specialty="pharma"] i { color: inherit; }

[data-theme="dark"] .specialty-tab-btn {
  background: rgba(255,255,255,0.04);
}
[data-theme="dark"] .specialty-tab-btn.active {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
}

/* ==========================================================================
   TEST PLAYER FIRST ROW
   ========================================================================== */
.player-first-row {
  display: none; /* Hidden by default */
  justify-content: space-between;
  align-items: center;
  height: 1.5cm;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Show only when test player is active */
#testPlayerPanel.active .player-first-row {
  display: flex;
}

.player-first-row .test-title-group,
.player-first-row .subject-info-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-first-row .test-icon {
  font-size: 20px;
  color: var(--primary);
}

.player-first-row .test-name-display {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 350px;
}

.player-first-row .subject-icon-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
}

.player-first-row .subject-name-display {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 350px;
}

/* ==========================================================================
   FLOATING AI PROMPTS WIDGET
   ========================================================================== */
.ai-prompts-widget-container {
  position: fixed;
  bottom: 80px;
  right: 30px;
  z-index: 1000;
  font-family: var(--font-main);
}

/* Floating Action Button (FAB) */
.ai-prompts-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark, #4f46e5));
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-prompts-fab:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}

.ai-prompts-fab i {
  transition: transform 0.3s ease;
}

.ai-prompts-fab:hover i {
  transform: scale(1.1);
}

/* Pulsing effect */
.fab-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0;
  pointer-events: none;
}

/* Floating Panel Card */
.ai-prompts-panel {
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 380px;
  max-height: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-prompts-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.ai-prompts-panel .panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-prompts-panel .panel-header h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-prompts-panel .panel-header h3 i {
  color: var(--primary);
}

.ai-prompts-panel .panel-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: color 0.2s;
  padding: 4px;
}

.ai-prompts-panel .panel-close-btn:hover {
  color: var(--danger);
}

.ai-prompts-panel .panel-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex-grow: 1;
}

.ai-prompts-panel .panel-intro-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 0;
  margin-bottom: 16px;
  line-height: 1.4;
}

.prompts-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Prompt Card Block */
.prompt-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s;
}

.prompt-card:hover {
  border-color: var(--primary-light);
}

.prompt-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.prompt-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-main);
}

.prompt-actions-toolbar {
  display: flex;
  gap: 6px;
}

.prompt-action-icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.prompt-action-icon-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.prompt-action-icon-btn.btn-save-prompt {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
}

.prompt-action-icon-btn.btn-save-prompt:hover {
  background: rgba(16, 185, 129, 0.08);
  border-color: var(--success);
}

.prompt-textarea {
  width: 100%;
  height: 100px;
  resize: vertical;
  font-family: inherit;
  font-size: 11.5px;
  line-height: 1.4;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
}

.prompt-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.prompt-textarea[readonly] {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  cursor: default;
  border-style: dashed;
}

[data-theme="dark"] .prompt-textarea[readonly] {
  background: rgba(0, 0, 0, 0.15);
}


/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-main);
  color: var(--text-inverse);
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  transition: bottom 0.3s ease;
  max-width: 90%;
  text-align: center;
}

.toast-notification.show {
  bottom: 30px;
}

.confirm-dialog {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 12000;
}

.confirm-dialog.open {
  display: flex;
}

.confirm-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
}

.confirm-dialog-panel {
  position: relative;
  width: min(440px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.confirm-dialog-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.confirm-dialog-icon.warning {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.confirm-dialog-icon.primary {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.confirm-dialog-copy h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.confirm-dialog-copy p {
  color: var(--text-muted);
  line-height: 1.6;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   PLAYER NEW ROWS STYLING
   ========================================================================== */

/* ==========================================================================
   UNIFIED HEADER (All rows in one white cell)
   ========================================================================== */

.player-unified-header {
  background: var(--bg-card);
  border: none;
  border-radius: 16px;
  padding: 8px 18px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: none;
  outline: none;
}

/* Row 1: Mode, Test Name, Module */
.unified-row-1 {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 4px;
}

.first-row-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.first-row-item.mode-selector {
  background: var(--primary-light);
  padding: 6px 14px;
  border-radius: 8px;
}

.mode-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.mode-value {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
}

.first-row-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
}

.first-row-icon {
  font-size: 16px;
  color: var(--primary);
}

.first-row-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.subject-icon-img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

/* Row 2: Active Tags */
.unified-row-2 {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2px 0;
  min-height: 0;
  background: transparent;
}

.active-tags-row {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  background: transparent;
  border: none;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  max-width: 100%;
}
.active-tags-row::-webkit-scrollbar {
  display: none;
}

.active-tag {
  background: transparent;
  border: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  max-width: 180px;
  min-width: 0;
  flex-shrink: 1;
  white-space: nowrap;
  height: 30px;
  box-sizing: border-box;
}
.active-tag .tag-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}
.active-tag i {
  flex-shrink: 0;
}

.active-tag.clickable-tag {
  cursor: pointer;
}

.active-tag.clickable-tag:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.active-tag i {
  color: var(--text-muted);
  font-size: 10px;
}

/* Row 3: Toolbar */
.unified-row-3 {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 4px;
}

.tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.tool-btn:hover {
  background: var(--item-bg-hover);
  color: var(--text-main);
}

.tool-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.tool-btn.next-btn {
  background: transparent;
  color: var(--primary);
  border: 1px solid transparent;
  width: 44px;
}

.tool-btn.next-btn:hover {
  background: var(--item-bg-hover);
  color: var(--primary-hover);
}

/* Translate Tool Dropdown */
#toolTranslateDropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 100;
}

#toolTranslate.tool-btn {
  width: auto !important;
  min-width: 36px;
  padding: 0 8px;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
}

#toolTranslate.tool-btn #translateBtnLabel {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.pns-translate-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50% !important;
  transform: translateX(-50%) !important;
  min-width: 130px !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 10px !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35) !important;
  padding: 5px !important;
  z-index: 1100 !important;
  display: none;
  flex-direction: column;
  gap: 2px;
}

#toolTranslateDropdown.open .pns-translate-dropdown-menu {
  display: flex !important;
  animation: pnsDropIn 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.translate-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-main) !important;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
  font-family: inherit;
}

.translate-option:hover {
  background: var(--item-bg-hover, rgba(6, 182, 212, 0.1));
  color: var(--primary, #06b6d4);
}

.translate-option.active {
  background: var(--primary-light, rgba(6, 182, 212, 0.15)) !important;
  color: var(--primary, #06b6d4) !important;
  font-weight: 800;
}

.translate-option .lang-code {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary, #06b6d4);
  min-width: 22px;
}

.translate-option .lang-name {
  font-size: 11.5px;
  font-weight: 600;
}

.question-lang-indicator {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--item-bg-hover, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.25));
  padding: 6px 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}


.option-item.ar,
.option-item.ar .option-text {
  direction: rtl !important;
  text-align: right !important;
}

/* Stats Section Styles */

.stats-section {
  flex: 1;
  min-width: 200px;
}

.stats-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.stats-counter-group {
  display: flex;
  gap: 16px;
}

.stat-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

.stat-counter .count-val {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
}

.stat-counter .count-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-counter.correct .count-val {
  color: var(--success);
}

.stat-counter.incorrect .count-val {
  color: var(--error);
}

.stat-counter.score .count-val {
  color: var(--primary);
}

.stat-counter.qcm-time .count-val,
.stat-counter.qcm-status .count-val {
  color: var(--info);
}

.stat-counter.qcm-attempts-trigger {
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}

.stat-counter.qcm-attempts-trigger:hover {
  background: var(--item-bg-hover);
}

.stat-counter.qcm-attempts-trigger .count-val {
  color: var(--warning);
}

.stat-counter.qcm-attempts-trigger .count-label i {
  font-size: 8px;
  margin-left: 4px;
}

.stats-divider {
  width: 1px;
  background: var(--border-color);
  align-self: stretch;
}

.attempts-dropdown {
  position: absolute;
  top: 100%;
  right: 20px;
  margin-top: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 250px;
  z-index: 100;
  background: var(--bg-card-solid, rgba(17, 26, 54, 0.98));
}

.dropdown-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.attempts-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
}

.attempts-list li {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.attempts-list li:hover {
  background: var(--item-bg-hover);
}

/* Fourth Row - Toolbar (already exists but ensure it's correct) */
.player-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 12px;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

/* Player Split Layout - Main Sidebar (Left) | Workspace (Middle) | Questions Sidebar (Right) */
.player-split-layout {
  display: block;
  margin-left: 0;
  margin-right: 280px;
  padding: 24px 24px 32px;
  min-height: 100vh;
}

/* Player Navigation Sidebar - Full Height Fixed on Right */
.player-sidebar {
  position: fixed;
  right: 0;
  left: auto;
  top: 0;
  bottom: 0;
  width: 280px;
  height: auto;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  border-radius: 0;
  padding: 16px;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  z-index: 40;
  overflow: hidden;
}

.questions-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  min-height: 0;
  align-self: stretch;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow-y: auto;
  padding: 8px;
  contain: none;
  overscroll-behavior: contain;
}

/* Search bar in sidebar */
.player-sidebar .search-bar-wrapper {
  margin-bottom: 16px;
  flex-shrink: 0;
}

.player-workspace {
  width: 100%;
  min-width: 0;
}

body.sidebar-collapsed .player-split-layout {
  margin-left: 80px;
}

body.sidebar-collapsed .player-sidebar {
  left: 80px;
}

/* ==========================================================================
   SIDEBAR COMPACT ROWS (Above Questions List)
   ========================================================================== */

.sidebar-compact-row {
  background: rgba(148, 163, 184, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}

/* Row 1: Timers */
.sidebar-timers-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.btn-icon-small {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon-small:hover {
  background: var(--primary-hover);
}

.sidebar-timers-row .timer-display {
  flex: 1;
  padding: 6px 8px;
  font-size: 11px;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.sidebar-timers-row .timer-display i {
  font-size: 10px;
  color: var(--primary);
}

.sidebar-timers-row .timer-display.question-timer i {
  color: var(--warning);
}

/* Row 2 & 3: Stats */
.sidebar-stats-row,
.sidebar-qcm-row {
  position: relative;
}

.compact-stats-title {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  margin-bottom: 8px;
}

.compact-stats-subtitle {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-main);
}

.compact-stats-subtitle span:first-child {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-main);
}

.compact-stats-subtitle .session-separator {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

.compact-stats-subtitle span:last-child {
  font-size: 10px;
  color: var(--primary);
  font-weight: 700;
}

.compact-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.compact-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  border-radius: 8px;
  background: var(--bg-input);
  transition: all 0.2s;
}

.compact-stat.clickable {
  cursor: pointer;
}

.compact-stat.clickable:hover {
  background: var(--item-bg-hover);
}

.compact-val {
  font-size: 16px;
  font-weight: 800;
  font-family: var(--font-heading);
  line-height: 1;
}

.compact-lbl {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2px;
}

.compact-stat.correct .compact-val {
  color: var(--success);
}

.compact-stat.incorrect .compact-val {
  color: var(--error);
}

.compact-stat.score .compact-val {
  color: var(--primary);
}

.compact-lbl i {
  font-size: 8px;
  margin-left: 2px;
}

/* Attempts dropdown */
.sidebar-qcm-row .attempts-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  background: var(--bg-card-solid, rgba(17, 26, 54, 0.98));
}

.attempts-dropdown .dropdown-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.attempts-list {
  list-style: none;
  max-height: 150px;
  overflow-y: auto;
}

.attempts-list li {
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-input);
}

.attempts-list li:hover {
  background: var(--item-bg-hover);
  transition: all 0.2s;
}

.compact-stat.clickable {
  cursor: pointer;
}

.compact-stat.clickable:hover {
  background: var(--item-bg-hover);
  transform: translateY(-1px);
}

.compact-stat .compact-val {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

.compact-stat.correct .compact-val {
  color: var(--success);
}

.compact-stat.incorrect .compact-val {
  color: var(--error);
}

.compact-stat.score .compact-val {
  color: var(--primary);
}

.compact-stat .compact-lbl {
  font-size: 8px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2px;
}

.compact-stat .compact-lbl i {
  font-size: 6px;
  margin-left: 2px;
}

.sidebar-qcm-row .attempts-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  z-index: 100;
  min-width: auto;
}

/* Update First Row - Remove timers section */
.player-first-row .timer-group {
  display: none;
}

/* Hide Second Row completely as stats moved to sidebar */
.player-second-row {
  display: none;
}


/* Add btn-icon-small for sidebar */
.btn-icon-small {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  transition: all 0.2s;
}

.btn-icon-small:hover {
  background: var(--item-bg-hover);
  color: var(--text-main);
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
}

.timer-display.global-timer i {
  color: var(--primary);
}

.timer-display.question-timer i {
  color: var(--warning);
}

/* ==========================================================================
   STUDY/NOTES/MINDMAP/AI MODE STYLES
   ========================================================================== */

/* Active mode body rules: sidebars become off-canvas drawers.
   In mode the sidebar opens in ONE case only — via the bottom bar sidebar
   icon (mobile-open class) — and works on both screens. */
body.mode-active-body #mainSidebar,
body.mode-active-body .main-sidebar,
body.mode-active-body #sidebar,
body.mode-active-body .sidebar,
body.mode-active-body #playerSidebar,
body.mode-active-body .player-sidebar {
  display: flex !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  bottom: auto !important;
  height: 100vh !important;
  height: 100dvh !important;
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  transform: translateX(-100%) !important;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  z-index: 4200 !important;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.5) !important;
}

body.mode-active-body #mainSidebar.mobile-open,
body.mode-active-body .main-sidebar.mobile-open,
body.mode-active-body #sidebar.mobile-open,
body.mode-active-body .sidebar.mobile-open,
body.mode-active-body #playerSidebar.mobile-open,
body.mode-active-body .player-sidebar.mobile-open,
body.mode-active-body #mainSidebar.open,
body.mode-active-body .main-sidebar.open,
body.mode-active-body #sidebar.open,
body.mode-active-body .sidebar.open,
body.mode-active-body #playerSidebar.open,
body.mode-active-body .player-sidebar.open {
  transform: translateX(0) !important;
}

body.mode-active-body .pns-sidebar-mobile-backdrop {
  display: none !important;
}

body.mode-active-body .pns-sidebar-mobile-backdrop.open,
body.mode-active-body .pns-sidebar-mobile-backdrop.active {
  display: block !important;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.6) !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  z-index: 4100 !important;
}

/* Master split container: flush to screen edges, zero padding, zero gap */
body.mode-active-body .player-split-layout {
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  gap: 0 !important;
  height: 100vh !important;
  height: 100dvh !important;
  width: 100vw !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: var(--bg-app) !important;
  align-items: stretch !important;
  z-index: 2500 !important;
}

/* QCM side (Left Pane): fixed strictly at 40% width */
body.mode-active-body .player-workspace {
  flex: 0 0 40% !important;
  width: 40% !important;
  max-width: 40% !important;
  min-width: 40% !important;
  height: 100vh !important;
  height: 100dvh !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 0 1cm 0 !important; /* reserve bottom 1cm for the pinned bottom bar */
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
  border-right: 1mm solid #000000 !important;
}

/* Divider line in night / dark mode: 1mm solid #ffffff */
[data-theme="dark"] body.mode-active-body .player-workspace,
html[data-theme="dark"] body.mode-active-body .player-workspace,
body.dark.mode-active-body .player-workspace,
body.theme-dark.mode-active-body .player-workspace {
  border-right: 1mm solid #ffffff !important;
}

/* Scrollable content area inside player-workspace */
body.mode-active-body .player-workspace-scroll-area {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  flex: 1 !important;
  min-height: 0 !important;
  padding: 10px 10px 16px 10px !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

body.mode-active-body .player-workspace-scroll-area::-webkit-scrollbar {
  width: 6px;
}

/* Side Mode Panel (Right Pane): fixed strictly at 60% width.
   Strictly hidden when mode is OFF (the !important display below beats the
   stale inline style so no 700px dead void remains under the QCM). */
body:not(.mode-active-body) .player-mode-panel {
  display: none !important;
}

body.mode-active-body .player-mode-panel {
  display: flex !important;
  flex: 0 0 60% !important;
  width: 60% !important;
  max-width: 60% !important;
  min-width: 60% !important;
  height: 100vh !important;
  height: 100dvh !important;
  background: var(--bg-card);
  border: none !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  flex-direction: column !important;
  box-shadow: none !important;
  position: relative !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* Red frame elements completely removed: Header with title & close button */
.mode-panel-header,
.player-mode-panel .mode-panel-header,
body.mode-active-body .player-mode-panel .mode-panel-header {
  display: none !important;
}

.mode-panel-body,
body.mode-active-body .player-mode-panel .mode-panel-body {
  flex: 1 !important;
  min-height: 0 !important;
  height: 100% !important;
  width: 100% !important;
  position: relative !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  box-sizing: border-box !important;
}

#modeIframe,
body.mode-active-body .player-mode-panel #modeIframe {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
}

/* Bottom bar in split mode on desktop: pinned under the 40% QCM screen */
body.mode-active-body .pns-mobile-bottom-bar {
  display: flex !important;
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 40% !important;
  max-width: 40% !important;
  right: auto !important;
  height: 1cm !important;
  min-height: 1cm !important;
  max-height: 1cm !important;
  z-index: 2600 !important;
  overflow: visible !important;
  justify-content: center !important;
  scrollbar-width: none !important;
  box-sizing: border-box !important;
  padding: 0 8px !important;
  gap: 4px !important;
  border-right: 1mm solid #000000 !important;
}

[data-theme="dark"] body.mode-active-body .pns-mobile-bottom-bar,
html[data-theme="dark"] body.mode-active-body .pns-mobile-bottom-bar,
body.dark.mode-active-body .pns-mobile-bottom-bar,
body.theme-dark.mode-active-body .pns-mobile-bottom-bar {
  border-right: 1mm solid #ffffff !important;
}

body.mode-active-body .pns-mobile-bottom-bar::-webkit-scrollbar {
  display: none !important;
}

/* Return to QCM button wrap in mobile bottom bar */
#mobileCloseModeBtnWrap {
  display: none;
}

body.mode-active-body #mobileCloseModeBtnWrap {
  display: flex !important;
}

/* Split resizer permanently disabled */
body.mode-active-body .split-resizer,
.split-resizer {
  display: none !important;
}

/* Mobile (Portrait and Landscape): Mode panel is 100% Fullscreen, QCM hidden */
@media (max-width: 900px), (max-height: 550px) and (orientation: landscape) {
  body.mode-active-body .player-split-layout {
    padding: 0 !important;
    margin: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    width: 100vw !important;
    flex-direction: column !important;
  }
  
  body.mode-active-body .player-workspace {
    display: none !important;
  }
  
  body.mode-active-body .pns-mobile-bottom-bar {
    display: none !important;
  }

  body.mode-active-body .player-mode-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    min-width: 100vw !important;
    z-index: 3000 !important;
    border-radius: 0 !important;
    border: none !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--bg-app) !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.mode-active-body .player-mode-panel .mode-panel-header {
    display: none !important;
  }

  body.mode-active-body .player-mode-panel .mode-panel-body {
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    height: 100% !important;
    width: 100% !important;
  }

  body.mode-active-body .player-mode-panel #modeIframe {
    border-radius: 0 !important;
    height: 100% !important;
    width: 100% !important;
  }
}

body.dragging-active iframe {
  pointer-events: none !important;
}

body.dragging-active {
  cursor: col-resize !important;
  user-select: none !important;
}


/* ================================================ */
/* SHARED STYLES FOR TODO, REPETITION, CORBEILLE */
/* ================================================ */

/* Common Grid Layout */
.qcms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
  width: 100%;
}

/* QCM Card Styles - Elevated Prominence */
.qcm-card,
.queue-card,
.compact-card {
  background: var(--bg-card-solid, #131a2b) !important;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.32) !important;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.14)) !important;
  position: relative;
}

html[data-theme="light"] .qcm-card,
html[data-theme="light"] .queue-card,
html[data-theme="light"] .compact-card {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.09) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07) !important;
}

.qcm-card:hover,
.queue-card:hover,
.compact-card:hover,
.qcm-card:active,
.queue-card:active,
.compact-card:active {
  transform: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="light"] .qcm-card:hover,
html[data-theme="light"] .queue-card:hover,
html[data-theme="light"] .compact-card:hover,
html[data-theme="light"] .qcm-card:active,
html[data-theme="light"] .queue-card:active,
html[data-theme="light"] .compact-card:active {
  transform: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

.qcm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.qcm-question {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
}

.queue-card-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.queue-card-subline {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.queue-side-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 96px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.queue-side-meta span {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--bg-light);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qcm-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.qcm-action-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 14px;
}

.qcm-action-btn:hover {
  background: var(--bg-light);
  color: var(--primary);
}

.qcm-action-btn.delete:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.qcm-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.qcm-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.qcm-meta-row i {
  width: 16px;
  text-align: center;
  color: var(--primary);
}

.queue-stats-line {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-light);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.queue-stats-line span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.qcm-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.qcm-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.test-now-btn, .restore-btn {
  padding: 10px 20px;
  background: var(--primary);
  color: #ffffff !important;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.test-now-btn:hover {
  background: var(--primary-hover, #1d4ed8) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.test-now-btn:active,
.test-now-btn:focus {
  background: var(--primary-hover, #1d4ed8) !important;
  color: #ffffff !important;
}

.restore-btn {
  background: var(--warning);
  color: #ffffff !important;
}

.restore-btn:hover {
  background: #d97706 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

/* Explicit styling for Revoir le test buttons */
.btn-resume {
  background: var(--primary) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
}

.btn-resume:hover,
.btn-resume:focus,
.btn-resume:active {
  background: var(--primary-hover, #1d4ed8) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4) !important;
  transform: translateY(-1px);
}

.btn-resume i,
.btn-resume span {
  color: #ffffff !important;
}

/* Empty State */
.qcms-grid .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  grid-column: 1 / -1;
}

.qcms-grid .empty-state i {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.3;
}

.qcms-grid .empty-state h3 {
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.qcms-grid .empty-state p {
  font-size: 14px;
}

/* Stats Row for Répétition */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card-solid, #141d32) !important;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.14)) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

html[data-theme="light"] .stat-card {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.09) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06) !important;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4) !important;
  border-color: var(--primary) !important;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Level Badges for Répétition */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.level-badge.level-1 {
  background: #fee2e2;
  color: #991b1b;
}

.level-badge.level-2 {
  background: #fed7aa;
  color: #9a3412;
}

.level-badge.level-3 {
  background: #fef3c7;
  color: #854d0e;
}

.level-badge.level-4 {
  background: #d1fae5;
  color: #065f46;
}

.level-badge.mastered {
  background: #dbeafe;
  color: #1e40af;
}

[data-theme="dark"] .level-badge.level-1 {
  background: #7f1d1d;
  color: #fecaca;
}

[data-theme="dark"] .level-badge.level-2 {
  background: #7c2d12;
  color: #fed7aa;
}

[data-theme="dark"] .level-badge.level-3 {
  background: #713f12;
  color: #fef3c7;
}

[data-theme="dark"] .level-badge.level-4 {
  background: #064e3b;
  color: #d1fae5;
}

[data-theme="dark"] .level-badge.mastered {
  background: #1e3a8a;
  color: #dbeafe;
}

/* Review Info for Répétition */
.review-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--bg-light);
  border-radius: 8px;
  margin-top: 12px;
}

.review-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.review-info-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.review-info-value {
  color: var(--text-primary);
  font-weight: 600;
}

.review-info-value.due {
  color: var(--danger);
}

.review-info-value.soon {
  color: var(--warning);
}

.review-info-value.later {
  color: var(--success);
}

/* Progress Bar for Répétition */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 12px;
}

.progress-fill {
  height: 100%;
  background: var(--success);
  transition: width 0.3s;
  border-radius: 3px;
}

/* Deleted Badge for Corbeille */
.deleted-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

[data-theme="dark"] .deleted-badge {
  background: #7f1d1d;
  color: #fecaca;
}

.qcm-card.deleted {
  border-color: var(--danger);
  opacity: 0.9;
}

.qcm-action-btn.permanent-delete {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.qcm-action-btn.permanent-delete:hover {
  background: #dc2626;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .qcms-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .stats-row {
    grid-template-columns: 1fr;
  }
  
  .stat-card {
    padding: 16px;
  }
  
  .stat-icon {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
  
  .stat-value {
    font-size: 24px;
  }
}


/* Modern Checkbox Styles */
.qcm-checkbox-wrapper {
  display: flex;
  align-items: center;
  margin-right: 12px;
  flex-shrink: 0;
}

.qcm-checkbox {
  display: none;
}

.qcm-checkbox-label {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  background: var(--card-bg);
}

.qcm-checkbox-label:hover {
  border-color: var(--primary);
}

.qcm-checkbox:checked + .qcm-checkbox-label {
  background: var(--primary);
  border-color: var(--primary);
}

.qcm-checkbox:checked + .qcm-checkbox-label::after {
  content: '\2714';
  color: white;
  font-size: 12px;
  font-weight: bold;
}

/* Selection Actions Bar */
.selection-actions-bar {
  background: var(--card-bg);
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.selection-info {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
}

.selection-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.selection-buttons .btn {
  padding: 10px 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.queue-filter-select,
.queue-date-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-input);
  color: var(--text-main);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
}

.queue-date-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.attempt-empty,
.attempt-item {
  list-style: none;
}

.attempt-empty {
  color: var(--text-muted);
  font-size: 12px;
}

.attempt-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.attempt-status {
  font-weight: 700;
}

.attempt-item.correct .attempt-status {
  color: var(--success);
}

.attempt-item.error .attempt-status {
  color: var(--error);
}

.attempt-meta {
  color: var(--text-muted);
  font-size: 11px;
}

@media (max-width: 768px) {
  .selection-actions-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .selection-buttons {
    flex-direction: column;
  }
  
  .selection-buttons .btn {
    justify-content: center;
  }

  .confirm-dialog-panel {
    padding: 20px;
    border-radius: 20px;
  }

  .queue-date-range {
    grid-template-columns: 1fr;
  }

  .qcm-header {
    flex-wrap: wrap;
  }

  .queue-side-meta {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* ==========================================================================
   COMPACT CARDS (Todo, Repetition, Corbeille)
   ========================================================================== */
.compact-card {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.compact-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}

.compact-check {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compact-check .qcm-checkbox {
  display: block !important;
  width: 16px;
  height: 16px;
  cursor: pointer;
  margin: 0;
  accent-color: var(--primary);
}

.compact-check .qcm-checkbox-label {
  display: none !important;
}

.compact-badge {
  margin-bottom: 0 !important;
  font-size: 10px !important;
  padding: 4px 8px !important;
  flex: 1;
  text-align: center;
  white-space: nowrap;
}

.compact-btn {
  width: 24px;
  height: 24px;
  font-size: 12px;
  flex-shrink: 0;
}

.compact-question {
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.c-tag {
  font-size: 9px;
  padding: 2px 6px;
  background: var(--bg-input);
  border-radius: 4px;
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
}

.c-tag.year {
  background: var(--primary-light);
  color: var(--primary);
}

.c-tag.rotation {
  background: var(--warning-light);
  color: var(--warning);
}

.compact-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--bg-light);
  padding: 6px;
  border-radius: 6px;
  margin-bottom: 4px;
}

.c-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
}

.c-stat span {
  color: var(--text-muted);
}

.c-stat strong {
  color: var(--text-main);
  font-family: var(--font-heading);
}

.compact-progress {
  height: 4px;
  margin-top: 0;
  margin-bottom: 4px;
}

.compact-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--border-light);
  margin-top: 4px;
}

.compact-footer .qcm-date {
  font-size: 10px;
}

.compact-test-btn {
  padding: 6px 10px;
  font-size: 11px;
}

/* ==========================================================================
   MODERN COMPACT DROPDOWN FILTERS
   ========================================================================== */
.modern-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 24px;
}

.custom-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 99px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  transform: none !important;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.dropdown-toggle:hover,
.dropdown-toggle:active,
.dropdown-toggle:focus,
.custom-dropdown.open .dropdown-toggle {
  background: var(--bg-light);
  border-color: var(--primary);
  transform: none !important;
}

.modern-filters-bar .dropdown-toggle,
.modern-filters-bar .dropdown-toggle:hover,
.modern-filters-bar .dropdown-toggle:active,
.modern-filters-bar .dropdown-toggle:focus,
.modern-filters-bar .custom-dropdown,
.modern-filters-bar .custom-dropdown.open .dropdown-toggle {
  transform: none !important;
}

.dropdown-toggle span {
  color: var(--primary);
  font-weight: 800;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-toggle i {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.custom-dropdown.open .dropdown-toggle i {
  transform: rotate(180deg);
}

.custom-dropdown.open .dropdown-toggle {
  border-color: var(--primary);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--bg-card-solid, rgba(17, 26, 54, 0.98));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.06);
  z-index: 10000;
  padding: 6px;
  flex-direction: column;
  gap: 3px;
}

[data-theme="dark"] .dropdown-menu {
  background: #141c2e !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.55) !important;
}

.custom-dropdown.right-align .dropdown-menu {
  left: auto;
  right: 0;
}

.custom-dropdown.open .dropdown-menu {
  display: flex;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: var(--primary-light, rgba(37, 99, 235, 0.12));
  color: var(--primary);
}

.dropdown-item input[type="radio"] {
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

/* Per-language offline pack download (first time only) */
.lang-option .lang-name {
  min-width: 26px;
}

.lang-dl-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: all 0.15s ease;
}

.lang-dl-btn:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.lang-dl-btn:disabled {
  cursor: wait;
  opacity: 0.8;
}

.lang-dl-btn.done {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.45);
  color: #059669;
}

.lang-dl-state {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}

.lang-option.lang-locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.lang-option.lang-locked input[type="radio"] {
  cursor: not-allowed;
}

.dropdown-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  margin: 0;
  flex-shrink: 0;
  background: var(--bg-input);
}

.dropdown-item input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.dropdown-item input[type="checkbox"]:checked::after {
  content: '\2714';
  position: absolute;
  color: white;
  font-size: 9px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* QCM Loading Modal specific styling */
#qcmLoadingModal .pdf-progress-bar {
  background: linear-gradient(90deg, var(--primary), var(--info)) !important;
}
#qcmLoadingModal .pdf-modal-header i {
  color: var(--primary) !important;
}

/* Exam Details Modal custom styling */
.exam-details-card {
  text-align: left !important;
  background: var(--bg-card) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-lg) !important;
}

[data-theme="dark"] .exam-details-card {
  background: rgba(30, 41, 59, 0.98) !important;
}

/* Styling Saved Exam Filters to look exactly like Spaced Repetition Filters */
#savedExamsPanel .advanced-filters-row {
  display: flex;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  gap: 8px;
  margin-bottom: 20px;
  margin-top: 10px;
}

#savedExamsPanel .select-wrapper {
  display: inline-flex;
  align-items: center;
  min-width: unset;
  gap: 0;
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 99px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s;
}

#savedExamsPanel .select-wrapper:hover {
  background: var(--bg-light);
  border-color: var(--primary);
}

#savedExamsPanel .select-wrapper label {
  margin-right: 4px;
  color: var(--text-main);
  font-weight: 700;
  pointer-events: none;
}

#savedExamsPanel .select-wrapper select {
  border: none;
  background: transparent;
  color: var(--primary);
  font-weight: 800;
  font-size: 11px;
  padding: 0;
  padding-right: 14px;
  margin: 0;
  outline: none;
  cursor: pointer;
  min-width: unset;
  width: auto;
  max-width: 180px;
  text-overflow: ellipsis;
  /* Reset default styles */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* Custom chevron arrow for select in select-wrapper */
#savedExamsPanel .select-wrapper::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 9px;
  color: var(--text-muted);
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Swapped sidebar layout in Player View (Menu sidebar on far left, Workspace in middle, Green sidebar on far right) */
@media (min-width: 769px) {
  #testPlayerPanel.active .player-split-layout,
  body.player-active .player-split-layout {
    margin-left: 0 !important;
    margin-right: 280px;
  }

  body.mode-active-body .player-split-layout {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  #testPlayerPanel.active .player-sidebar,
  body.player-active .player-sidebar {
    left: auto !important;
    right: 0 !important;
    border-left: 1px solid var(--border-color);
    border-right: none;
  }
}

/* ========================================================== */
/* Modern Flashcards AI Styling */
/* ========================================================== */
.flashcard-workspace-container {
  width: 100%;
  margin-top: 10px;
}

.flashcard-eval-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 14px 0;
  width: auto;
}

.btn-flashcard-eval {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  border: 1.5px solid transparent;
  outline: none;
  font-family: inherit;
  transform: none !important;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* "Je savais" - Green Tone */
.btn-flashcard-know {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.3);
}

.btn-flashcard-know:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
  transform: none !important;
  box-shadow: none;
}

.btn-flashcard-know:active,
.btn-flashcard-know.active {
  background: #10b981;
  color: #ffffff;
  border-color: #059669;
  box-shadow: none;
  transform: none !important;
}

/* "Je ne savais pas" - Red/Coral Tone */
.btn-flashcard-dontknow {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-flashcard-dontknow:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: #ef4444;
  transform: none !important;
  box-shadow: none;
}

.btn-flashcard-dontknow:active,
.btn-flashcard-dontknow.active {
  background: #ef4444;
  color: #ffffff;
  border-color: #b91c1c;
  box-shadow: none;
  transform: none !important;
}

/* Divider permanently hidden */
.flashcard-divider {
  display: none !important;
}

/* Modern Answer Display Box */
.flashcard-answer-wrapper {
  background: var(--bg-card-solid, #f1f5f9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  margin-top: 10px;
  animation: flashcardSlideFade 0.25s ease-out;
}

[data-theme="dark"] .flashcard-answer-wrapper {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(71, 85, 105, 0.5);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

@keyframes flashcardSlideFade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flashcard-answer-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.flashcard-answer-content {
  font-size: 15px;
  line-height: 1.6;
  font-weight: 600;
  color: var(--text-main);
}

/* Module Courses Count Badge */
.module-courses-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
  border: 1px solid rgba(37, 99, 235, 0.15);
}

[data-theme="dark"] .module-courses-count {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.25);
}

/* Modern Flashcard Tone Styles - Know (Green) and Don't Know (Red) applied to Question / Consigne */
.question-text-header.flashcard-tone-know {
  background: rgba(16, 185, 129, 0.08) !important;
  border: 1.5px solid rgba(16, 185, 129, 0.5) !important;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.12) !important;
  transition: all 0.25s ease;
}

[data-theme="dark"] .question-text-header.flashcard-tone-know {
  background: rgba(6, 78, 59, 0.28) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.18) !important;
}

.question-text-header.flashcard-tone-dontknow {
  background: rgba(239, 68, 68, 0.08) !important;
  border: 1.5px solid rgba(239, 68, 68, 0.5) !important;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.12) !important;
  transition: all 0.25s ease;
}

[data-theme="dark"] .question-text-header.flashcard-tone-dontknow {
  background: rgba(127, 29, 29, 0.28) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.18) !important;
}

/* ==========================================================================
   MODE EXAMEN & RÉSIDANAT STYLING
   ========================================================================== */

/* Header Center Tabs */
.exam-modes-tabs {
  display: flex;
  align-items: center;
  background: var(--border-color);
  padding: 4px;
  border-radius: 99px;
  gap: 4px;
  width: fit-content;
  margin: 0 18px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.exam-modes-tabs .tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

.exam-modes-tabs .tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .exam-modes-tabs .tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.exam-modes-tabs .tab-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Mode Custom Header */
.mode-custom-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  margin-bottom: 20px;
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  flex-wrap: wrap;
  gap: 16px;
}

.mode-header-badge {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mode-header-badge i {
  font-size: 26px;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
}

.residanat-top-header .mode-header-badge i {
  color: #059669;
  background: rgba(16, 185, 129, 0.1);
}

.mode-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
}

.mode-subtitle {
  margin: 2px 0 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* Source Switcher Toggle */
.exam-source-toggle-group {
  display: flex;
  background: var(--bg-card);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  gap: 4px;
}

.source-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.source-toggle-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* Mode Examen Setup Card - Compact, Professional & Modern */
/* Mode Examen Setup Card - Professional, Compact & High Density */
.mode-setup-card {
  background: var(--bg-card-solid, #131a2b);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

html[data-theme="light"] .mode-setup-card {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.09) !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05) !important;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1.65fr) minmax(0, 0.8fr) minmax(0, 0.8fr);
  gap: 12px;
  margin-bottom: 14px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1024px) {
  .setup-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .setup-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.setup-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.setup-field label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
  line-height: 1.25;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  flex-wrap: wrap; /* Prevents long labels/badges from forcing container overflow */
}

.setup-lbl-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.setup-lbl-title i {
  color: var(--primary);
  font-size: 12px;
  flex-shrink: 0;
}

.setup-select,
.setup-input,
.setup-select-trigger {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 35px;
  padding: 0 10px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input, var(--bg-card));
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-sizing: border-box;
  font-family: inherit;
  transform: none !important;
}

.setup-field input[type="number"] {
  text-align: center;
  font-weight: 700;
  color: var(--primary);
}

.setup-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.setup-select-trigger:hover {
  border-color: var(--primary);
  transform: none !important;
}

.setup-custom-dropdown {
  position: relative;
  width: 100%;
}

.setup-custom-dropdown.open {
  z-index: 1000;
}

.setup-custom-dropdown.open .setup-select-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
  transform: none !important;
}

.setup-select-trigger .trigger-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  flex: 1;
  font-size: 12px;
  font-weight: 600;
}

.setup-select-trigger .trigger-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: 4px;
  flex-shrink: 0;
}

.setup-custom-dropdown.open .trigger-arrow {
  transform: rotate(180deg);
  color: var(--primary);
}

.setup-select-trigger.disabled,
.setup-select-trigger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: rgba(148, 163, 184, 0.08);
  border-color: var(--border-color);
}

/* =========================================================================
   COMPACT DROPDOWN MENU (MATCHING SITE FILTER STYLE)
   ========================================================================= */
.setup-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  width: 100%;
  min-width: 100%;
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-card-solid, rgba(17, 26, 54, 0.98));
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.04);
  z-index: 1050;
  padding: 5px;
  flex-direction: column;
  gap: 2px;
  box-sizing: border-box;
}

html[data-theme="dark"] .setup-dropdown-menu {
  background: #141c2e !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55) !important;
}

.setup-custom-dropdown.open .setup-dropdown-menu {
  display: flex;
}

.setup-dropdown-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  transition: background 0.12s ease, color 0.12s ease;
  user-select: none;
  white-space: nowrap;
  transform: none !important;
  box-sizing: border-box;
  width: 100%;
}

.setup-dropdown-menu .dropdown-item:hover {
  background: var(--primary-light, rgba(37, 99, 235, 0.08));
  color: var(--primary);
  transform: none !important;
}

.setup-dropdown-menu .dropdown-item.active {
  background: var(--primary-light, rgba(37, 99, 235, 0.12)) !important;
  color: var(--primary) !important;
  font-weight: 700;
  transform: none !important;
}

.setup-dropdown-menu .dropdown-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
  margin: 0;
  flex-shrink: 0;
  background: var(--bg-input, #ffffff);
}

.setup-dropdown-menu .dropdown-item input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.setup-dropdown-menu .dropdown-item input[type="checkbox"]:checked::after {
  content: '\2714';
  position: absolute;
  color: white;
  font-size: 9px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

html[data-theme="dark"] .setup-dropdown-menu .dropdown-item input[type="checkbox"] {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}

html[data-theme="dark"] .setup-dropdown-menu .dropdown-item input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.setup-dropdown-menu .dropdown-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.setup-dropdown-menu::-webkit-scrollbar {
  width: 5px;
}

.setup-dropdown-menu::-webkit-scrollbar-track {
  background: transparent;
}

.setup-dropdown-menu::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.35);
  border-radius: 99px;
}

.setup-select:focus,
.setup-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  transform: none !important;
}

.setup-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: rgba(148, 163, 184, 0.08);
}

.available-badge {
  font-size: 10px;
  font-weight: 750;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.18);
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
}

.available-badge.countdown-badge {
  background: rgba(16, 185, 129, 0.08) !important;
  color: #059669 !important;
  border: 1px solid rgba(16, 185, 129, 0.2) !important;
}

/* Toggles Row - Compact Horizontal Layout */
.setup-toggles-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px dashed var(--border-color);
  border-bottom: 1px dashed var(--border-color);
  margin-bottom: 14px;
}

@media (max-width: 768px) {
  .setup-toggles-row {
    grid-template-columns: 1fr;
  }
}

.toggle-group-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toggle-group-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.toggle-group-title i {
  color: var(--primary);
}

.pill-radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

@media (max-width: 480px) {
  .pill-radio-group {
    grid-template-columns: 1fr;
  }
}

.pill-radio-option {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px 8px;
  height: 34px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  background: var(--bg-card);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  box-sizing: border-box;
  transform: none !important;
}

.pill-radio-option input {
  display: none;
}

.pill-radio-option span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-radio-option span i {
  font-size: 12px;
  flex-shrink: 0;
}

.pill-radio-option:hover {
  border-color: var(--primary-light, #93c5fd);
  background: rgba(37, 99, 235, 0.04);
  transform: none !important;
}

.pill-radio-option:active {
  transform: none !important;
}

.pill-radio-option.active {
  border-color: var(--primary) !important;
  background: rgba(37, 99, 235, 0.09) !important;
  box-shadow: 0 0 0 1px var(--primary);
  transform: none !important;
}

.pill-radio-option.active span {
  color: var(--primary);
  font-weight: 750;
}

/* Launch Footer */
.mode-launch-footer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 2px;
}

.exam-name-field {
  flex: 1;
  min-width: 200px;
}

.exam-name-field label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.exam-name-field .setup-input {
  height: 36px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-mode-launch,
.btn-residanat-launch {
  height: 36px;
  padding: 0 20px;
  font-size: 12.5px;
  font-weight: 750;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(37, 99, 235, 0.28);
  transition: filter 0.15s ease, box-shadow 0.15s ease;
  transform: none !important;
}

.btn-mode-launch:hover,
.btn-mode-launch:active,
.btn-mode-launch:focus {
  transform: none !important;
  filter: brightness(1.08);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-residanat-launch {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.3);
  border: none;
}

.btn-residanat-launch:hover,
.btn-residanat-launch:active,
.btn-residanat-launch:focus {
  transform: none !important;
  filter: brightness(1.06);
}

/* PDF Export inside Mode Examen */
.pdf-actions-container {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}

.pdf-actions-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.pdf-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-pdf-mode-exam {
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  transform: none !important;
}

.btn-pdf-mode-exam:hover,
.btn-pdf-mode-exam:active {
  transform: none !important;
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
}

/* =========================================================================
   MODE EXAMEN GROUPS BREAKDOWN ALLOCATION
   ========================================================================= */
.mode-exam-groups-box {
  background: var(--bg-surface, rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 14px;
  margin-bottom: 12px;
  transition: all 0.25s ease;
}

html[data-theme="light"] .mode-exam-groups-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.mode-exam-groups-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.groups-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.groups-header-title i {
  color: var(--primary);
  font-size: 13.5px;
}

.btn-balance-groups {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-balance-groups:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.mode-exam-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.group-alloc-card {
  background: var(--bg-card, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-color);
  border-radius: 9px;
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

html[data-theme="light"] .group-alloc-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.group-alloc-card:hover {
  border-color: var(--primary);
}

.group-alloc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.group-alloc-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.group-alloc-title i {
  color: var(--primary);
  font-size: 11px;
  flex-shrink: 0;
}

.group-avail-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary-light, #3b82f6);
  white-space: nowrap;
}

.group-alloc-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.group-input-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.group-input-control {
  display: flex;
  align-items: center;
  gap: 4px;
}

.group-input-control .btn-step {
  width: 25px;
  height: 25px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface, rgba(255, 255, 255, 0.05));
  color: var(--text-main);
  font-weight: bold;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  padding: 0;
  line-height: 1;
}

.group-input-control .btn-step:hover:not(:disabled) {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.group-input-control .btn-step:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.group-alloc-input {
  width: 50px;
  height: 25px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--input-bg, #0b1120);
  color: var(--text-main);
  font-family: inherit;
  padding: 0 4px;
}

html[data-theme="light"] .group-alloc-input {
  background: #ffffff;
}

.group-alloc-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.mode-exam-groups-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  font-size: 11.5px;
}

.groups-total-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary-light, #3b82f6);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.groups-hint-text {
  font-size: 11px;
  color: var(--text-muted);
}

/* Ensure secondary header tabs never show in Mode Examen or Résidanat */
body.mode-examen-active #mainHeaderTabs,
body.residanat-active #mainHeaderTabs,
#modeExamenViewContent:not([style*="display: none"]) ~ #mainHeaderTabs,
#residanatViewContent:not([style*="display: none"]) ~ #mainHeaderTabs {
  display: none !important;
}

/* ==========================================================================
   RÉSIDANAT STYLING & ANNALES SÉTIF
   ========================================================================== */
.residanat-subnav-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  background: var(--bg-card-solid, #131a2b);
  border: 1px solid var(--border-color);
  padding: 6px;
  border-radius: 12px;
}

.residanat-subnav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.residanat-subnav-btn:hover {
  color: var(--text-main);
  background: rgba(148, 163, 184, 0.08);
}

.residanat-subnav-btn.active {
  background: #059669;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.residanat-subnav-btn .subnav-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  font-weight: 800;
}

.residanat-subpanel-content {
  animation: fadeInSubpanel 0.25s ease;
}

@keyframes fadeInSubpanel {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.annales-setif-container {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: 16px;
  box-shadow: none !important;
}

.annales-setif-intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.annales-setif-intro-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.annales-setif-intro-title i {
  font-size: 24px;
  color: #2563eb;
}

.annales-setif-intro-title h4 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.annales-setif-intro-title p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 3px 0 0 0;
}

.setif-annales-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}

.setif-annale-pill-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  text-decoration: none;
  font-family: inherit;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.setif-annale-pill-btn:hover {
  transform: translateY(-2px);
  border-color: #2563eb;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.15);
}

.setif-annale-pill-btn.has-questions {
  border-color: #2563eb;
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.1);
}

.setif-annale-pill-btn.has-questions:hover {
  border-color: #1d4ed8;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.22);
}

.pill-content-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
}

.tag-exm {
  color: #2563eb !important;
  font-weight: 800;
}

.tag-res {
  color: #0f172a !important;
  font-weight: 800;
}

.tag-fac {
  color: #16a34a !important;
  font-weight: 800;
}

.tag-month {
  color: #0f172a !important;
  font-weight: 800;
}

.tag-yr {
  color: #dc2626 !important;
  font-weight: 800;
}

.pill-badge-indicator {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.pill-badge-indicator.ready {
  background: #dbeafe;
  color: #1e40af;
}

.pill-badge-indicator.empty {
  background: #f1f5f9;
  color: #64748b;
}

/* Dark theme support for pills */
[data-theme="dark"] .setif-annale-pill-btn {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .setif-annale-pill-btn:hover {
  border-color: #60a5fa;
  box-shadow: 0 6px 14px rgba(96, 165, 250, 0.25);
}

[data-theme="dark"] .setif-annale-pill-btn.has-questions {
  background: linear-gradient(135deg, #1e293b 0%, #1e3a5f 100%);
  border-color: #3b82f6;
}

[data-theme="dark"] .tag-exm {
  color: #60a5fa !important;
}

[data-theme="dark"] .tag-res {
  color: #f1f5f9 !important;
}

[data-theme="dark"] .tag-fac {
  color: #4ade80 !important;
}

[data-theme="dark"] .tag-month {
  color: #f1f5f9 !important;
}

[data-theme="dark"] .tag-yr {
  color: #f87171 !important;
}

[data-theme="dark"] .pill-badge-indicator.ready {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

[data-theme="dark"] .pill-badge-indicator.empty {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.residanat-session-type-card {
  background: var(--bg-card-solid, #131a2b);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.session-type-title,
.packs-section-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.session-type-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.session-pill-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-card);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.session-pill-btn:hover {
  border-color: var(--primary-light);
}

.session-pill-btn.active {
  border-color: #059669;
  background: rgba(16, 185, 129, 0.06);
}

.session-pill-btn .pill-icon i {
  font-size: 22px;
  color: var(--text-muted);
  width: 44px;
  height: 44px;
  background: rgba(148, 163, 184, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.session-pill-btn.active .pill-icon i {
  color: #059669;
  background: rgba(16, 185, 129, 0.15);
}

.session-pill-btn .pill-texts strong {
  display: block;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 2px;
}

.session-pill-btn.active .pill-texts strong {
  color: #059669;
}

.session-pill-btn .pill-texts small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* 3-Pack Selector Cards - Compact & Modern */
.residanat-packs-container {
  margin-bottom: 16px;
}

.residanat-pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.residanat-pack-card {
  background: var(--bg-card-solid, #131a2b);
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.residanat-pack-card:hover {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.15);
  transform: translateY(-2px);
}

.residanat-pack-card.active {
  border-color: #059669;
  background: rgba(16, 185, 129, 0.06);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.2);
}

.pack-badge-tag {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  margin-bottom: 12px;
}

.pack-badge-tag.recommended-tag {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.pack-badge-tag.full-tag {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.pack-header-total {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 16px;
}

.pack-header-total .num {
  font-size: 38px;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1;
}

.residanat-pack-card.active .pack-header-total .num {
  color: #059669;
}

.pack-header-total .unit {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted);
}

.pack-composition-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 14px;
}

.comp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}

.comp-row .dot-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.comp-row.bio .dot-indicator { background: #3b82f6; }
.comp-row.med .dot-indicator { background: #10b981; }
.comp-row.chir .dot-indicator { background: #ef4444; }

.comp-row .comp-label {
  flex: 1;
  color: var(--text-main);
}

.comp-row .comp-val {
  font-weight: 800;
  color: var(--text-main);
}

.pack-clock-info {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}

/* Résidanat Launch Box */
.residanat-launch-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.launch-actions-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.residanat-exam-name-box {
  flex: 1;
  min-width: 280px;
}

.residanat-exam-name-box label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

/* History Tables */
.mode-history-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  margin-top: 24px;
}

.history-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.history-title-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-title-block i {
  color: var(--primary);
  font-size: 18px;
}

.history-title-block h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.history-count-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  border-radius: 8px;
}

.history-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.modern-history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.modern-history-table th {
  padding: 12px 16px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-color);
}

.modern-history-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.modern-history-table tbody tr:hover {
  background: var(--item-bg-hover);
}

.empty-history-row td {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

.history-score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
}

.history-score-pill.score-high {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.history-score-pill.score-med {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.history-score-pill.score-low {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.btn-history-action {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-history-action:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Dark Theme Adjustments */
[data-theme="dark"] .mode-custom-header {
  background: rgba(30, 41, 59, 0.5);
}

[data-theme="dark"] .residanat-pack-card.active {
  background: rgba(6, 78, 59, 0.25);
  border-color: #10b981;
}

[data-theme="dark"] .residanat-pack-card.active .pack-header-total .num {
  color: #34d399;
}

[data-theme="dark"] .session-pill-btn.active {
  background: rgba(6, 78, 59, 0.25);
  border-color: #10b981;
}

[data-theme="dark"] .session-pill-btn.active .pill-texts strong {
  color: #34d399;
}

/* ==========================================================================
   COUNTDOWN TIMER & EXAM DURATION STYLES
   ========================================================================== */
.residanat-duration-box label,
.setup-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}

.residanat-duration-box .setup-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 700;
  box-sizing: border-box;
}

.residanat-duration-box .setup-input:focus,
.setup-field .setup-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.timer-display.global-timer.countdown-active {
  background: rgba(37, 99, 235, 0.12) !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
  color: var(--primary) !important;
}

.timer-display.global-timer.countdown-active i {
  color: var(--primary) !important;
}

.timer-display.global-timer.timer-warning {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
  color: #d97706 !important;
}

.timer-display.global-timer.timer-warning i {
  color: #d97706 !important;
}

.timer-display.global-timer.timer-danger {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
  color: #dc2626 !important;
}

.timer-display.global-timer.timer-danger i {
  color: #dc2626 !important;
}

/* Read-only Review Mode styles */
.read-only-session .options-container .option-item,
.read-only-session .option-item {
  cursor: default !important;
}

.read-only-session .option-strike-btn {
  display: none !important;
}

.read-only-session #toolVerify {
  display: none !important;
}

#savedExamsGrid .compact-card,
#savedExamsGrid .qcm-card,
#savedExamsGrid .queue-card {
  transform: none !important;
}

#savedExamsGrid .compact-card:hover,
#savedExamsGrid .compact-card:active,
#savedExamsGrid .compact-card:focus,
#savedExamsGrid .qcm-card:hover,
#savedExamsGrid .qcm-card:active,
#savedExamsGrid .queue-card:hover,
#savedExamsGrid .queue-card:active {
  transform: none !important;
}

/* ========================================== */
/* PROGRAMME VIEW (QCMs PNS) */
/* ========================================== */
#programmePanel .programme-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
#programmePanel .programme-page-title {
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main, #1e293b);
}
#programmePanel .programme-page-sub {
  font-size: 13px;
  color: var(--text-muted, #64748b);
  margin-top: 4px;
}
#programmePanel .programme-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#programmePanel .programme-filter-pills {
  display: flex;
  background: var(--bg-card, rgba(255,255,255,0.06));
  border: 1px solid var(--border-light, rgba(0,0,0,0.1));
  border-radius: 99px;
  padding: 3px;
  gap: 3px;
}
#programmePanel .pg-filter-btn {
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  transition: all 0.2s ease;
}
#programmePanel .pg-filter-btn.active {
  background: var(--primary, #00bcd4);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 188, 212, 0.35);
}
#programmePanel .pg-type-btn {
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border-light, rgba(0,0,0,0.1));
  background: var(--bg-card, #fff);
  color: var(--text-main, #333);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
#programmePanel .pg-type-btn.active {
  background: var(--primary, #00bcd4);
  color: #fff;
  border-color: var(--primary, #00bcd4);
  box-shadow: 0 2px 8px rgba(0, 188, 212, 0.25);
}
#programmePanel .programme-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.qcms-programme-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-light, rgba(0,0,0,0.08));
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.qcms-programme-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary, #00bcd4);
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.12);
}
.qcms-programme-card.is-missed {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.04);
}
.qcms-programme-card.is-missed .qcms-programme-title,
.qcms-programme-card.is-missed .qcms-programme-module,
.qcms-programme-card.is-missed .qcms-programme-lessons,
.qcms-programme-card.is-missed .qcms-programme-time {
  text-decoration: line-through 2px #ef4444;
  opacity: 0.65;
}
.qcms-programme-cancelled-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.qcms-programme-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.qcms-programme-type-badge {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.qcms-programme-type-badge.qcmspns {
  background: rgba(0, 188, 212, 0.15);
  color: #00bcd4;
}
.qcms-programme-type-badge.qcmsai {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
}
.qcms-programme-type-badge.flashcardsai {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}
.qcms-programme-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 5px;
}
.qcms-programme-module {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary, #00bcd4);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.qcms-programme-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main, #1e293b);
  line-height: 1.35;
}
.qcms-programme-lessons {
  font-size: 12.5px;
  color: var(--text-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 6px;
}
.qcms-programme-discipline-alert {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.qcms-programme-discipline-title {
  font-size: 11.5px;
  font-weight: 800;
  color: #ef4444;
  display: flex;
  align-items: center;
  gap: 6px;
}
.qcms-programme-discipline-quote {
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-muted, #64748b);
  line-height: 1.4;
}
.qcms-programme-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-light, rgba(0,0,0,0.06));
}
.btn-lancer-qcms-programme {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #00bcd4, #0097a7);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 188, 212, 0.25);
}
.btn-lancer-qcms-programme:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 18px rgba(0, 188, 212, 0.35);
}
.btn-lancer-qcms-programme.is-late {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

/* ---- PNS unified modern empty state (FR) ---- */
.pns-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 56px 24px;
  margin: 8px 0;
  border-radius: 20px;
  border: 1px dashed var(--border-color, #cbd5e1);
  background: var(--bg-soft, rgba(0, 188, 212, 0.04));
}
.pns-empty-icon {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(0, 188, 212, 0.16), rgba(59, 130, 246, 0.16));
  box-shadow: inset 0 0 0 1px rgba(0, 188, 212, 0.25);
  margin-bottom: 6px;
}
.pns-empty-icon i {
  font-size: 34px;
  color: var(--primary, #00bcd4);
}
.pns-empty-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main, #0f172a);
  margin: 0;
}
.pns-empty-sub {
  font-size: 14px;
  color: var(--text-muted, #64748b);
  max-width: 460px;
  margin: 0;
  line-height: 1.6;
}

/* ---- App version tag (proves which code is running) ---- */
.pns-version-tag {
  margin: 10px 14px 14px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  color: var(--text-muted, #64748b);
  border: 1px dashed var(--border-color, #cbd5e1);
  border-radius: 10px;
  background: var(--bg-soft, rgba(0, 188, 212, 0.05));
}

/* ==========================================================================
   COMPREHENSIVE TABLET & MOBILE RESPONSIVE ENGINE (QCMS PNS)
   Addresses iPad (768px / 1024px) & Phone (360px - 480px) layouts
   ========================================================================== */

/* 1. TABLET & MOBILE GLOBAL FIXES (<= 1024px) */
@media (max-width: 1024px) {
  /* Mobile Container & Fixed Drawer Sidebar */
  .app-container {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  .main-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    min-width: 280px !important;
    max-width: 280px !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 1000 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  .main-sidebar.mobile-open {
    transform: translateX(0) !important;
  }
  .main-content,
  body.sidebar-collapsed .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Prevent player layout from reserving 280px desktop sidebar space */
  .player-split-layout,
  #testPlayerPanel .player-split-layout,
  #testPlayerPanel.active .player-split-layout,
  body.player-active .player-split-layout,
  body.sidebar-collapsed .player-split-layout {
    margin-right: 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px 14px 90px !important;
    box-sizing: border-box !important;
  }

  /* Player workspace fills 100% with no dead voids */
  .player-workspace,
  #testPlayerPanel .player-workspace {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  .player-workspace-scroll-area {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Toolbar row: wrap smoothly, align center, responsive buttons */
  .player-unified-header {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 12px !important;
    margin-bottom: 14px !important;
  }

  .unified-row-3 {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px 6px !important;
    width: 100% !important;
  }

  .toolbar-left,
  .toolbar-right {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
  }

  .tool-btn {
    width: 34px !important;
    height: 34px !important;
    font-size: 13px !important;
    flex-shrink: 0 !important;
  }

  .tool-btn.next-btn {
    width: 34px !important;
  }

  /* Question Card & Typography */
  .question-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 16px 18px !important;
    margin: 0 auto 16px !important;
  }

  .question-text {
    font-size: 16px !important;
    line-height: 1.5 !important;
    width: auto !important;
    max-width: 100% !important;
    word-break: break-word !important;
    margin-bottom: 12px !important;
  }

  .question-meta {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px 12px !important;
  }

  .options-container {
    width: 100% !important;
    gap: 8px !important;
  }

  .option-item {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 11px 14px !important;
    gap: 10px !important;
  }

  .option-text {
    font-size: 14px !important;
    line-height: 1.45 !important;
    word-break: break-word !important;
  }

  /* Setup Filters Bar: Balanced 3-column Grid on Tablet */
  .modern-filters-bar {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
    margin-bottom: 16px !important;
  }

  .modern-filters-bar .custom-dropdown {
    width: 100% !important;
  }

  .modern-filters-bar .dropdown-toggle {
    width: 100% !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    padding: 7px 12px !important;
  }
}

/* 2. MOBILE SPECIFIC (<= 640px) */
@media (max-width: 640px) {
  .main-content {
    padding: 10px 8px 80px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Primary Navigation Tabs: Responsive full/short labels to eliminate text overlap */
  .accueil-view-tabs .tab-label-full {
    display: none !important;
  }
  .accueil-view-tabs .tab-label-short {
    display: inline !important;
  }

  /* Setup Tabs: fit within 390px phone screens without cutoff or text overlap */
  .accueil-view-tabs,
  .exam-modes-tabs {
    display: flex !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 99px !important;
    padding: 3px !important;
    gap: 3px !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .accueil-view-tabs::-webkit-scrollbar,
  .exam-modes-tabs::-webkit-scrollbar {
    display: none !important;
  }

  .accueil-view-tabs .tab-btn,
  .exam-modes-tabs .tab-btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    justify-content: center !important;
    padding: 7px 5px !important;
    font-size: 11.5px !important;
    gap: 5px !important;
    white-space: nowrap !important;
  }

  .accueil-view-tabs .tab-btn .badge {
    padding: 1px 5px !important;
    font-size: 10px !important;
    margin-left: 2px !important;
  }

  /* Mode/AI sub-tabs: Centered horizontally on phone screen */
  .header-tabs,
  #mainHeaderTabs {
    display: inline-flex !important;
    width: auto !important;
    max-width: 100% !important;
    align-self: center !important;
    margin: 8px auto !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    box-sizing: border-box !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .header-tabs::-webkit-scrollbar,
  #mainHeaderTabs::-webkit-scrollbar {
    display: none !important;
  }

  .header-tabs .tab-btn,
  #mainHeaderTabs .tab-btn {
    flex: 0 0 auto !important;
    padding: 7px 14px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .exam-type-selector,
  .views-segmented-tabs {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    box-sizing: border-box !important;
  }

  /* Filters Bar: Balanced 2-column Grid on Phones (3 rows of 2 items, 100% width) */
  .modern-filters-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  .modern-filters-bar .dropdown-toggle {
    font-size: 11px !important;
    padding: 6px 10px !important;
  }

  .dropdown-toggle span {
    max-width: 90px !important;
  }

  /* ==========================================================================
     MOBILE TREE ACCORDION RE-LAYOUT (<= 640px / Phones)
     Rearranges Year, Module, Group, and Course rows into a clean multi-line layout:
     - Line 1: Checkbox + Chevron + Icon + Full Name (wraps naturally, never cut off) + Expand chevron
     - Line 2: Badges and counters neatly aligned below the title
     - Compact left indentation to maximize horizontal space for titles
     ========================================================================== */
  .tree-modules-container,
  .tree-groups-container,
  .tree-courses-container,
  .tree-children {
    padding: 3px 2px 4px 4px !important;
    margin-left: 0 !important;
    border-left: none !important;
  }

  .selection-container,
  .view-panel {
    padding: 8px 6px !important;
  }

  /* Tree Rows: allow wrapping to 2 lines on mobile */
  .tree-row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    padding: 6px 8px !important;
    gap: 4px 6px !important;
    position: relative !important;
  }

  .tree-year-row {
    padding: 9px 10px !important;
    gap: 4px 6px !important;
  }

  .tree-module-row {
    padding: 6px 8px !important;
    margin: 2px 2px !important;
  }

  .tree-group-row {
    padding: 5px 6px !important;
    margin: 1px 2px !important;
  }

  .tree-lesson-row {
    padding: 5px 6px !important;
    margin: 1px 0 !important;
  }

  /* Compact controls on Line 1 */
  .checkbox-custom {
    order: 1 !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    border-radius: 5px !important;
    flex-shrink: 0 !important;
  }

  .tree-chevron {
    order: 2 !important;
    width: 12px !important;
    min-width: 12px !important;
    font-size: 9px !important;
    flex-shrink: 0 !important;
  }

  .tree-year-icon {
    order: 3 !important;
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .tree-module-icon {
    order: 3 !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    border-radius: 7px !important;
    flex-shrink: 0 !important;
  }

  .tree-group-icon {
    order: 3 !important;
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    flex-shrink: 0 !important;
  }

  .tree-lesson-icon {
    order: 2 !important;
    width: 16px !important;
    min-width: 16px !important;
    font-size: 12px !important;
    flex-shrink: 0 !important;
  }

  /* Titles: module and group labels */
  .tree-label,
  .tree-module-label,
  .tree-group-label {
    order: 4 !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word !important;
    line-height: 1.35 !important;
    padding-right: 2px !important;
  }

  .tree-module-label {
    font-size: 12.5px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
  }

  .tree-group-label {
    font-size: 12px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
  }

  /* Expand/collapse icon on the right: HIDDEN on mobile (left chevron already controls expansion) */
  .expand-icon {
    display: none !important;
  }

  /* ==========================================================================
     MOBILE YEAR ROW: Strictly ONE single line (Yellow Frame Fix)
     [Checkbox] [Chevron] [Icon] [Year Title ...] [Badges Group]
     ========================================================================== */
  .tree-year-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 8px 10px !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .tree-year-row .checkbox-custom {
    order: 1 !important;
    flex-shrink: 0 !important;
  }

  .tree-year-row .tree-chevron {
    order: 2 !important;
    flex-shrink: 0 !important;
  }

  .tree-year-row .tree-year-icon {
    order: 3 !important;
    flex-shrink: 0 !important;
  }

  .tree-year-row .tree-year-label {
    order: 4 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    margin: 0 !important;
    padding-right: 4px !important;
  }

  .tree-year-row .tree-badges-group {
    order: 5 !important;
    width: auto !important;
    margin: 0 0 0 auto !important;
    padding-left: 0 !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 4px !important;
  }

  /* Group row in tree */
  .tree-group-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    padding: 6px 8px !important;
    gap: 5px !important;
  }
  .tree-group-row .checkbox-custom { order: 1 !important; flex-shrink: 0 !important; }
  .tree-group-row .tree-chevron { order: 2 !important; flex-shrink: 0 !important; }
  .tree-group-row .tree-group-icon { order: 3 !important; flex-shrink: 0 !important; }
  .tree-group-row .tree-group-label {
    order: 4 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .tree-group-row .tree-badges-group {
    order: 5 !important;
    width: auto !important;
    margin: 0 0 0 auto !important;
    padding-left: 0 !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
  }

  /* Course count pills in badges group */
  .module-courses-count {
    font-size: 9.5px !important;
    font-weight: 600 !important;
    color: var(--primary) !important;
    background: var(--primary-light, rgba(37, 99, 235, 0.09)) !important;
    border: 1px solid rgba(37, 99, 235, 0.22) !important;
    padding: 1.5px 6px !important;
    border-radius: 12px !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }

  /* ==========================================================================
     MOBILE COURSE ROW: Strictly ONE single line (Black Frame Fix)
     [Index 1.] [Course Title ...] [17 FR] [17 QCMs] [Checkbox]
     ========================================================================== */
  .tree-row.course-row,
  .tree-lesson-row {
    display: flex;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 6px 8px !important;
    gap: 5px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
  }

  /* 1. Course Checkbox on the left */
  .tree-lesson-row > .checkbox-custom {
    order: 1 !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }

  /* 2. Index number */
  .tree-lesson-row .course-index-num,
  .tree-lesson-row .tree-lesson-icon {
    order: 2 !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    min-width: 16px !important;
    font-size: 12.5px !important;
  }

  /* Chevron for AI accordion */
  .tree-lesson-row .tree-chevron {
    order: 3 !important;
    flex-shrink: 0 !important;
    margin-right: 2px !important;
  }

  /* 3. Course title: truncates with ellipsis if long to keep badges visible */
  .tree-lesson-row .tree-lesson-label {
    order: 4 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    margin: 0 !important;
    padding: 0 2px !important;
    line-height: 1.3 !important;
  }

  /* In-place expansion when clicked to read full title */
  .tree-lesson-row .tree-lesson-label.is-title-expanded {
    white-space: normal !important;
    overflow: visible !important;
    word-break: break-word !important;
    background: var(--bg-card, #ffffff);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    z-index: 10;
  }

  /* 4. Language badge (e.g. 17 FR) */
  .tree-lesson-row .course-lang-badge {
    order: 5 !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    font-size: 9.5px !important;
    padding: 1.5px 5px !important;
    border-radius: 5px !important;
  }

  /* AI CSV Pill */
  .tree-lesson-row .btn-tree-csv-pill {
    order: 6 !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    font-size: 9.5px !important;
    padding: 2px 6px !important;
  }

  /* 5. Total questions badge (e.g. 17 QCMs) */
  .tree-lesson-row .tree-badges-group {
    order: 7 !important;
    width: auto !important;
    display: inline-flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 4px !important;
    margin: 0 0 0 auto !important;
    padding-left: 0 !important;
    flex-shrink: 0 !important;
  }

  /* ==========================================================================
     MOBILE MODULE TABS: Checkbox ABOVE Icon, Never show module name
     ========================================================================== */
  .module-tabs-container {
    padding: 0 !important;
    margin: 4px 0 6px 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .module-tabs-row {
    padding: 3px 2px !important;
    gap: 2px !important;
    border-radius: 10px !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: space-around !important;
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
  }

  .module-tabs-row::-webkit-scrollbar {
    display: none !important;
  }

  .module-tab {
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 1.5px !important;
    height: auto !important;
    min-height: 32px !important;
    padding: 2px 1px !important;
    border-radius: 6px !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: 31px !important;
    box-sizing: border-box !important;
  }

  .module-tab .module-tab-cb {
    order: 1 !important;
    width: 10px !important;
    height: 10px !important;
    min-width: 10px !important;
    min-height: 10px !important;
    border-radius: 2.5px !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }

  .module-tab .module-tab-icon {
    order: 2 !important;
    width: 15px !important;
    height: 15px !important;
    min-width: 15px !important;
    min-height: 15px !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
  }

  .module-tab .module-tab-fallback {
    order: 2 !important;
    font-size: 11px !important;
    margin: 0 !important;
  }

  /* Exception on mobile: when selecting a module tab, do NOT show its name */
  .module-tab .module-tab-label,
  .module-tab.active .module-tab-label {
    display: none !important;
  }

  /* Badges styling */
  .tree-badge {
    padding: 1.5px 6px !important;
    font-size: 9.5px !important;
    border-radius: 12px !important;
    flex-shrink: 0 !important;
  }

  .selection-count-input {
    width: 48px !important;
    height: 22px !important;
    padding: 1px 4px !important;
    font-size: 11px !important;
    border-radius: 6px !important;
  }

  /* Mobile Test Creation Footer: stacks vertically so it never forces horizontal overflow */
  .compact-test-footer {
    padding: 10px 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .compact-footer-main-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .compact-field-group.field-test-name {
    min-width: 0 !important;
    width: 100% !important;
  }
  .compact-field-group.field-total-qcms {
    width: 100% !important;
    justify-content: space-between !important;
  }
  .compact-footer-actions {
    width: 100% !important;
  }
  .btn-launch-session {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Mobile Mode Examen & Résidanat Launch Footer (Problem A / Image 1) */
  .mode-launch-footer {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .exam-name-field {
    width: 100% !important;
    min-width: 0 !important;
  }
  .exam-name-field .setup-input {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .btn-mode-launch,
  .btn-residanat-launch {
    width: 100% !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  /* Mobile Résidanat Sétif Annales Pills (Problem B / Image 2) */
  .residanat-subnav-bar {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .residanat-subnav-btn {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 8px 12px !important;
    font-size: 12.5px !important;
  }
  .annales-setif-container {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .setif-annales-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .setif-annale-pill-btn {
    padding: 8px 10px !important;
    gap: 6px !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }
  .pill-content-text {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    font-size: 12px !important;
    gap: 3px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .pill-badge-indicator {
    flex-shrink: 0 !important;
    margin-left: auto !important;
    font-size: 10.5px !important;
    padding: 2.5px 7px !important;
  }

  /* Compact Question Card for Phones */
  .question-card {
    padding: 14px 12px !important;
  }

  .question-header-actions {
    gap: 5px !important;
    margin-left: 8px !important;
    margin-inline-start: 8px !important;
    margin-bottom: 2px !important;
    margin-block-end: 2px !important;
  }

  .qcm-answer-summary-badge {
    font-size: 12px !important;
    padding: 2px 7px !important;
    border-radius: 6px !important;
  }

  .btn-edit-solution {
    width: 25px !important;
    height: 25px !important;
    font-size: 11px !important;
  }

  .btn-copy-action.btn-copy-question {
    width: 25px !important;
    height: 25px !important;
    font-size: 11px !important;
  }

  .question-text {
    font-size: 15px !important;
  }

  .tool-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 12px !important;
  }
}




/* ==========================================================================
   MODE SPLIT 40/60 — FINAL DESKTOP OVERRIDES
   Beat the tablet/mobile responsive engine (padding 14px, width 100%) and the
   #testPlayerPanel.active ID-specificity rules so the mode split is always
   exactly 40% QCM / 60% mode panel, flush to the screen edges. Desktop only —
   mobile (<=900px) keeps its fullscreen mode behavior.
   ========================================================================== */
@media (min-width: 901px) {
  body.mode-active-body #testPlayerPanel .player-split-layout,
  body.mode-active-body #testPlayerPanel.active .player-split-layout,
  body.mode-active-body .player-split-layout {
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }

  body.mode-active-body #testPlayerPanel .player-workspace,
  body.mode-active-body #testPlayerPanel.active .player-workspace,
  body.mode-active-body .player-workspace {
    flex: 0 0 40% !important;
    width: 40% !important;
    max-width: 40% !important;
    min-width: 40% !important;
  }

  body.mode-active-body #testPlayerPanel .player-mode-panel,
  body.mode-active-body #testPlayerPanel.active .player-mode-panel,
  body.mode-active-body .player-mode-panel {
    flex: 0 0 60% !important;
    width: 60% !important;
    max-width: 60% !important;
    min-width: 60% !important;
  }
}
/* ==========================================================================
   MODE LAYOUT REDESIGN — questions list confinement, 4-row header, meta row
   ========================================================================== */

/* ---- 0. Questions sidebar: FLEX column (not grid) so the questions list
         ALWAYS fills the remaining height, whichever rows were relocated ---- */
#testPlayerPanel .player-sidebar,
.player-sidebar {
  display: flex !important;
  flex-direction: column !important;
}

.player-sidebar .player-sidebar-mobile-header,
.player-sidebar .sidebar-compact-row,
.player-sidebar .search-bar-wrapper,
.player-sidebar .attempts-dropdown {
  flex: 0 0 auto !important;
}

.player-sidebar .questions-nav-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

/* ---- 1. Questions list (orange overlay): in mode it opens ONLY over the
         QCM pane (40%), never over the mode screen ---- */
body.mode-active-body #testPlayerPanel .player-sidebar,
body.mode-active-body #testPlayerPanel.active .player-sidebar,
body.mode-active-body .player-sidebar {
  left: 0 !important;
  right: auto !important;
  bottom: 0 !important;
  height: 100vh !important;
  height: 100dvh !important;
  width: 40% !important;
  min-width: 40% !important;
  max-width: 40% !important;
  transform: translateX(-100%) !important;
  z-index: 4200 !important;
}

body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar {
  transform: translateX(0) !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* On phones in mode the QCM pane is hidden: the Instructions tab opens the
   questions panel as a FULL-SCREEN sheet above the mode screen (closed via
   its X button or the QCM tab) */
@media (max-width: 1024px) {
  #testPlayerPanel #playerSidebarHomeSlot .player-sidebar,
  #testPlayerPanel:not(.mobile-sidebar-open) .player-sidebar,
  .player-split-layout > .player-sidebar {
    transform: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    z-index: -1 !important;
  }
}

/* ---- 2. Row 1: Pause + Test timer + QCM timer + view tabs ---- */
.unified-row-1,
.row1-view-tabs {
  display: none !important;
}

/* ==========================================================================
   GLOBAL OPTION ITEMS: VERTICAL CENTERING (PC Normal, PC Mode, Tablets, Phones)
   - When option container height expands due to multi-line text,
     the option letter (A, B, C, D, E), the strike button (x), and the
     confidence dial (0%) must ALL be vertically centered inside the container.
   ========================================================================== */
.option-item,
#optionsContainer .option-item,
body.mode-active-body .option-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  box-sizing: border-box !important;
}

.option-item > .option-letter,
#optionsContainer .option-item > .option-letter {
  flex-shrink: 0 !important;
  align-self: center !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.option-item > .option-text,
#optionsContainer .option-item > .option-text {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  align-self: center !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.option-item > .option-strike-btn,
#optionsContainer .option-item > .option-strike-btn {
  flex-shrink: 0 !important;
  align-self: center !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  margin-left: auto !important;
  margin-right: 4px !important;
}

.option-item > .option-confidence-dial,
#optionsContainer .option-item > .option-confidence-dial {
  flex-shrink: 0 !important;
  align-self: center !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  margin-left: 4px !important;
  margin-right: 4px !important;
}

.option-item > .option-text + .option-confidence-dial,
.read-only-session .option-item > .option-confidence-dial {
  margin-left: auto !important;
}

.option-item > .option-justify-btn,
#optionsContainer .option-item > .option-justify-btn {
  flex-shrink: 0 !important;
  align-self: center !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.option-item::after {
  align-self: center !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* ==========================================================================
   DESKTOP (PC) - NORMAL MODE (Mode OFF) width > 1024px
   ========================================================================== */
@media (min-width: 1025px) {
  body:not(.mode-active-body) .unified-row-1,
  body:not(.mode-active-body) #testPlayerPanel .unified-row-1 {
    display: none !important;
  }

  body:not(.mode-active-body) .row1-view-tabs,
  body:not(.mode-active-body) #testPlayerPanel .row1-view-tabs {
    display: none !important;
  }

  body:not(.mode-active-body) .unified-row-2,
  body:not(.mode-active-body) #testPlayerPanel .unified-row-2 {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
  }

  body:not(.mode-active-body) .unified-row-3 {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important;
    padding-top: 3px !important;
  }

  body:not(.mode-active-body) .unified-row-3 .toolbar-left,
  body:not(.mode-active-body) .unified-row-3 .toolbar-right {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 4px !important;
  }

  body:not(.mode-active-body) .unified-row-3 .tool-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    font-size: 14px !important;
    border-radius: 8px !important;
  }

  body:not(.mode-active-body) .unified-row-3 .tool-btn.next-btn,
  body:not(.mode-active-body) .unified-row-3 .tool-btn.prev-btn {
    width: 36px !important;
  }
}

/* ==========================================================================
   DESKTOP IN MODE (PC width > 1024px)
   - Layout matching Image 1:
     Row 1: [Active Tags in Row 1 left] [Pause + Timers in middle] [Instructions / QCM tabs in yellow box area]
     Row 2: Module & Course tags (old Row 2 hidden)
     Row 3: Single compact row of 15 toolbar buttons
   ========================================================================== */
@media (min-width: 1025px) {
  body.mode-active-body .player-unified-header,
  body.mode-active-body #testPlayerPanel .player-unified-header {
    position: relative !important;
    top: auto !important;
    z-index: 10 !important;
    background: var(--bg-card) !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 8px 10px !important;
    margin-bottom: 12px !important;
    border-radius: 14px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06) !important;
    flex-shrink: 0 !important;
    overflow: visible !important;
  }

  /* Row 1 in Desktop Mode: [Tags] [Pause + Timers] [Instructions / QCM] */
  body.mode-active-body .unified-row-1,
  body.mode-active-body #testPlayerPanel .unified-row-1 {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    width: 100% !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    padding: 0 0 4px 0 !important;
  }

  body.mode-active-body #testPlayerPanel .unified-row-1 .row1-tags-slot {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
  }

  body.mode-active-body #testPlayerPanel .unified-row-1 .row1-timers-slot {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
    margin-left: 6px !important;
  }

  body.mode-active-body #testPlayerPanel .unified-row-1 .row1-view-tabs {
    margin-left: auto !important;
  }

  body.mode-active-body #testPlayerPanel .unified-row-1 .row1-tags-slot .active-tags-row {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
  }

  body.mode-active-body #testPlayerPanel .unified-row-1 .row1-tags-slot .active-tag {
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    border-radius: 7px !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
  }

  body.mode-active-body #testPlayerPanel .unified-row-1 .row1-timers-slot {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
  }

  body.mode-active-body #testPlayerPanel .unified-row-1 .sidebar-timers-row {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  body.mode-active-body #testPlayerPanel .unified-row-1 .sidebar-timers-row .btn-icon-small {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    box-sizing: border-box !important;
    border-radius: 7px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11px !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
  }

  body.mode-active-body #testPlayerPanel .unified-row-1 .sidebar-timers-row .timer-display {
    height: 28px !important;
    min-height: 28px !important;
    box-sizing: border-box !important;
    border-radius: 7px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 8px !important;
    gap: 4px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }

  body.mode-active-body #testPlayerPanel .unified-row-1 .row1-view-tabs {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0 !important;
    margin: 0 !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    background: var(--bg-input) !important;
    height: 28px !important;
    min-height: 28px !important;
    box-sizing: border-box !important;
    flex: 0 0 auto !important;
  }

  body.mode-active-body #testPlayerPanel .unified-row-1 .row1-view-tab {
    border: none !important;
    background: transparent !important;
    padding: 0 9px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.18s ease, color 0.18s ease !important;
    outline: none !important;
    height: 100% !important;
    box-sizing: border-box !important;
    gap: 5px !important;
  }

  body.mode-active-body #testPlayerPanel .unified-row-1 .row1-view-tab + .row1-view-tab {
    border-left: 1px solid var(--border-color) !important;
  }

  body.mode-active-body #testPlayerPanel .unified-row-1 .row1-view-tab.active {
    background: var(--primary) !important;
    color: #ffffff !important;
  }

  /* Row 2 in Desktop Mode: hidden because tags are moved to Row 1 */
  body.mode-active-body .unified-row-2:not(.unified-row-tags2),
  body.mode-active-body #testPlayerPanel .unified-row-2:not(.unified-row-tags2) {
    display: none !important;
  }

  /* Row 2 (Tags 2): Module, Rotation, Year, Course */
  body.mode-active-body .unified-row-tags2,
  body.mode-active-body #testPlayerPanel .unified-row-tags2 {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    padding: 2px 0 !important;
  }

  body.mode-active-body .unified-row-tags2 .active-tags-row {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
  }

  body.mode-active-body .unified-row-tags2 .active-tags-row::-webkit-scrollbar {
    display: none !important;
  }

  body.mode-active-body .unified-row-tags2 .active-tag {
    height: 26px !important;
    min-height: 26px !important;
    padding: 0 7px !important;
    font-size: 10.5px !important;
    border-radius: 7px !important;
    flex: 0 0 auto !important;
    max-width: none !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
  }

  body.mode-active-body .unified-row-tags2 .active-tag.tag-course-wide {
    flex: 0 1 auto !important;
    max-width: 250px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Row 3: 1 compact single row of toolbar buttons */
  body.mode-active-body .unified-row-3,
  body.mode-active-body #testPlayerPanel .unified-row-3 {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 3px !important;
    width: 100% !important;
    padding-top: 3px !important;
    overflow: hidden !important;
  }

  body.mode-active-body .unified-row-3 .toolbar-left,
  body.mode-active-body .unified-row-3 .toolbar-right {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 3px !important;
    flex-shrink: 1 !important;
  }

  body.mode-active-body .unified-row-3 .tool-btn {
    width: 27px !important;
    height: 27px !important;
    min-width: 27px !important;
    max-width: 32px !important;
    padding: 0 !important;
    font-size: 11.5px !important;
    border-radius: 6px !important;
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  body.mode-active-body .unified-row-3 #toolTranslate.tool-btn {
    width: auto !important;
    min-width: 0 !important;
    padding: 0 4px !important;
  }
}

/* ==========================================================================
   TABLETS (541px <= width <= 1024px):
   - Exactly the same design as Desktop in Mode (Image 1):
     Row 1: [Active Tags] [Pause + Timers] [Instructions / QCM]
     Row 2: Module & Course tags
     Row 3: Single compact row of 15 toolbar buttons
   ========================================================================== */
@media (min-width: 541px) and (max-width: 1024px) {
  .player-unified-header,
  #testPlayerPanel .player-unified-header {
    position: relative !important;
    top: auto !important;
    z-index: 10 !important;
    background: var(--bg-card) !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 8px 10px !important;
    margin-bottom: 12px !important;
    border-radius: 14px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06) !important;
  }

  /* Row 1: [Tags] [Pause + Timers] [Instructions / QCM] */
  #testPlayerPanel .unified-row-1 {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    width: 100% !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    padding: 0 0 4px 0 !important;
  }

  #testPlayerPanel .unified-row-1 .row1-tags-slot {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
  }

  #testPlayerPanel .unified-row-1 .row1-timers-slot {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
    margin-left: 6px !important;
  }

  #testPlayerPanel .unified-row-1 .row1-view-tabs {
    margin-left: auto !important;
  }

  #testPlayerPanel .unified-row-1 .row1-tags-slot .active-tags-row {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
  }

  #testPlayerPanel .unified-row-1 .row1-tags-slot .active-tag {
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    border-radius: 7px !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
  }

  #testPlayerPanel .unified-row-1 .row1-timers-slot {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
  }

  #testPlayerPanel .unified-row-1 .sidebar-timers-row {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  #testPlayerPanel .unified-row-1 .sidebar-timers-row .btn-icon-small {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    box-sizing: border-box !important;
    border-radius: 7px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11px !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
  }

  #testPlayerPanel .unified-row-1 .sidebar-timers-row .timer-display {
    height: 28px !important;
    min-height: 28px !important;
    box-sizing: border-box !important;
    border-radius: 7px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 8px !important;
    gap: 4px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }

  #testPlayerPanel .unified-row-1 .row1-view-tabs {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0 !important;
    margin: 0 !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    background: var(--bg-input) !important;
    height: 28px !important;
    min-height: 28px !important;
    box-sizing: border-box !important;
    flex: 0 0 auto !important;
  }

  #testPlayerPanel .unified-row-1 .row1-view-tab {
    border: none !important;
    background: transparent !important;
    padding: 0 9px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.18s ease, color 0.18s ease !important;
    outline: none !important;
    height: 100% !important;
    box-sizing: border-box !important;
    gap: 5px !important;
  }

  #testPlayerPanel .unified-row-1 .row1-view-tab + .row1-view-tab {
    border-left: 1px solid var(--border-color) !important;
  }

  #testPlayerPanel .unified-row-1 .row1-view-tab.active {
    background: var(--primary) !important;
    color: #ffffff !important;
  }

  /* Row 2 in Tablet: hidden because tags are moved to Row 1 */
  #testPlayerPanel .unified-row-2:not(.unified-row-tags2) {
    display: none !important;
  }

  /* Row 2 (Tags 2): Module, Rotation, Year, Course */
  #testPlayerPanel .unified-row-tags2 {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    padding: 2px 0 !important;
  }

  #testPlayerPanel .unified-row-tags2 .active-tags-row {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 5px !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
  }

  #testPlayerPanel .unified-row-tags2 .active-tags-row::-webkit-scrollbar {
    display: none !important;
  }

  #testPlayerPanel .unified-row-tags2 .active-tag {
    height: 26px !important;
    min-height: 26px !important;
    padding: 0 8px !important;
    font-size: 10.5px !important;
    border-radius: 7px !important;
    flex: 0 0 auto !important;
    max-width: none !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
  }

  #testPlayerPanel .unified-row-tags2 .active-tag.tag-course-wide {
    flex: 0 1 auto !important;
    max-width: 320px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Row 3: 1 single compact row of toolbar buttons */
  #testPlayerPanel .unified-row-3 {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 3px !important;
    width: 100% !important;
    padding-top: 3px !important;
    overflow: hidden !important;
  }

  #testPlayerPanel .unified-row-3 .toolbar-left,
  #testPlayerPanel .unified-row-3 .toolbar-right {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 3px !important;
    flex-shrink: 1 !important;
  }

  #testPlayerPanel .unified-row-3 .tool-btn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    max-width: 34px !important;
    padding: 0 !important;
    font-size: 12px !important;
    border-radius: 7px !important;
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #testPlayerPanel .unified-row-3 #toolTranslate.tool-btn {
    width: auto !important;
    min-width: 0 !important;
    padding: 0 4px !important;
  }
}

/* ---- Module & Course tags row (unified-row-tags2) ---- */
.unified-row-tags2 {
  display: none;
}

.unified-row-tags2:has(.active-tag) {
  display: flex !important;
}

/* ==========================================================================
   PHONES (width <= 540px):
   - Layout matching Image 2:
     Row 1: [Pause + Timers (30px)] and [Instructions / QCM (30px)]
     Row 2: Active Tags (30px)
     Row 3: Module & Course tags
     Row 4: Toolbar in 2 distinct rows (8 purple icons on top, 7 red icons below, 34px buttons)
   ========================================================================== */
@media (max-width: 540px) {
  .player-unified-header,
  #testPlayerPanel .player-unified-header {
    padding: 8px 10px !important;
    margin-bottom: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Row 1: Timers on left, Tabs on right */
  #testPlayerPanel .unified-row-1 {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
    padding: 0 0 5px 0 !important;
  }

  #testPlayerPanel .unified-row-1 .row1-tags-slot {
    display: none !important;
  }

  #testPlayerPanel .unified-row-1 .row1-timers-slot {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
  }

  #testPlayerPanel .unified-row-1 .sidebar-timers-row {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    flex-wrap: nowrap !important;
    flex: 0 0 auto !important;
  }

  /* Pause button: height 30px */
  #testPlayerPanel .unified-row-1 .sidebar-timers-row .btn-icon-small {
    height: 30px !important;
    min-height: 30px !important;
    width: 30px !important;
    min-width: 30px !important;
    box-sizing: border-box !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11px !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
  }

  /* Timers: height 30px */
  #testPlayerPanel .unified-row-1 .sidebar-timers-row .timer-display {
    height: 30px !important;
    min-height: 30px !important;
    box-sizing: border-box !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 8px !important;
    gap: 4px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }

  /* Joined view tabs (Instructions / QCM): height 30px */
  #testPlayerPanel .unified-row-1 .row1-view-tabs {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    background: var(--bg-input) !important;
    height: 30px !important;
    min-height: 30px !important;
    box-sizing: border-box !important;
    flex: 0 0 auto !important;
  }

  #testPlayerPanel .unified-row-1 .row1-view-tab {
    border: none !important;
    background: transparent !important;
    padding: 0 10px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.18s ease, color 0.18s ease !important;
    outline: none !important;
    height: 100% !important;
    box-sizing: border-box !important;
    gap: 5px !important;
  }

  #testPlayerPanel .unified-row-1 .row1-view-tab + .row1-view-tab {
    border-left: 1px solid var(--border-color) !important;
  }

  #testPlayerPanel .unified-row-1 .row1-view-tab.active {
    background: var(--primary) !important;
    color: #ffffff !important;
  }

  /* Row 2 in Phones: Active Tags (Image 2) */
  #testPlayerPanel .unified-row-2:not(.unified-row-tags2) {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    padding: 3px 0 !important;
  }

  #testPlayerPanel .unified-row-2:not(.unified-row-tags2) .row2-timers-slot,
  #testPlayerPanel .unified-row-2:not(.unified-row-tags2) .row2-stats-slot {
    display: none !important;
  }

  #testPlayerPanel .unified-row-2:not(.unified-row-tags2) .row2-tags-home-slot {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
  }

  #testPlayerPanel .unified-row-2:not(.unified-row-tags2) .active-tags-row {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 5px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    width: 100% !important;
  }

  #testPlayerPanel .unified-row-2:not(.unified-row-tags2) .active-tag {
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 9px !important;
    font-size: 11px !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
  }

  /* Row 3 in Phones: Module & Course */
  #testPlayerPanel .unified-row-tags2 {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    padding: 2px 0 !important;
  }

  #testPlayerPanel .unified-row-tags2 .active-tags-row {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 5px !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
  }

  #testPlayerPanel .unified-row-tags2 .active-tag {
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    border-radius: 8px !important;
    flex: 1 1 auto !important;
    max-width: 50% !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Row 4 in Phones: Toolbar in 2 distinct rows */
  #testPlayerPanel .unified-row-3 {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100% !important;
    padding-top: 4px !important;
  }

  /* Row 1: purple box (8 icons) */
  #testPlayerPanel .unified-row-3 .toolbar-left {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100% !important;
  }

  /* Row 2: red box (7 icons) */
  #testPlayerPanel .unified-row-3 .toolbar-right {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100% !important;
  }

  /* Enlarged buttons on mobile */
  #testPlayerPanel .unified-row-3 .tool-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    max-width: 42px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
  }

  #testPlayerPanel .unified-row-3 .tool-btn i {
    font-size: 13.5px !important;
  }

  #testPlayerPanel .unified-row-3 .tool-btn.next-btn,
  #testPlayerPanel .unified-row-3 .tool-btn.prev-btn {
    width: 34px !important;
    min-width: 34px !important;
  }

  #testPlayerPanel .unified-row-3 #toolTranslate.tool-btn {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 0 8px !important;
    font-size: 12px !important;
  }

  #testPlayerPanel .unified-row-3 #toolTranslate.tool-btn i {
    font-size: 13px !important;
  }

  #testPlayerPanel .unified-row-3 #toolTranslate.tool-btn #translateBtnLabel {
    font-size: 12px !important;
    margin-left: 3px !important;
  }
}

/* Phones (<= 480px) */
@media (max-width: 480px) {
  #testPlayerPanel .unified-row-3 {
    gap: 5px !important;
    padding-top: 3px !important;
  }

  #testPlayerPanel .unified-row-3 .toolbar-left {
    gap: 4px !important;
  }

  #testPlayerPanel .unified-row-3 .toolbar-right {
    gap: 4.5px !important;
  }

  #testPlayerPanel .unified-row-3 .tool-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
  }

  #testPlayerPanel .unified-row-3 .tool-btn i {
    font-size: 12.5px !important;
  }

  #testPlayerPanel .unified-row-3 .tool-btn.next-btn,
  #testPlayerPanel .unified-row-3 .tool-btn.prev-btn {
    width: 32px !important;
    min-width: 32px !important;
  }

  #testPlayerPanel .unified-row-3 #toolTranslate.tool-btn {
    width: auto !important;
    min-width: 0 !important;
    padding: 0 6px !important;
    font-size: 11px !important;
  }

  #testPlayerPanel .unified-row-3 #toolTranslate.tool-btn i {
    font-size: 11px !important;
  }

  #testPlayerPanel .unified-row-3 #toolTranslate.tool-btn #translateBtnLabel {
    font-size: 10.5px !important;
    margin-left: 2px !important;
  }
}

/* ---- 5. Question meta: ONE single row below the last option, in every
         context (normal test, mode, phone); sizes adapt per context so the
         combined width always equals exactly one row ---- */
.question-card .question-meta {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  margin: 14px 0 0 0 !important;
  width: 100% !important;
}

.question-card .question-meta .question-info-inline {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  flex: 0 1 auto !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.question-card .question-meta .ratings {
  flex: 0 0 auto !important;
  flex-wrap: nowrap !important;
  gap: 10px !important;
}

.question-card .question-meta .question-lang-indicator {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  flex: 0 1 auto !important;
  min-width: 0 !important;
}

/* Mode sizes (QCM pane is 40%) */
body.mode-active-body .question-card .question-meta {
  gap: 5px !important;
  margin-top: 12px !important;
}

body.mode-active-body .question-card .question-meta .question-info-inline {
  font-size: 10px !important;
  padding: 5px 8px !important;
  gap: 5px !important;
}

body.mode-active-body .question-card .question-meta .ratings {
  font-size: 10px !important;
  gap: 7px !important;
}

body.mode-active-body .question-card .question-meta .rating-group {
  gap: 4px !important;
}

body.mode-active-body .question-card .question-meta .question-lang-indicator {
  font-size: 10px !important;
  padding: 5px 8px !important;
  gap: 4px !important;
}

/* Phone sizes (even smaller so the single row always fits) */
@media (max-width: 768px) {
  .question-card .question-meta {
    gap: 4px !important;
    margin-top: 10px !important;
  }

  .question-card .question-meta .question-info-inline {
    font-size: 9px !important;
    padding: 4px 6px !important;
    gap: 4px !important;
  }

  .question-card .question-meta .ratings {
    font-size: 9px !important;
    gap: 5px !important;
  }

  .question-card .question-meta .rating-group {
    gap: 3px !important;
  }

  .question-card .question-meta .ratings .stars {
    gap: 1px !important;
    font-size: 9px !important;
  }

  .question-card .question-meta .question-lang-indicator {
    font-size: 9px !important;
    padding: 4px 6px !important;
    gap: 3px !important;
  }
}
/* ==========================================================================
   HEADER POLISH — centered row 1, text tabs, full-width course tags,
   desktop-normal extras distribution, Instructions inline view, meta shrink
   ========================================================================== */

/* ---- Row 1: content CENTERED in the bar (no gaps) ---- */
body.mode-active-body .unified-row-1,
body.mode-active-body #testPlayerPanel .unified-row-1,
#testPlayerPanel .unified-row-1 {
  justify-content: center !important;
}

/* ---- View tabs with text labels (Instructions / QCM) ---- */
body.mode-active-body .row1-view-tab,
#testPlayerPanel .row1-view-tab {
  gap: 5px !important;
  padding: 0 10px !important;
  height: 100% !important;
  box-sizing: border-box !important;
}

body.mode-active-body .row1-view-tab span,
#testPlayerPanel .row1-view-tab span {
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

@media (max-width: 480px) {
  #testPlayerPanel .unified-row-1 {
    gap: 4px !important;
    padding-bottom: 3px !important;
    justify-content: center !important;
  }
  #testPlayerPanel .unified-row-1 .sidebar-timers-row {
    gap: 4px !important;
  }
  #testPlayerPanel .unified-row-1 .sidebar-timers-row .btn-icon-small {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    font-size: 10px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
  }
  #testPlayerPanel .unified-row-1 .sidebar-timers-row .timer-display {
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 6px !important;
    font-size: 10px !important;
    gap: 3px !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
  }
  #testPlayerPanel .unified-row-1 .row1-view-tabs {
    height: 30px !important;
    min-height: 30px !important;
    border-radius: 8px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }
  #testPlayerPanel .unified-row-1 .row1-view-tab {
    height: 100% !important;
    padding: 0 7px !important;
    gap: 3px !important;
    font-size: 10px !important;
    box-sizing: border-box !important;
  }
  #testPlayerPanel .unified-row-1 .row1-view-tab span {
    font-size: 9.5px !important;
  }
}

/* ---- Module & Course tags row: use the FULL row width so names show fully ---- */
.unified-row-tags2 {
  width: 100% !important;
}

.unified-row-tags2 .active-tags-row {
  width: 100% !important;
  max-width: 100% !important;
  justify-content: center !important;
  overflow: visible !important;
  gap: 6px !important;
}

.unified-row-tags2 .active-tag {
  flex: 1 1 0% !important;
  max-width: none !important;
  justify-content: center !important;
}

.unified-row-tags2 .active-tag .tag-text {
  overflow: visible !important;
  text-overflow: unset !important;
  white-space: normal !important;
  text-align: center !important;
  line-height: 1.25 !important;
}

/* ---- Row 2 slots (desktop normal): timers at far left, tags fill the middle,
       Stats QCM at far right — all in ONE row, no extra height ---- */
#row2TimersSlot:empty,
#row2StatsSlot:empty {
  display: none !important;
}

#row2TimersSlot,
#row2StatsSlot {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
}

.unified-row-2:has(#row2TimersSlot:not(:empty)),
.unified-row-2:has(#row2StatsSlot:not(:empty)) {
  justify-content: flex-start !important;
  gap: 8px !important;
}

.unified-row-2:has(#row2TimersSlot:not(:empty)) .active-tags-row,
.unified-row-2:has(#row2StatsSlot:not(:empty)) .active-tags-row {
  flex: 1 1 auto !important;
  justify-content: center !important;
}

/* Timers block when placed in the header row */
#row2TimersSlot .sidebar-timers-row {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  flex-wrap: nowrap !important;
}

#row2TimersSlot .sidebar-timers-row .timer-display {
  margin: 0 !important;
  flex: 0 0 auto !important;
  white-space: nowrap !important;
  padding: 3px 7px !important;
  font-size: 11px !important;
  gap: 4px !important;
}

#row2TimersSlot .sidebar-timers-row .btn-icon-small {
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  font-size: 11px !important;
  border-radius: 7px !important;
}

/* Stats QCM block when placed in the header row: compact horizontal chips */
#row2StatsSlot .sidebar-qcm-row {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

#row2StatsSlot .sidebar-qcm-row .compact-stats-title {
  display: none !important;
}

#row2StatsSlot .sidebar-qcm-row .compact-stats-grid {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  margin: 0 !important;
}

#row2StatsSlot .sidebar-qcm-row .compact-stat {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: baseline !important;
  gap: 4px !important;
  padding: 3px 8px !important;
  border-radius: 8px !important;
  background: var(--item-bg-hover) !important;
  white-space: nowrap !important;
}

#row2StatsSlot .sidebar-qcm-row .compact-stat .compact-lbl {
  margin-top: 0 !important;
}

#row2StatsSlot .sidebar-qcm-row .compact-stat .compact-val {
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

/* Stats chips height == filter chip height (30px) on desktop normal */
#row2StatsSlot .sidebar-qcm-row .compact-stat {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

#row2StatsSlot .sidebar-qcm-row .compact-stat .compact-lbl {
  font-size: 9px !important;
  font-weight: 700 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

#row2StatsSlot .sidebar-qcm-row .attempts-dropdown {
  position: absolute !important;
  top: calc(100% + 6px) !important;
  right: 0 !important;
}

#row2StatsSlot .sidebar-qcm-row {
  position: relative !important;
}

/* ---- Instructions view in mode (desktop): questions panel INLINE under the
       header (like the reference), question content hidden, panel fills the
       remaining height with its own internal scroll ---- */
/* Instructions view: questions panel INLINE under the header (desktop mode + all tablets and phones) */
  #testPlayerPanel.mobile-sidebar-open .player-workspace-scroll-area > *:not(.player-unified-header):not(.player-sidebar) {
    display: none !important;
  }

  #testPlayerPanel.mobile-sidebar-open .player-workspace-scroll-area > .player-sidebar {
    position: static !important;
    transform: none !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: none !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    z-index: auto !important;
    box-shadow: none !important;
    margin: 6px 0 0 0 !important;
    border-radius: 12px !important;
  }

/* ---- Question meta: shrink harder so every chip fits its row perfectly,
       no overflow, no text escaping its chip ---- */
body.mode-active-body .question-card .question-meta .question-info-inline {
  font-size: 9px !important;
  padding: 4px 7px !important;
  gap: 4px !important;
  max-width: 40% !important;
}

body.mode-active-body .question-card .question-meta .ratings {
  font-size: 9px !important;
  gap: 6px !important;
}

body.mode-active-body .question-card .question-meta .ratings .stars {
  font-size: 9px !important;
}

body.mode-active-body .question-card .question-meta .question-lang-indicator {
  font-size: 9px !important;
  padding: 4px 7px !important;
  gap: 4px !important;
  max-width: 32% !important;
}

@media (max-width: 768px) {
  .question-card .question-meta {
    gap: 6px !important;
    flex-wrap: wrap !important;
  }

  .question-card .question-meta .question-info-inline {
    font-size: 9.5px !important;
    padding: 4px 7px !important;
    gap: 4px !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }

  .question-card .question-meta .ratings {
    font-size: 9px !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
  }

  .question-card .question-meta .ratings .stars {
    font-size: 9px !important;
    gap: 1.5px !important;
  }

  .question-card .question-meta .question-lang-indicator {
    font-size: 9.5px !important;
    padding: 4px 7px !important;
    gap: 4px !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }
}

/* Desktop normal (wide, no mode): meta chips stay compact too */
@media (min-width: 901px) {
  body:not(.mode-active-body) .question-card .question-meta .question-info-inline {
    max-width: 42% !important;
  }

  body:not(.mode-active-body) .question-card .question-meta .question-lang-indicator {
    max-width: 30% !important;
  }
}
/* ==========================================================================
   DESKTOP NORMAL tags row 3: course (wide, left) + rot/year (compact, right)
   PHONE-MODE sheet stacking order: qcm stats > test stats > search > list
   ========================================================================== */

/* ---- Desktop normal only (wide, no mode): course wide + rot/year right ---- */
@media (min-width: 901px) {
  body:not(.mode-active-body) .unified-row-tags2 .active-tags-row {
    justify-content: flex-start !important;
  }

  body:not(.mode-active-body) .unified-row-tags2 .active-tag {
    flex: 0 0 auto !important;
    max-width: 200px !important;
  }

  body:not(.mode-active-body) .unified-row-tags2 .active-tag .tag-text {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    text-align: left !important;
  }

  body:not(.mode-active-body) .unified-row-tags2 .active-tag.tag-course-wide {
    flex: 1 1 auto !important;
    max-width: none !important;
    justify-content: flex-start !important;
  }

  body:not(.mode-active-body) .unified-row-tags2 .active-tag.tag-course-wide .tag-text {
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: normal !important;
    line-height: 1.25 !important;
  }
}

/* ---- Phone + mode sheet: stack qcm-stats, test-stats, search, list ---- */
@media (max-width: 900px) {
  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .player-sidebar-mobile-header {
    order: -1 !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .sidebar-timers-row {
    order: 0 !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .sidebar-qcm-row {
    order: 1 !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .sidebar-stats-row {
    order: 2 !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .search-bar-wrapper {
    order: 3 !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .questions-nav-list {
    order: 4 !important;
  }
}
/* ==========================================================================
   INSTRUCTIONS PANEL 2-COL LAYOUT (mode): test-stats | qcm-stats side by
   side on top, then search bar, then the instructions list at the bottom.
   Applies to the desktop inline panel AND the phone/tablet full-screen sheet.
   ========================================================================== */

/* ---- Desktop inline instructions panel: 2-col grid ---- */
/* Inline 2-col grid for instructions panel across all viewports */
  #testPlayerPanel.mobile-sidebar-open .player-workspace-scroll-area > .player-sidebar,
  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar,
  #testPlayerPanel.mobile-sidebar-open .player-sidebar {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto auto minmax(0, 1fr) !important;
    gap: 8px !important;
    align-content: start !important;
    position: static !important;
    transform: none !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: none !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 6px 0 0 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  #testPlayerPanel.mobile-sidebar-open .player-sidebar .sidebar-stats-row {
    grid-column: 1 !important;
    grid-row: 1 !important;
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  #testPlayerPanel.mobile-sidebar-open .player-sidebar .sidebar-qcm-row {
    grid-column: 2 !important;
    grid-row: 1 !important;
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  #testPlayerPanel.mobile-sidebar-open .player-sidebar .search-bar-wrapper {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  #testPlayerPanel.mobile-sidebar-open .player-sidebar .questions-nav-list,
  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .questions-nav-list {
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    height: auto !important;
    min-height: 180px !important;
    max-height: calc(100dvh - 310px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    contain: none !important;
    padding: 8px !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
  }

  #testPlayerPanel.mobile-sidebar-open .player-sidebar .questions-nav-list::-webkit-scrollbar,
  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .questions-nav-list::-webkit-scrollbar {
    width: 6px !important;
  }

  #testPlayerPanel.mobile-sidebar-open .player-sidebar .questions-nav-list::-webkit-scrollbar-thumb,
  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .questions-nav-list::-webkit-scrollbar-thumb {
    background: var(--border-color) !important;
    border-radius: 4px !important;
  }

  #testPlayerPanel.mobile-sidebar-open .player-sidebar .sidebar-timers-row,
  #testPlayerPanel.mobile-sidebar-open .player-sidebar .player-sidebar-mobile-header,
  #testPlayerPanel.mobile-sidebar-open .player-sidebar #timersHomeSlot {
    display: none !important;
  }


  /* Narrow 2-col stat cards: compact inner chips */
  #testPlayerPanel.mobile-sidebar-open .player-workspace-scroll-area > .player-sidebar .compact-stats-grid {
    gap: 4px !important;
  }

  #testPlayerPanel.mobile-sidebar-open .player-workspace-scroll-area > .player-sidebar .compact-stat {
    padding: 5px 2px !important;
  }

  #testPlayerPanel.mobile-sidebar-open .player-workspace-scroll-area > .player-sidebar .compact-val {
    font-size: 14px !important;
  }

  #testPlayerPanel.mobile-sidebar-open .player-workspace-scroll-area > .player-sidebar .compact-lbl {
    font-size: 8px !important;
  }

  #testPlayerPanel.mobile-sidebar-open .player-workspace-scroll-area > .player-sidebar .compact-stats-title,
  #testPlayerPanel.mobile-sidebar-open .player-workspace-scroll-area > .player-sidebar .compact-stats-subtitle {
    font-size: 9px !important;
  }

/* ---- Phone/tablet full-screen sheet: same 2-col grid ---- */
@media (max-width: 900px) {
  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto auto auto auto minmax(0, 1fr) !important;
    gap: 8px !important;
    align-content: start !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .player-sidebar-mobile-header {
    display: flex !important;
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    margin: 0 !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .sidebar-timers-row {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    margin: 0 !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .sidebar-stats-row {
    grid-column: 1 !important;
    grid-row: 3 !important;
    margin: 0 !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .sidebar-qcm-row {
    grid-column: 2 !important;
    grid-row: 3 !important;
    margin: 0 !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .search-bar-wrapper {
    grid-column: 1 / -1 !important;
    grid-row: 4 !important;
    margin: 0 !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .questions-nav-list {
    grid-column: 1 / -1 !important;
    grid-row: 5 !important;
    max-height: calc(100dvh - 260px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Narrow 2-col stat cards: compact inner chips */
  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .compact-stats-grid {
    gap: 4px !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .compact-stat {
    padding: 5px 2px !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .compact-val {
    font-size: 14px !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .compact-lbl {
    font-size: 8px !important;
  }

  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .compact-stats-title,
  body.mode-active-body #testPlayerPanel.mobile-sidebar-open .player-sidebar .compact-stats-subtitle {
    font-size: 9px !important;
  }
}
/* ==========================================================================
   DESKTOP NORMAL row 2: [number + faculte (far left)] [timers stretched in
   the middle] [stats (right)] — timers height == filter chip height (30px)
   ========================================================================== */
@media (min-width: 901px) {
  body:not(.mode-active-body) .unified-row-2:has(#row2TimersSlot:not(:empty)) .active-tags-row {
    flex: 0 0 auto !important;
  }

  body:not(.mode-active-body) .unified-row-2 .active-tags-row {
    order: 0 !important;
  }

  body:not(.mode-active-body) .unified-row-2 #row2TimersSlot {
    order: 1 !important;
    flex: 1 1 auto !important;
    display: flex !important;
  }

  body:not(.mode-active-body) .unified-row-2 #row2StatsSlot {
    order: 2 !important;
  }

  body:not(.mode-active-body) #row2TimersSlot .sidebar-timers-row {
    flex: 1 1 auto !important;
  }

  body:not(.mode-active-body) #row2TimersSlot .sidebar-timers-row .timer-display {
    flex: 1 1 auto !important;
    height: 30px !important;
    box-sizing: border-box !important;
  }

  body:not(.mode-active-body) #row2TimersSlot .sidebar-timers-row .btn-icon-small {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    font-size: 12px !important;
    flex: 0 0 auto !important;
  }
}

/* ==========================================================================
   ANSWER SUMMARY BADGE & SOLUTION EDIT POPOVER
   ========================================================================== */
.qcm-answer-summary-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  flex-shrink: 0;
}

.qcm-answer-summary-badge {
  font-family: var(--font-heading, inherit);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: inline-flex;
  align-items: center;
  box-shadow: none;
  text-shadow: none;
}

[data-theme="light"] .qcm-answer-summary-badge {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: none;
  text-shadow: none;
}

.qcm-answer-summary-badge .letter-correct {
  color: #10b981;
  font-weight: 800;
}

.qcm-answer-summary-badge .letter-missed {
  color: #f59e0b;
  font-weight: 800;
}

.qcm-answer-summary-badge .letter-wrong {
  color: #ef4444;
  font-weight: 800;
}

.qcm-answer-summary-badge .letter-slash {
  color: #94a3b8;
  margin: 0 4px;
  font-weight: 600;
}

.qcm-answer-summary-badge .letter-none {
  color: #94a3b8;
  font-weight: 700;
}

.btn-edit-solution {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.2s ease;
}

.btn-edit-solution:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #fff;
  transform: scale(1.08);
}

.solution-edit-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 200;
  animation: slideDown 0.18s ease-out;
}

[data-theme="light"] .solution-edit-popover {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.solution-edit-popover .popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
}

[data-theme="light"] .solution-edit-popover .popover-header {
  color: #1e293b;
}

.solution-edit-popover .popover-close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
}

.solution-edit-popover .popover-letters {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 12px;
}

.solution-edit-popover .popover-letter-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-theme="light"] .solution-edit-popover .popover-letter-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

.solution-edit-popover .popover-letter-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
}

.solution-edit-popover .popover-letter-btn.active {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.solution-edit-popover .popover-actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.solution-edit-popover .popover-btn-reset {
  flex: 1;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
}

[data-theme="light"] .solution-edit-popover .popover-btn-reset {
  border-color: #cbd5e1;
  color: #64748b;
}

.solution-edit-popover .popover-btn-reset:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
}

.solution-edit-popover .popover-btn-save {
  flex: 1;
  padding: 6px 8px;
  border-radius: 7px;
  border: none;
  background: #0284c7;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.solution-edit-popover .popover-btn-save:hover {
  background: #0369a1;
}

/* ==========================================================================
   SIDEBAR FULLSCREEN & COMPACT CONTROLS
   ========================================================================== */
.profile-actions-row {
  display: flex !important;
  align-items: center !important;
  gap: 3.5px !important;
  flex-wrap: nowrap !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.btn-accounts-toggle {
  height: 25px !important;
  min-height: 25px !important;
  max-height: 25px !important;
  padding: 0 6px !important;
  font-size: 9.5px !important;
  gap: 3.5px !important;
  overflow: hidden !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

.btn-accounts-toggle span {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  min-width: 0 !important;
}

.profile-action-btn,
.fullscreen-toggle-btn {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  max-width: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  font-size: 10px !important;
  border-radius: 7px !important;
  flex: 0 0 24px !important;
}

/* ==========================================================================
   COMMENTS FORMATTING TOOLBAR & COLOR PALETTE
   ========================================================================== */
.comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  position: relative;
}

.comments-format-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 auto 0 12px;
}

.comment-tool-combo {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .comment-tool-combo {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.comment-tool-combo:hover,
.comment-tool-combo.popover-open {
  background: rgba(56, 189, 248, 0.1);
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.22);
}

.btn-comment-tool-single {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  padding: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .btn-comment-tool-single {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.btn-comment-tool-single:hover,
.btn-comment-tool-single.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.22);
}

.btn-comment-tool-main {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  padding: 0 0 4px 0;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 11px;
  transition: color 0.15s ease;
  border-top-left-radius: 7px;
  border-bottom-left-radius: 7px;
}

[data-theme="light"] .btn-comment-tool-main {
  color: #475569;
}

.btn-comment-tool-main:hover {
  color: #38bdf8;
}

.tool-color-bar {
  position: absolute;
  bottom: 2px;
  left: 4px;
  right: 4px;
  height: 3px;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.btn-comment-tool-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 27px;
  padding: 0;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  color: #64748b;
  cursor: pointer;
  font-size: 8px;
  transition: all 0.15s ease;
  border-top-right-radius: 7px;
  border-bottom-right-radius: 7px;
}

[data-theme="light"] .btn-comment-tool-caret {
  border-left-color: #e2e8f0;
  color: #94a3b8;
}

.btn-comment-tool-caret:hover,
.comment-tool-combo.popover-open .btn-comment-tool-caret {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

/* Tool Popover Menu */
.comment-tool-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 180px;
  padding: 8px 10px;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6), 0 0 15px rgba(56, 189, 248, 0.15);
  z-index: 1000;
  animation: pnsPopoverFade 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .comment-tool-popover {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
}

@keyframes pnsPopoverFade {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(0.96); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.popover-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  margin-bottom: 7px;
  text-align: center;
}

[data-theme="light"] .popover-title {
  color: #64748b;
}

.popover-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 8px;
}

.popover-swatches .color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

[data-theme="light"] .popover-swatches .color-swatch {
  border-color: rgba(0, 0, 0, 0.15);
}

.popover-swatches .color-swatch:hover {
  transform: scale(1.28);
  border-color: #ffffff;
  box-shadow: 0 0 8px currentColor;
}

[data-theme="light"] .popover-swatches .color-swatch:hover {
  border-color: #0f172a;
}

.popover-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .popover-actions {
  border-top-color: #e2e8f0;
}

.custom-color-picker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #38bdf8;
  cursor: pointer;
  position: relative;
  font-size: 11px;
  transition: all 0.15s ease;
}

[data-theme="light"] .custom-color-picker-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0284c7;
}

.custom-color-picker-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
}

.custom-color-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
}

.popover-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #ef4444;
  cursor: pointer;
  transition: all 0.15s ease;
}

.popover-clear-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
}

@media (max-width: 480px) {
  .comments-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .comments-format-toolbar {
    margin: 0;
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }
  .comments-counter {
    margin-left: auto;
  }
  .comment-tool-combo:first-child .comment-tool-popover {
    left: 0;
    transform: none;
  }
  .comment-tool-combo:last-child .comment-tool-popover {
    left: auto;
    right: 0;
    transform: none;
  }
}

/* ==========================================================================
   IMAGE 3: PREVENT HEADER CHIPS & BUTTONS FROM MOVING/JUMPING ON CLICK/TOUCH
   ========================================================================== */
.unified-row-1 button,
.unified-row-1 .compact-stat,
.unified-row-2 button,
.unified-row-2 .active-tag,
.unified-row-2 .compact-stat,
.unified-row-tags2 .active-tag,
.active-tags-row .active-tag,
.active-tags-row button,
.active-tag,
.active-tag.clickable-tag,
.compact-stat,
.compact-stat.clickable,
#qcmAttemptsBtn,
.row1-view-tab,
.row1-timers-slot *,
.row2-timers-slot *,
.row2-stats-slot * {
  transform: none !important;
}

.unified-row-1 button:hover,
.unified-row-1 button:active,
.unified-row-1 button:focus,
.unified-row-2 button:hover,
.unified-row-2 button:active,
.unified-row-2 button:focus,
.unified-row-2 .active-tag:hover,
.unified-row-2 .active-tag:active,
.unified-row-2 .active-tag:focus,
.unified-row-tags2 .active-tag:hover,
.unified-row-tags2 .active-tag:active,
.unified-row-tags2 .active-tag:focus,
.active-tags-row .active-tag:hover,
.active-tags-row .active-tag:active,
.active-tags-row .active-tag:focus,
.active-tag.clickable-tag:hover,
.active-tag.clickable-tag:active,
.active-tag.clickable-tag:focus,
.compact-stat:hover,
.compact-stat:active,
.compact-stat:focus,
.compact-stat.clickable:hover,
.compact-stat.clickable:active,
.compact-stat.clickable:focus,
#qcmAttemptsBtn:hover,
#qcmAttemptsBtn:active,
#qcmAttemptsBtn:focus {
  transform: none !important;
}

/* ==========================================================================
   PEN MODE: SELECTION & HIGHLIGHTING FOR OPTIONS / PROPOSITIONS
   ========================================================================== */
#toolToggleOptionPen.active {
  background: rgba(37, 99, 235, 0.22) !important;
  color: #2563eb !important;
  border-color: #2563eb !important;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.45) !important;
}

.pen-mode-active .option-item {
  cursor: text !important;
}

.pen-mode-active .option-item .option-text {
  user-select: text !important;
  -webkit-user-select: text !important;
  cursor: text !important;
  pointer-events: auto !important;
}

.pen-mode-active .option-item[disabled] {
  pointer-events: auto !important;
}

.pen-mode-active .option-item[disabled] .option-text {
  pointer-events: auto !important;
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* ==========================================================================
   PNS GUIDE & STRATÉGIES PANELS STYLING (ULTRA-MODERN, AESTHETIC & ZERO MOVEMENT)
   ========================================================================== */
#guidePanel,
#strategiesPanel {
  display: none;
  width: 100%;
}

#guidePanel.active,
#strategiesPanel.active {
  display: block;
  animation: pnsPanelFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pnsPanelFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.pns-modern-panel-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 16px 20px 80px;
  box-sizing: border-box;
  width: 100%;
}

/* Header Bar - Ultra-Modern Glassmorphic Look */
.pns-modern-header {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
  border-radius: 18px;
  padding: 22px 26px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.pns-modern-header::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 250px;
  height: 100%;
  background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.pns-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 12px;
  border-radius: 99px;
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.2);
  margin-bottom: 8px;
  width: fit-content;
}

.pns-live-indicator.indicator-amber {
  color: #d97706;
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.25);
}

.pns-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.pns-modern-title {
  font-size: 24px;
  font-weight: 850;
  color: var(--text-primary, #0f172a);
  margin: 0 0 6px;
  letter-spacing: -0.4px;
}

.pns-modern-sub {
  font-size: 14px;
  color: var(--text-secondary, #64748b);
  margin: 0;
  line-height: 1.5;
  max-width: 850px;
}

/* Toolbar & Filter Pills */
.pns-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 6px;
}

.pns-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border-color, rgba(0, 0, 0, 0.12));
  border-radius: 99px;
  padding: 0 16px;
  height: 38px;
  flex: 1 1 280px;
  max-width: 460px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.pns-search-box:focus-within {
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.pns-search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 13px;
  color: var(--text-primary, #0f172a);
}

.pns-search-box i {
  color: #2563eb;
  font-size: 13px;
}

.pns-filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pns-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
  background: var(--bg-card, #ffffff);
  color: var(--text-secondary, #64748b);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease !important;
  transform: none !important;
}

.pns-pill-btn:hover {
  border-color: #2563eb !important;
  color: #2563eb !important;
  background: rgba(37, 99, 235, 0.05) !important;
  transform: none !important;
}

.pns-pill-btn.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28) !important;
  transform: none !important;
}

/* Modern Dense Grids */
.pns-dense-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  width: 100%;
}

.pns-dense-grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 16px;
  width: 100%;
}

/* Cards (Strictly ZERO movement, luminous color & lighting animations only) */
.pns-guide-card,
.pns-strat-card {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 4px 12px -2px rgba(0, 0, 0, 0.03);
  box-sizing: border-box;
  width: 100%;
  min-height: 100%;
  position: relative;
  overflow: hidden;
  transform: none !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease !important;
}

.pns-guide-card::before,
.pns-strat-card::before {
  content: '';
  position: absolute;
  top: -24px;
  right: -24px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.pns-guide-card:hover,
.pns-strat-card:hover {
  transform: none !important;
  border-color: #2563eb !important;
  box-shadow: 0 0 0 1.5px #2563eb, 0 10px 28px -4px rgba(37, 99, 235, 0.16) !important;
  background-color: var(--bg-card, #ffffff) !important;
}

.pns-guide-card:hover::before,
.pns-strat-card:hover::before {
  opacity: 1;
}

/* Modern Card Squircle Icons */
.pns-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.pns-card-ico {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 4px 14px var(--ico-shadow, rgba(37, 99, 235, 0.28));
  transition: box-shadow 0.2s ease, filter 0.2s ease;
}

.pns-guide-card:hover .pns-card-ico {
  filter: brightness(1.12);
  box-shadow: 0 0 20px var(--ico-shadow, rgba(37, 99, 235, 0.45)) !important;
}

.pns-card-ico.bg-blue {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --ico-shadow: rgba(37, 99, 235, 0.35);
}
.pns-card-ico.bg-purple {
  background: linear-gradient(135deg, #a855f7 0%, #6d28d9 100%);
  --ico-shadow: rgba(139, 92, 246, 0.35);
}
.pns-card-ico.bg-amber {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  --ico-shadow: rgba(245, 158, 11, 0.35);
}
.pns-card-ico.bg-rose {
  background: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
  --ico-shadow: rgba(244, 63, 94, 0.35);
}
.pns-card-ico.bg-emerald {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  --ico-shadow: rgba(16, 185, 129, 0.35);
}
.pns-card-ico.bg-cyan {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  --ico-shadow: rgba(6, 182, 212, 0.35);
}
.pns-card-ico.bg-yellow {
  background: linear-gradient(135deg, #facc15 0%, #ca8a04 100%);
  --ico-shadow: rgba(234, 179, 8, 0.35);
}
.pns-card-ico.bg-red {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  --ico-shadow: rgba(239, 68, 68, 0.35);
}

.pns-card-head-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-grow: 1;
  min-width: 0;
}

.pns-card-head-info h4,
.pns-strat-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary, #0f172a);
  line-height: 1.35;
}

.pns-tag {
  font-size: 10.5px;
  font-weight: 750;
  padding: 2.5px 8px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.pns-tag.tag-blue { background: rgba(37, 99, 235, 0.08); color: #2563eb; }
.pns-tag.tag-purple { background: rgba(139, 92, 246, 0.1); color: #7c3aed; }
.pns-tag.tag-amber { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.pns-tag.tag-rose { background: rgba(244, 63, 94, 0.1); color: #e11d48; }
.pns-tag.tag-emerald { background: rgba(16, 185, 129, 0.1); color: #059669; }
.pns-tag.tag-cyan { background: rgba(6, 182, 212, 0.1); color: #0891b2; }
.pns-tag.tag-yellow { background: rgba(234, 179, 8, 0.12); color: #b45309; }
.pns-tag.tag-red { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

.pns-card-txt,
.pns-strat-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary, #475569);
  margin: 0 0 14px;
  flex-grow: 1;
}

.pns-card-txt strong,
.pns-strat-desc strong {
  color: var(--text-primary, #0f172a);
  font-weight: 700;
}

.pns-card-foot {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.06));
  padding-top: 10px;
  margin-top: auto;
  transition: color 0.15s ease;
}

.pns-guide-card:hover .pns-card-foot {
  color: #2563eb;
}

.pns-strat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.pns-strat-num {
  font-size: 13px;
  font-weight: 900;
  font-family: monospace, var(--font-heading);
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.18);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.pns-strat-card:hover .pns-strat-num {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  box-shadow: 0 0 14px rgba(37, 99, 235, 0.45) !important;
}

.pns-strat-action {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary, #1e293b);
  background: rgba(37, 99, 235, 0.04);
  border-left: 3.5px solid #2563eb;
  border-radius: 0 8px 8px 0;
  padding: 8px 12px;
  margin-top: auto;
  display: flex;
  align-items: baseline;
  gap: 6px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.pns-strat-card:hover .pns-strat-action {
  background: rgba(37, 99, 235, 0.09);
}

.pns-strat-action i {
  color: #2563eb;
  flex-shrink: 0;
}

/* Dark Mode Enhancements */
[data-theme="dark"] .pns-modern-header,
[data-theme="dark"] .pns-guide-card,
[data-theme="dark"] .pns-strat-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .pns-guide-card:hover,
[data-theme="dark"] .pns-strat-card:hover {
  background: #1e293b !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 1.5px #3b82f6, 0 8px 24px -2px rgba(59, 130, 246, 0.22) !important;
}

[data-theme="dark"] .pns-modern-title,
[data-theme="dark"] .pns-card-head-info h4,
[data-theme="dark"] .pns-strat-title,
[data-theme="dark"] .pns-card-txt strong,
[data-theme="dark"] .pns-strat-desc strong {
  color: #f8fafc;
}

[data-theme="dark"] .pns-modern-sub,
[data-theme="dark"] .pns-card-txt,
[data-theme="dark"] .pns-strat-desc {
  color: #94a3b8;
}

[data-theme="dark"] .pns-search-box {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .pns-search-box:focus-within {
  background: #0f172a;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .pns-search-box input {
  color: #f8fafc;
}

[data-theme="dark"] .pns-pill-btn {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}

[data-theme="dark"] .pns-pill-btn:hover {
  border-color: #3b82f6 !important;
  color: #3b82f6 !important;
  background: rgba(59, 130, 246, 0.1) !important;
}

[data-theme="dark"] .pns-pill-btn.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  color: #ffffff !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35) !important;
}

[data-theme="dark"] .pns-card-foot {
  border-top-color: rgba(255, 255, 255, 0.06);
  color: #64748b;
}

[data-theme="dark"] .pns-strat-action {
  background: rgba(37, 99, 235, 0.14);
  color: #e2e8f0;
}

[data-theme="dark"] .pns-strat-num {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.3);
}

/* Responsive Layout */
@media (max-width: 900px) {
  .pns-dense-grid-2col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .pns-modern-panel-container {
    padding: 12px 10px 80px;
  }
  .pns-modern-header {
    padding: 16px;
    margin-bottom: 14px;
    border-radius: 14px;
  }
  .pns-modern-title {
    font-size: 19px;
  }
  .pns-search-box {
    max-width: 100%;
    flex: 1 1 100%;
  }
  .pns-dense-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .pns-dense-grid-2col {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .pns-guide-card,
  .pns-strat-card {
    padding: 14px 16px;
    border-radius: 14px;
  }
}

/* ==========================================================================
   AI PROMPTS GENERATOR & COURSE CSV MANAGER STYLES
   ========================================================================== */

/* Header AI Prompts Button */
.btn-header-ai-prompts {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(147, 51, 234, 0.15));
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-header-ai-prompts:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(147, 51, 234, 0.28));
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

/* Tree CSV Manage Button on Course Rows */
.btn-tree-csv-manage {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #10b981;
  cursor: pointer;
  transition: all 0.18s ease;
  margin-right: 6px;
}
.btn-tree-csv-manage:hover {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
  transform: translateY(-1px);
}
.btn-tree-csv-manage.has-csv {
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
}

/* AI Prompts Modal Styling */
.pns-prompts-modal-card {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 16px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.prompt-lang-toggle-group {
  display: inline-flex;
  background: var(--bg-input, rgba(0,0,0,0.04));
  border: 1px solid var(--border-color, #e2e8f0);
  padding: 3px;
  border-radius: 99px;
  gap: 3px;
}
.prompt-lang-btn {
  border: none;
  background: transparent;
  padding: 4px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
}
.prompt-lang-btn.active {
  background: var(--primary, #3b82f6);
  color: #fff;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
}

.prompts-tabs-scroll-wrapper {
  overflow-x: auto;
  padding-bottom: 4px;
}
.prompts-tabs-scroll-wrapper::-webkit-scrollbar {
  height: 4px;
}
.prompts-tabs-scroll-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-color, #cbd5e1);
  border-radius: 4px;
}

.prompts-type-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: max-content;
}
.prompts-group-tag {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.prompt-type-tab {
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-card, #ffffff);
  color: var(--text-main, #0f172a);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.prompt-type-tab:hover {
  border-color: var(--primary, #3b82f6);
  color: var(--primary, #3b82f6);
}
.prompt-type-tab.active {
  background: var(--primary, #3b82f6);
  color: #fff;
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.prompt-info-pill-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.prompt-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-muted, #64748b);
  border: 1px solid var(--border-color, #e2e8f0);
}
[data-theme="dark"] .prompt-badge-pill {
  background: rgba(255, 255, 255, 0.06);
}

.prompt-editor-wrapper {
  width: 100%;
}
.prompt-editor-textarea {
  width: 100%;
  height: 380px;
  box-sizing: border-box;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.55;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--bg-input, #f8fafc);
  color: var(--text-main, #0f172a);
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.prompt-editor-textarea:focus {
  outline: none;
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.btn-prompt-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  border: 1px solid transparent;
}
.btn-prompt-reset {
  background: transparent;
  color: var(--text-muted, #64748b);
  border-color: var(--border-color, #cbd5e1);
}
.btn-prompt-reset:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-prompt-save {
  background: var(--bg-card, #fff);
  color: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
}
.btn-prompt-save:hover {
  background: rgba(59, 130, 246, 0.08);
}
.btn-prompt-copy {
  background: var(--primary, #3b82f6);
  color: #fff;
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}
.btn-prompt-copy:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

/* Course CSV Manager Modal */
.pns-csv-manager-card {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 16px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.csv-upload-dropzone {
  border: 2px dashed rgba(16, 185, 129, 0.4);
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.03);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.csv-upload-dropzone:hover {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  transform: translateY(-1px);
}
.dropzone-icon {
  font-size: 32px;
  color: #10b981;
  margin-bottom: 6px;
}
.dropzone-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main, #0f172a);
}
.dropzone-sub {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  margin-top: 3px;
}

.csv-total-questions-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.csv-files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 2px;
}
.csv-file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color, #e2e8f0);
  transition: all 0.15s ease;
}
.csv-file-card:hover {
  border-color: #10b981;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.csv-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.csv-file-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #10b981;
  font-size: 15px;
  flex-shrink: 0;
}
.csv-file-name-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.csv-file-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.csv-file-meta {
  font-size: 11px;
  color: var(--text-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
}
.csv-file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.csv-file-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: transparent;
  color: var(--text-muted, #64748b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.csv-file-btn:hover {
  color: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
  background: rgba(59, 130, 246, 0.08);
}
.csv-file-btn.btn-delete-csv:hover {
  color: #ef4444;
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.csv-rename-input {
  font-size: 13px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--primary, #3b82f6);
  background: var(--bg-input, #f8fafc);
  color: var(--text-main, #0f172a);
  width: 85%;
}

/* Module card open expand-icon rotation */
.tree-module-card.open > .tree-row > .expand-icon,
.tree-module-card.open > .tree-module-row > .expand-icon {
  transform: rotate(180deg);
}

/* ========================================================
   SECTION PROMPTS IA INTÉGRÉE DANS L'ONGLET (QCMS AI & FLASHCARDS AI)
   ======================================================== */
.ai-prompts-tab-section {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  transition: all 0.25s ease;
}

[data-theme="dark"] .ai-prompts-tab-section {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.ai-prompts-tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.ai-prompts-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.ai-prompts-title-text-wrap {
  min-width: 0;
  flex: 1;
}

.ai-prompts-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(99, 102, 241, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary, #3b82f6);
  font-size: 16px;
  flex-shrink: 0;
}

.ai-prompts-icon-badge.fc {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.18), rgba(245, 158, 11, 0.25));
  color: #eab308;
}

.ai-prompts-section-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-main, #0f172a);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-prompts-section-subtitle {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--text-muted, #64748b);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-prompts-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-toggle-prompts-body {
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-card, #ffffff);
  color: var(--text-main, #0f172a);
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-toggle-prompts-body:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: var(--primary, #3b82f6);
  color: var(--primary, #3b82f6);
}

.ai-prompts-tab-body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color, #e2e8f0);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 3-Column Equal Grid for Prompts Pills */
.ai-prompts-pills-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}

.prompt-type-tab {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  padding: 7px 4px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-card, #ffffff);
  color: var(--text-main, #0f172a);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.prompt-type-tab .pill-short-label {
  display: none;
}

.ai-prompts-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding-top: 2px;
}

.ai-prompts-actions-right {
  display: flex;
  gap: 8px;
}

/* Mobile Responsiveness for AI Prompts Tab Section */
@media (max-width: 580px) {
  .ai-prompts-tab-section {
    padding: 10px 12px;
    margin-bottom: 12px;
  }

  .ai-prompts-tab-header {
    flex-wrap: wrap;
    gap: 8px 10px;
  }

  .ai-prompts-title-wrap {
    flex: 1 1 100%;
    gap: 8px;
  }

  .ai-prompts-icon-badge {
    width: 30px;
    height: 30px;
    font-size: 14px;
    border-radius: 8px;
  }

  .ai-prompts-section-title {
    font-size: 13.5px;
  }

  .ai-prompts-section-subtitle {
    font-size: 11px;
  }

  .ai-prompts-header-controls {
    width: 100%;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px dashed var(--border-color, #e2e8f0);
  }

  .prompt-lang-toggle-group {
    padding: 2px;
    gap: 2px;
  }

  .prompt-lang-btn {
    padding: 3px 9px;
    font-size: 11px;
  }

  .btn-toggle-prompts-body {
    padding: 4px 10px;
    font-size: 11.5px;
  }

  .ai-prompts-pills-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }

  .prompt-type-tab {
    font-size: 11.5px;
    padding: 6px 2px;
  }

  .prompt-type-tab .pill-full-label {
    display: none;
  }

  .prompt-type-tab .pill-short-label {
    display: inline;
  }

  .prompt-editor-textarea {
    height: 220px;
    font-size: 12px;
    padding: 10px;
  }

  /* Action buttons: Icon-only on mobile */
  .ai-prompts-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
  }

  .ai-prompts-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .btn-prompt-action {
    height: 38px;
    min-width: 44px;
    padding: 0 14px;
    border-radius: 9px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex-shrink: 0;
  }

  .btn-prompt-action i {
    font-size: 16px;
    margin: 0 !important;
  }

  .btn-prompt-action span {
    display: none !important;
  }

  .btn-prompt-copy {
    min-width: 54px;
  }
}





/* Study Mode responsive scaling for Actions Bar */
body.mode-active-body .qcm-actions-bar {
  gap: 8px !important;
  margin-top: 14px !important;
  margin-bottom: 10px !important;
}

body.mode-active-body .qcm-nav-btn {
  height: 32px !important;
  min-height: 32px !important;
  padding: 6px 14px !important;
  font-size: 11px !important;
  gap: 5px !important;
  border-radius: 8px !important;
}

body.mode-active-body .qcm-nav-btn.btn-verify,
body.mode-active-body #toolVerify.qcm-nav-btn {
  padding: 6px 18px !important;
}

body.mode-active-body .qcm-meta-divider {
  margin: 8px 0 10px 0 !important;
}

body.mode-active-body .question-card .question-meta .question-info-inline,
body.mode-active-body .question-card .question-meta .question-lang-indicator {
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
  font-weight: 800 !important;
}

body.mode-active-body .question-card .question-meta .question-info-inline i,
body.mode-active-body .question-card .question-meta .question-lang-indicator i {
  color: var(--primary) !important;
  font-size: 11px !important;
}

@media (max-width: 768px) {
  .qcm-actions-bar {
    gap: 6px !important;
    margin-top: 12px !important;
    margin-bottom: 8px !important;
  }

  .qcm-nav-btn {
    height: 32px !important;
    min-height: 32px !important;
    padding: 6px 12px !important;
    font-size: 11px !important;
    gap: 4px !important;
    border-radius: 8px !important;
  }

  .qcm-nav-btn.btn-verify,
  #toolVerify.qcm-nav-btn {
    padding: 6px 16px !important;
  }

  .qcm-meta-divider {
    margin: 8px 0 10px 0 !important;
  }

  .question-card .question-meta .question-info-inline,
  .question-card .question-meta .question-lang-indicator {
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    font-weight: 800 !important;
  }

  .question-card .question-meta .question-info-inline i,
  .question-card .question-meta .question-lang-indicator i {
    color: var(--primary) !important;
    font-size: 10px !important;
  }
}

/* ==========================================================================
   BTN CSV UPDATE & ROTATING SPINNER INDICATOR
   ========================================================================== */
.btn-csv-update {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(6, 182, 212, 0.08));
  color: var(--primary, #2563eb);
  border: 1px solid rgba(37, 99, 235, 0.25);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-csv-update:hover {
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  color: #fff !important;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
  transform: translateY(-1px);
}

.btn-csv-update:active {
  transform: translateY(0);
}

.btn-csv-update .pns-update-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: inherit;
  margin-left: 2px;
}

.btn-csv-update.updating {
  pointer-events: none;
  opacity: 0.85;
}

[data-theme="dark"] .btn-csv-update {
 background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(20, 184, 166, 0.15));
 color: #60a5fa;
 border-color: rgba(96, 165, 250, 0.35);
}

[data-theme="dark"] .btn-csv-update:hover {
 background: linear-gradient(135deg, #3b82f6, #06b6d4);
 color: #fff !important;
}

/* CP (Correction Proposée) & CT (Cahier de Test) Badges in Test Player */
.qcm-answer-summary-badge .letter-corr-type {
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  margin-right: 4px;
  letter-spacing: 0.5px;
  display: inline-block;
  vertical-align: middle;
  line-height: 1.25;
  text-transform: uppercase;
}

.qcm-answer-summary-badge .letter-corr-type.is-cp {
  background: rgba(234, 88, 12, 0.15);
  color: #ea580c;
  border: 1px solid rgba(234, 88, 12, 0.35);
}

.qcm-answer-summary-badge .letter-corr-type.is-ct {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.35);
}


/* ========================================================
   Suivi PNS Smart Sync Panel (QCMs PNS → Tâches des cours)
   ======================================================== */
.suivi-sync-panel {
  margin: 10px 12px 4px 12px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.08) 0%, rgba(37, 99, 235, 0.06) 100%);
  border: 1.5px solid rgba(15, 118, 110, 0.25);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.suivi-sync-panel:has(#suiviSyncEnabled:checked) {
  border-color: rgba(15, 118, 110, 0.55);
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12) 0%, rgba(37, 99, 235, 0.08) 100%);
}
.suivi-sync-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  user-select: none;
}
.suivi-sync-header i:first-child {
  color: #0f766e;
  font-size: 14px;
  flex-shrink: 0;
}
.suivi-sync-header span {
  flex: 1;
  color: var(--text-primary, #1e293b);
  font-size: 13px;
  font-weight: 600;
}
/* Toggle switch */
.suivi-sync-toggle-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.suivi-sync-toggle-label input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.suivi-sync-toggle-slider {
  width: 36px;
  height: 20px;
  background: #cbd5e1;
  border-radius: 20px;
  transition: background 0.25s;
  position: relative;
}
.suivi-sync-toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.suivi-sync-toggle-label input:checked ~ .suivi-sync-toggle-slider {
  background: #0f766e;
}
.suivi-sync-toggle-label input:checked ~ .suivi-sync-toggle-slider::after {
  transform: translateX(16px);
}
/* Options area */
.suivi-sync-options {
  padding: 0 14px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.suivi-sync-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.suivi-sync-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}
.suivi-sync-field label i {
  color: #0f766e;
  font-size: 12px;
}
#suiviSyncCoucheSelect {
  flex: 1;
  min-width: 180px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--border-color, #e2e8f0);
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1e293b);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
#suiviSyncCoucheSelect:focus {
  border-color: #0f766e;
}
.suivi-sync-info {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11.5px;
  color: #0f766e;
  background: rgba(15, 118, 110, 0.07);
  border-radius: 7px;
  padding: 6px 10px;
  line-height: 1.4;
}
.suivi-sync-info i {
  margin-top: 1px;
  flex-shrink: 0;
}
.suivi-sync-warning {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11.5px;
  color: #b45309;
  background: rgba(180, 83, 9, 0.08);
  border-radius: 7px;
  padding: 6px 10px;
  line-height: 1.4;
}
.suivi-sync-warning i {
  margin-top: 1px;
  flex-shrink: 0;
}
/* Hide sync panel in mode examen / residanat views */
.mode-examen-view .suivi-sync-panel,
.residanat-view .suivi-sync-panel {
  display: none;
}


/* Glassmorphic Modal Base (used by qcmLoadingModal, examDetailsModal, modalAiPrompts, modalCourseCsvManager) */
.pdf-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.pdf-modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.pdf-modal-card {
  width: 90%;
  max-width: 480px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.4));
  border-radius: 20px;
  padding: 25px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

.pdf-modal-overlay.active .pdf-modal-card {
  transform: scale(1);
}

.pdf-modal-header {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-color, #1e293b);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.pdf-modal-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.pdf-progress-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.pdf-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
}

.pdf-progress-bg {
  width: 100%;
  height: 8px;
  background: var(--bg-body, #f1f5f9);
  border-radius: 10px;
  overflow: hidden;
}

.pdf-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary, #3b82f6), #10b981);
  border-radius: 10px;
  transition: width 0.1s ease;
}

.pdf-status-text {
  font-size: 14px;
  color: var(--text-color, #334155);
  font-weight: 500;
  min-height: 20px;
}

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

.btn-modal {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-modal-cancel {
  background: var(--bg-body, #f1f5f9);
  color: var(--text-muted, #64748b);
}