/* OLS — composants de recherche, progression, examen */

/* ═══ MODAL DE RECHERCHE ════════════════════════════════════ */
#ols-search-modal {
  position: fixed; inset: 0;
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 1rem 1rem;
}
#ols-search-modal.is-open { display: flex; }
.ols-search-backdrop {
  position: absolute; inset: 0;
  background: rgba(28, 22, 12, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: olsFadeIn .15s ease;
}
.dark .ols-search-backdrop { background: rgba(0,0,0,0.7); }
.ols-search-box {
  position: relative;
  width: 100%; max-width: 600px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e1d8);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  overflow: hidden;
  animation: olsSlideDown .2s ease;
}
@keyframes olsFadeIn { from {opacity:0} to {opacity:1} }
@keyframes olsSlideDown { from {opacity:0; transform: translateY(-12px)} to {opacity:1; transform: translateY(0)} }
.ols-search-header {
  display: flex; align-items: center; gap: .8rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border, #e5e1d8);
}
.ols-search-icon { font-size: 1.1rem; opacity: .6; }
#ols-search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink, #1c160c);
}
.ols-search-esc {
  font-family: inherit;
  font-size: .7rem;
  font-weight: 600;
  padding: .2rem .5rem;
  border-radius: 4px;
  background: var(--bg2, #ece9e4);
  color: var(--ink3, #96897a);
  border: 1px solid var(--border, #e5e1d8);
}
.ols-search-results {
  max-height: 50vh;
  overflow-y: auto;
  padding: .5rem;
}
.ols-search-hint {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ink3, #96897a);
  font-size: .9rem;
}
.ols-result {
  display: flex; align-items: center; gap: .8rem;
  padding: .7rem .8rem;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background .12s;
}
.ols-result:hover, .ols-result.is-active { background: var(--bg2, #ece9e4); }
.ols-result-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.ols-result-body { flex: 1; min-width: 0; }
.ols-result-title {
  font-weight: 600; font-size: .95rem;
  color: var(--ink, #1c160c);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ols-result-sub {
  font-size: .75rem;
  color: var(--ink3, #96897a);
  margin-top: .15rem;
}
.ols-result-arrow {
  color: var(--ink3, #96897a);
  font-weight: 600;
  opacity: 0;
  transition: opacity .12s;
}
.ols-result:hover .ols-result-arrow,
.ols-result.is-active .ols-result-arrow { opacity: 1; }
.ols-search-footer {
  display: flex; gap: 1.2rem;
  padding: .7rem 1.2rem;
  border-top: 1px solid var(--border, #e5e1d8);
  font-size: .75rem;
  color: var(--ink3, #96897a);
  background: var(--bg, #f5f4f0);
}
.ols-search-footer kbd {
  font-family: inherit; font-size: .7rem;
  padding: .1rem .35rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e1d8);
  border-radius: 3px;
  margin-right: .25rem;
}

/* ═══ BOUTON RECHERCHE TOPBAR ═══════════════════════════════ */
.ols-search-trigger {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .4rem .7rem;
  background: var(--bg2, #ece9e4);
  border: 1px solid var(--border, #e5e1d8);
  border-radius: 8px;
  color: var(--ink2, #52493a);
  font-size: .85rem;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.ols-search-trigger:hover {
  background: var(--bg3, #ddd9d2);
  color: var(--ink, #1c160c);
}
.ols-search-trigger kbd {
  font-family: inherit; font-size: .7rem;
  padding: .08rem .3rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e1d8);
  border-radius: 3px;
  color: var(--ink3, #96897a);
}
@media (max-width: 640px) {
  .ols-search-trigger .lbl { display: none; }
  .ols-search-trigger kbd { display: none; }
  .ols-search-trigger { padding: .4rem; }
}

/* ═══ PROGRESSION — Barre dans header ══════════════════════ */
.ols-progress-bar {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .65rem;
  background: var(--bg2, #ece9e4);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--ink2, #52493a);
}
.ols-progress-track {
  width: 60px; height: 5px;
  background: var(--border, #e5e1d8);
  border-radius: 999px;
  overflow: hidden;
}
.ols-progress-fill {
  height: 100%;
  background: var(--accent, #0891b2);
  transition: width .4s ease;
}

/* ═══ PROGRESSION — Cases à cocher chapitre ════════════════ */
.ols-chapter-check {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .9rem;
  background: var(--bg2, #ece9e4);
  border: 1.5px solid var(--border, #e5e1d8);
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink2, #52493a);
  margin-bottom: 1rem;
}
.ols-chapter-check:hover { border-color: var(--accent, currentColor); }
.ols-chapter-check.is-done {
  background: var(--accent, #0891b2);
  border-color: var(--accent, #0891b2);
  color: white;
}
.ols-chapter-check input { display: none; }
.ols-chapter-check .checkmark {
  width: 18px; height: 18px;
  border: 2px solid currentColor;
  border-radius: 4px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
}
.ols-chapter-check.is-done .checkmark::after {
  content: '✓';
}

/* ═══ MODE RÉVISION EXPRESS ═════════════════════════════════ */
.ols-express-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.1rem;
  background: var(--accent, #0891b2);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  min-height: 44px;
}
.ols-express-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.18); }

/* ═══ MODE EXAMEN — TIMER ═══════════════════════════════════ */
.ols-exam-bar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 999;
  background: var(--accent, #0891b2);
  color: white;
  padding: .6rem 1rem;
  align-items: center; justify-content: space-between;
  font-size: .9rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.ols-exam-bar.is-active { display: flex; }
.ols-exam-timer {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 1rem;
  letter-spacing: -.02em;
}
.ols-exam-progress {
  display: flex; align-items: center; gap: .5rem;
}
.ols-exam-end {
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.3);
  color: white;
  padding: .25rem .7rem;
  border-radius: 6px;
  font-size: .8rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}
.ols-exam-end:hover { background: rgba(255,255,255,.3); }

/* ═══ STATS PANEL ═══════════════════════════════════════════ */
.ols-stats-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.ols-stat-card {
  padding: 1.2rem;
  background: var(--bg2, #ece9e4);
  border-radius: 12px;
  text-align: center;
}
.ols-stat-value {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--accent, #0891b2);
  line-height: 1;
}
.ols-stat-label {
  margin-top: .4rem;
  font-size: .8rem;
  color: var(--ink3, #96897a);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}

/* ═══ BANDEAU PROGRESSION HOME ══════════════════════════════ */
.ols-home-progress {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}
.ols-progress-card {
  display: flex; align-items: center; gap: .9rem;
  padding: 1rem 1.1rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e1d8);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: transform .12s, box-shadow .15s, border-color .15s;
}
.ols-progress-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
  border-color: var(--accent-color);
}
.ols-pc-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-color);
  border-radius: 10px;
  font-size: 1.4rem;
  flex-shrink: 0;
  filter: brightness(.95);
}
.ols-pc-body { flex: 1; min-width: 0; }
.ols-pc-name {
  font-weight: 700; font-size: .95rem;
  color: var(--ink, #1c160c);
  margin-bottom: .35rem;
}
.ols-pc-bar {
  height: 6px;
  background: var(--bg2, #ece9e4);
  border-radius: 999px;
  overflow: hidden;
}
.ols-pc-fill {
  height: 100%;
  background: var(--accent-color);
  transition: width .5s ease;
}
.ols-pc-pct {
  margin-left: .5rem;
  font-size: .85rem;
  font-weight: 700;
  color: var(--ink2, #52493a);
  flex-shrink: 0;
}

/* ═══ CONTACT — BOUTON FLOTTANT ═════════════════════════════ */
.ols-fab-contact {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--ink, #1c160c);
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  z-index: 50;
  transition: transform .15s, box-shadow .15s;
  display: flex; align-items: center; justify-content: center;
}
.ols-fab-contact:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 22px rgba(0,0,0,.28);
}
.ols-fab-contact:active { transform: scale(0.95); }
.dark .ols-fab-contact { background: #f5f4f0; color: #1c160c; }

/* Sur mobile, descendre un peu pour ne pas masquer la nav éventuelle */
@media (max-width: 640px) {
  .ols-fab-contact {
    bottom: 5rem;
    width: 48px; height: 48px;
    font-size: 1.25rem;
  }
}

/* ═══ CONTACT — MODAL ═══════════════════════════════════════ */
#ols-contact-modal {
  position: fixed; inset: 0;
  z-index: 9998;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 1rem 1rem;
}
#ols-contact-modal.is-open { display: flex; }
.ols-contact-backdrop {
  position: absolute; inset: 0;
  background: rgba(28, 22, 12, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: olsFadeIn .15s ease;
}
.dark .ols-contact-backdrop { background: rgba(0,0,0,0.7); }
.ols-contact-box {
  position: relative;
  width: 100%; max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e1d8);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: olsSlideDown .2s ease;
}
.ols-contact-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.4rem .6rem;
}
.ols-contact-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.3rem; font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink, #1c160c);
}
.ols-contact-sub {
  font-size: .85rem;
  color: var(--ink3, #96897a);
  margin-top: .2rem;
}
.ols-contact-close {
  background: var(--bg2, #ece9e4);
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: .9rem;
  color: var(--ink2, #52493a);
  flex-shrink: 0;
}
.ols-contact-close:hover { background: var(--bg3, #ddd9d2); }
.ols-contact-form {
  padding: .6rem 1.4rem 1.4rem;
}
.ols-contact-label {
  display: block;
  margin-bottom: .9rem;
}
.ols-contact-label > span {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink2, #52493a);
  margin-bottom: .35rem;
}
.ols-contact-form input[type="text"],
.ols-contact-form input[type="email"],
.ols-contact-form select,
.ols-contact-form textarea {
  width: 100%;
  padding: .7rem .85rem;
  border: 1.5px solid var(--border, #e5e1d8);
  border-radius: 8px;
  background: var(--bg, #f5f4f0);
  font-family: inherit;
  font-size: .92rem;
  color: var(--ink, #1c160c);
  resize: vertical;
  box-sizing: border-box;
}
.ols-contact-form input:focus,
.ols-contact-form select:focus,
.ols-contact-form textarea:focus {
  outline: none;
  border-color: var(--ink, #1c160c);
  background: var(--surface, #fff);
}
.ols-contact-form textarea { min-height: 100px; line-height: 1.4; }
.ols-contact-actions {
  display: flex; gap: .6rem;
  justify-content: flex-end;
  margin-top: 1.2rem;
}
.ols-contact-cancel {
  padding: .7rem 1.1rem;
  background: var(--bg2, #ece9e4);
  color: var(--ink2, #52493a);
  border: 1.5px solid var(--border, #e5e1d8);
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}
.ols-contact-cancel:hover { background: var(--bg3, #ddd9d2); }
.ols-contact-submit {
  padding: .7rem 1.4rem;
  background: var(--ink, #1c160c);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}
.ols-contact-submit:hover { background: var(--ink2, #52493a); }
.ols-contact-submit:disabled {
  opacity: .6;
  cursor: not-allowed;
}
.dark .ols-contact-submit {
  background: #f5f4f0; color: #1c160c;
}
.ols-contact-status {
  margin-top: 1rem;
  padding: 0;
  font-size: .9rem;
  border-radius: 8px;
}
.ols-contact-status.is-success {
  padding: .8rem 1rem;
  background: #dcfce7;
  color: #166534;
}
.ols-contact-status.is-error {
  padding: .8rem 1rem;
  background: #fee2e2;
  color: #991b1b;
}
