/* Modale de détails d'événement */
.frise-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.frise-modal-card {
  background: var(--school-card-bg);
  border-radius: var(--school-radius-lg);
  border: 1px solid var(--school-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.frise-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s;
}

.frise-modal-close:hover {
  background: rgba(0, 0, 0, 0.6);
}

.frise-modal-header {
  padding: 24px;
  color: #fff;
}

.frise-modal-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.frise-modal-subera {
  font-size: 0.85rem;
  font-weight: 600;
}

.frise-modal-img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  object-fit: cover;
}

.frise-modal-svg-wrap {
  width: 100%;
  max-height: 180px;
  padding: 10px;
}

.frise-modal-svg-wrap svg {
  max-height: 160px;
  width: auto;
}

.frise-modal-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--school-text);
}

.frise-empty-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--school-text-muted);
}

/* Mode Compact pour les vues panoramiques dézoomées */
.frise-event-item.compact-view {
  width: 130px;
}

.frise-event-item.compact-view .frise-card-ill-wrap {
  height: 44px;
}

.frise-event-item.compact-view .frise-card-summary,
.frise-event-item.compact-view .frise-card-subera,
.frise-event-item.compact-view .frise-card-action {
  display: none;
}

.frise-event-item.compact-view .frise-card-title {
  font-size: 0.74rem;
  -webkit-line-clamp: 1;
  margin-bottom: 0;
}

.frise-event-item.compact-view .frise-card-body {
  padding: 4px 6px;
}

.frise-event-item.compact-view .frise-card-header {
  padding: 2px 6px;
}

.frise-event-item.compact-view .frise-card-year {
  font-size: 0.68rem;
  padding: 1px 5px;
}

/* ==========================================================================
   Surcharges mobiles (en fin de feuille pour primer sur les règles de base)
   ========================================================================== */

/* Mobile : barre sur deux lignes (marque + icônes, puis recherche + progression),
   liens du compte regroupés dans un menu déroulant (même seuil que le menu ☰) */
@media (max-width: 991.98px) {
  .school-navbar {
    padding: 8px 12px;
    gap: 4px 8px;
  }

  /* !important : neutralise le d-flex Bootstrap posé dans le HTML */
  .school-navbar > div:last-child,
  #user-status {
    display: contents !important;
  }

  .school-navbar > div:first-child { order: 0; }
  .dyslexia-toggle-btn { order: 1; margin-left: auto; }
  .theme-toggle-btn { order: 2; }
  .user-menu-btn { order: 3; }

  /* Saut de ligne forcé entre les deux rangées */
  .school-navbar::after {
    content: '';
    order: 5;
    flex-basis: 100%;
  }

  .global-search { order: 10; flex: 1 1 0; min-width: 90px; }
  .global-search input { width: 100%; }
  #level-chip { order: 11; }
  .quests-toggle-btn { order: 12; }
  .xp-header-progress { order: 13; }
  .streak-flame-badge { order: 14; }

  .quests-label,
  .level-chip-label,
  .xp-bar-track {
    display: none;
  }

  .quests-toggle-btn,
  .xp-header-progress,
  .streak-flame-badge,
  .level-chip {
    padding: 5px 8px;
    white-space: nowrap;
  }

  .user-menu-btn {
    display: inline-flex;
  }

  #user-status:not(.logged-in) .school-nav-links {
    display: none;
  }
}

@media (max-width: 575.98px) {
  .school-content {
    padding: 14px 10px;
  }

  .school-card {
    padding: 18px 14px;
  }

  .school-breadcrumb {
    padding: 10px 12px 0;
  }
}

@media (max-width: 767.98px) {
  .flashcard-controls {
    flex-wrap: wrap;
    gap: 8px;
  }

  .flashcard-controls .school-btn {
    flex: 1 1 auto;
    white-space: nowrap;
  }
}

/* Tableaux larges (étymologie, conjugaison, pages statiques) : défilement
   horizontal dans le tableau plutôt que coupure par le overflow-x de la page */
@media (max-width: 767.98px) {
  .school-content table:not(.table-responsive table),
  .container table:not(.table-responsive table) {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
}

/* Petits écrans de bureau : libellés masqués pour tenir sur une ligne */
@media (min-width: 992px) and (max-width: 1279.98px) {
  .quests-label,
  .level-chip-label,
  .dyslexia-toggle-btn .dyslexia-label {
    display: none;
  }

  .global-search input {
    width: 200px;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   ⚡ STYLES POUR SIMULATEUR & JEUX D'ÉLECTRICITÉ (Arkademy)
   ───────────────────────────────────────────────────────────────────────────── */

.elec-workbench {
  background: var(--school-card-bg, #ffffff);
  border: 1px solid var(--school-border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.elec-circuit-container {
  background: radial-gradient(circle at 50% 50%, rgba(13, 148, 136, 0.04) 0%, rgba(15, 23, 42, 0.03) 100%), var(--school-surface-alt, #f8fafc);
  border: 1px solid var(--school-border);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
}

[data-bs-theme="dark"] .elec-circuit-container {
  background: radial-gradient(circle at 50% 50%, rgba(20, 184, 166, 0.08) 0%, rgba(15, 23, 42, 0.6) 100%), #0f172a;
}

.elec-electrons {
  stroke-dasharray: 6 14;
  animation: elecMoveElectrons linear infinite;
}

@keyframes elecMoveElectrons {
  from { stroke-dashoffset: 40; }
  to { stroke-dashoffset: 0; }
}

.elec-lcd-meter {
  font-family: 'Courier New', Courier, monospace;
  background: #0f172a;
  color: #38bdf8;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
  border: 1px solid #334155;
  text-align: center;
}

.elec-lcd-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.05em;
  font-family: inherit;
}

.elec-lcd-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #38bdf8;
}

.elec-triangle-box {
  background: var(--school-surface-alt, #f8fafc);
  border: 1px solid var(--school-border);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

.elec-triangle-btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s ease;
}

.elec-triangle-btn.active {
  border-color: var(--school-primary);
  background: rgba(13, 148, 136, 0.12);
  color: var(--school-primary);
}

.elec-specimen-card {
  border: 2px solid var(--school-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--school-card-bg, #ffffff);
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.elec-specimen-card:hover {
  border-color: var(--school-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.12);
}

.elec-specimen-card.active-test {
  border-color: var(--school-primary);
  background: rgba(13, 148, 136, 0.08);
}

.elec-challenge-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}
