/* Section cards (classeur + chapitres) */
.section-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted, #64748b);
  font-weight: 700;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title.section-title--compact { margin-bottom: 16px; }

.section-title::after {
  content: "";
  height: 1px;
  flex-grow: 1;
  background: linear-gradient(to right, var(--border-subtle, rgba(255, 255, 255, 0.1)), transparent);
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 32px;
}

.data-card {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 28px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  group: card;
  text-decoration: none;
  color: inherit;
  width: 100%;
  text-align: left;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

button.data-card {
  border: 1px solid rgba(255, 255, 255, 0.05);
  font: inherit;
  background: rgba(15, 23, 42, 0.4);
}

.data-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--theme-color), transparent);
  opacity: 0.5;
  transition: 0.3s;
}

.data-card:hover {
  transform: translateY(-10px) scale(1.02);
  background: linear-gradient(to bottom right, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.9));
  border-color: var(--theme-color);
  box-shadow:
    0 20px 40px -10px rgba(0, 0, 0, 0.5),
    0 0 20px -5px var(--theme-color-glow);
}

.data-card:hover::before {
  opacity: 1;
  height: 3px;
  box-shadow: 0 0 15px var(--theme-color);
}

.data-card .card-icon-box {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
  font-size: 2rem;
  margin-bottom: 20px;
  color: var(--theme-color);
  transition: 0.3s;
}

.data-card:hover .card-icon-box {
  transform: scale(1.1) rotate(5deg);
  background: var(--theme-color);
  color: #ffffff;
  box-shadow: 0 0 15px var(--theme-color);
}

.data-card .card-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.data-card .card-content p {
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 24px;
}

.data-card .card-stats {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.05));
}
.card-action-pill {
  font-size: 0.8rem;
  color: var(--color-white, #fff);
  background: var(--card-pill-bg, rgba(255, 255, 255, 0.1));
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.data-card .progress-ring {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono, monospace);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--theme-color);
}

.data-card .ring-chart {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  --pct: 100%;
  background: conic-gradient(
    var(--theme-color) var(--pct),
    var(--ring-track, rgba(255, 255, 255, 0.1)) 0
  );
  position: relative;
}

.data-card .ring-chart::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 50%;
}

.data-card--muted {
  --theme-color: var(--app-muted, #64748b);
  --theme-color-glow: color-mix(in oklab, var(--app-muted, #64748b) 35%, transparent);
}

.section-title.section-title--sidebar {
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  row-gap: 8px;
  margin-bottom: 16px;
}

.card-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted, #94a3b8);
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.bac-subject-score--card {
  margin: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  font-family: var(--font-mono, monospace);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: rgb(187 247 208 / 0.98);
  border: 1px solid rgb(74 222 128 / 0.48);
  background: linear-gradient(140deg, rgb(2 6 23 / 0.7), rgb(6 78 59 / 0.24));
  border-radius: 999px;
  padding: 0.32rem 0.76rem;
}

.bac-subject-score--card .bac-subject-score__label {
  color: rgb(134 239 172 / 0.95);
  font-size: 0.84rem;
  letter-spacing: 0.07em;
}

.bac-subject-score--card .bac-subject-score__value {
  color: #f0fdf4;
  font-size: 1rem;
}

.card-chapter-number {
  font-family: var(--font-mono, monospace);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 2px rgba(255, 255, 255, 0.15);
  position: relative;
  z-index: 0;
  opacity: 0.4;
  transition: 0.3s;
}

.active-card .card-chapter-number {
  color: var(--theme-color);
  -webkit-text-stroke: 0px transparent;
  text-shadow: 0 0 20px var(--theme-color-glow);
  opacity: 0.85;
}

.data-card:hover .card-chapter-number {
  color: var(--theme-color);
  -webkit-text-stroke: 0px transparent;
  text-shadow: 0 0 20px var(--theme-color-glow);
  opacity: 1;
  transform: scale(1.1);
}

.active-card {
  justify-content: space-between;
}

.card-xp-container {
  margin-top: auto;
  padding-top: 16px;
  width: 100%;
  position: relative;
  z-index: 2;
}

.xp-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.xp-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.xp-bar {
  height: 100%;
  background: var(--theme-color);
  box-shadow: 0 0 10px var(--theme-color);
  border-radius: 10px;
  transition: width 1s ease-out;
}

/* === 2. LISTE PROGRAMME (Sidebar Droite) === */
.program-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.program-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 8px 0 12px;
}

.program-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  text-decoration: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 100%;
  text-align: left;
  appearance: none;
  font: inherit;
}

.program-item.is-disabled,
.program-item[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.55;
  cursor: default;
}

.program-item:hover {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(34, 211, 238, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.35);
}
.program-item:active {
  transform: translateY(-1px) scale(0.995);
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.3);
}
.program-item:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.55);
  outline-offset: 2px;
}

@media (hover: none), (pointer: coarse) {
  .data-card:hover {
    transform: none;
    box-shadow: none;
  }

  .data-card:hover::before {
    height: 2px;
    box-shadow: none;
  }

  .data-card:hover .card-icon-box {
    transform: none;
    box-shadow: none;
  }

  .data-card:hover .card-chapter-number {
    transform: none;
  }

  .program-item:hover {
    transform: none;
    box-shadow: none;
  }
}

body[data-bac-page="hub"] .bac-hub-group {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

body[data-bac-page="hub"] .bac-hub-group:first-of-type {
  margin-top: 0;
}

body[data-bac-page="hub"] .bac-hub-group__head {
  display: grid;
  gap: 2px;
}

body[data-bac-page="hub"] .bac-hub-group__head .program-hint {
  margin: 0;
}

body[data-bac-page="hub"] .bac-hub-card--locked {
  cursor: default;
  opacity: 0.72;
}

body[data-bac-page="hub"] .bac-hub-card--locked:hover {
  transform: none;
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: none;
  background: rgba(15, 23, 42, 0.4);
}

body[data-bac-page="hub"] .bac-hub-card__lock {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.8;
}

/* Chapter modal */
.chapter-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(8px);
  z-index: 2000;
}
body.modal-open {
  overflow: hidden;
}
.chapter-modal.active { display: flex; }
.chapter-modal__panel {
  width: min(92vw, 520px);
  background: rgba(12, 20, 35, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}
.chapter-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.chapter-modal__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  text-align: left;
}
.chapter-modal__close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
}
.chapter-modal__icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.chapter-modal__text {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
}
.chapter-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.chapter-modal__cta {
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #22d3ee, #10b981);
  color: #0b1221;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(34, 211, 238, 0.3);
}
.chapter-modal__cancel {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  font-weight: 600;
  cursor: pointer;
}

.program-number {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  font-size: 1.1rem;
  opacity: 0.65;
  color: rgba(226, 232, 240, 0.8);
}

.program-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.program-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: #e2e8f0;
}

.program-action {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.program-item:hover .program-action {
  transform: translateY(-1px);
  border-color: rgba(34, 211, 238, 0.6);
  color: #22d3ee;
  box-shadow: 0 6px 18px rgba(34, 211, 238, 0.25);
}
