/* ═══════════════════════════════════════════════
   Hadaria Wiki — Extra CSS  (v5)
   ═══════════════════════════════════════════════ */

:root {
  --had-purple:       #322d50;
  --had-purple-light: #7c6fe0;
  --had-accent:       #5b4fc9;
  --had-bg:           #ffffff;
  --had-surface:      #f9f8fd;
  --had-border:       rgba(50, 45, 80, 0.10);
  --had-shadow-sm:    0 1px 3px rgba(50,45,80,0.08), 0 1px 2px rgba(50,45,80,0.06);
  --had-transition:   0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ══════════════════════════════════════
   PALETTE
   ══════════════════════════════════════ */
[data-md-color-scheme="default"] {
  --md-primary-fg-color:          #322d50;
  --md-primary-fg-color--light:   #4a4375;
  --md-primary-fg-color--dark:    #1e1a30;
  --md-accent-fg-color:           #7c6fe0;
  --md-typeset-a-color:           #5b4fc9;
  --md-default-bg-color:          #ffffff;
  --md-default-fg-color:          #1a1625;
  --md-default-fg-color--light:   #4a4570;
  --md-default-fg-color--lighter: #7a779a;
  --md-code-bg-color:             #f4f3fb;
  --md-code-fg-color:             #322d50;
}

/* ══════════════════════════════════════
   HEADER — violet foncé, sticky permanent
   Tout scopé à .md-header pour éviter
   de polluer les nav links
   ══════════════════════════════════════ */
.md-header,
[data-md-color-primary] .md-header {
  background-color: #322d50 !important;
  transform: translateY(0) !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,0.20) !important;
}

/* Blanc uniquement DANS le header */
.md-header .md-header__title,
.md-header .md-header__topic,
.md-header .md-ellipsis,        /* scopé au header uniquement */
.md-header .md-header__button,
.md-header > .md-header__inner a {
  color: #ffffff !important;
}

.md-header .md-header__button svg,
.md-header .md-icon svg {
  fill: #ffffff !important;
}

.md-header__button.md-logo img {
  height: 32px;
  border-radius: 4px;
}

/* Search */
.md-search__input {
  background-color: rgba(255,255,255,0.13) !important;
  border: 1px solid rgba(255,255,255,0.20) !important;
  border-radius: 8px !important;
  color: #fff !important;
}
.md-search__input::placeholder {
  color: rgba(255,255,255,0.55) !important;
}
.md-search__input:focus {
  background-color: rgba(255,255,255,0.20) !important;
}
.md-search__icon {
  color: rgba(255,255,255,0.7) !important;
}

/* ══════════════════════════════════════
   TABS — masqués
   ══════════════════════════════════════ */
.md-tabs {
  display: none !important;
}

/* ══════════════════════════════════════
   FOND GÉNÉRAL
   ══════════════════════════════════════ */
body,
.md-main,
.md-main__inner {
  background-color: #ffffff;
}

/* ══════════════════════════════════════
   SIDEBAR GAUCHE
   ══════════════════════════════════════ */
.md-sidebar--primary {
  background: #ffffff;
  border-right: 1px solid var(--had-border);
}

/* Reset complet des liens nav primaire */
.md-sidebar--primary .md-nav__link {
  color: #4a4570 !important;
  border-radius: 6px;
  transition: background var(--had-transition), color var(--had-transition);
  padding: 4px 10px;
  margin: 1px 0;
  font-size: 0.85rem;
}

.md-sidebar--primary .md-nav__link:hover {
  background: #f4f3fb;
  color: #5b4fc9 !important;
}

.md-sidebar--primary .md-nav__item--active > .md-nav__link,
.md-sidebar--primary .md-nav__link--active {
  color: #5b4fc9 !important;
  font-weight: 600;
  background: rgba(91, 79, 201, 0.08);
}

.md-sidebar--primary .md-nav__title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a779a !important;
  padding: 12px 10px 4px;
}

/* ══════════════════════════════════════
   TABLE OF CONTENTS (sidebar droite)
   Positionnement géré par Material
   ══════════════════════════════════════ */
.md-sidebar--secondary {
  background: #ffffff;
  border-left: 1px solid var(--had-border);
}

.md-sidebar--secondary .md-nav__title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a779a !important;
}

/* Reset complet des liens TOC */
.md-sidebar--secondary .md-nav__link {
  color: #7a779a !important;
  font-size: 0.8rem !important;
  font-weight: normal !important;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  padding: 3px 12px !important;
  margin: 0 !important;
  background: transparent !important;
  display: block;
  transition: all var(--had-transition);
}

.md-sidebar--secondary .md-nav__link:hover {
  border-left-color: #7c6fe0;
  color: #5b4fc9 !important;
  background: transparent !important;
}

.md-sidebar--secondary .md-nav__link--active {
  border-left-color: #5b4fc9 !important;
  color: #5b4fc9 !important;
  font-weight: 600 !important;
  background: transparent !important;
}

/* ══════════════════════════════════════
   CONTENU PRINCIPAL
   ══════════════════════════════════════ */
.md-content {
  background: #ffffff;
  padding: 2rem 2.5rem;
}

.md-typeset h1 {
  font-weight: 700;
  color: #322d50;
  border-bottom: 2px solid var(--had-border);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.md-typeset h2 {
  font-weight: 600;
  color: #322d50;
  margin-top: 2rem;
  font-size: 1.3rem;
}

.md-typeset h3 {
  font-weight: 600;
  color: #1a1625;
  font-size: 1.05rem;
}

.md-typeset a {
  color: #5b4fc9;
  text-decoration: none;
  border-bottom: 1px solid rgba(91, 79, 201, 0.25);
  transition: border-color var(--had-transition), color var(--had-transition);
}

.md-typeset a:hover {
  color: #322d50;
  border-bottom-color: #322d50;
}

/* ══════════════════════════════════════
   TABLES
   ══════════════════════════════════════ */
.md-typeset table:not([class]) {
  border: 1px solid var(--had-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--had-shadow-sm);
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.md-typeset table:not([class]) th {
  background-color: #f9f8fd;
  color: #322d50;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--had-border);
  padding: 10px 16px;
}

.md-typeset table:not([class]) td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--had-border);
  color: #4a4570;
  font-size: 0.9rem;
}

.md-typeset table:not([class]) tr:last-child td {
  border-bottom: none;
}

.md-typeset table:not([class]) tr:hover td {
  background-color: rgba(124, 111, 224, 0.04);
}

/* ══════════════════════════════════════
   ADMONITIONS
   ══════════════════════════════════════ */
.md-typeset .admonition,
.md-typeset details {
  border-radius: 8px;
  border-width: 1px;
  border-style: solid;
  box-shadow: none;
  font-size: 0.9rem;
}

.md-typeset .admonition.note,
.md-typeset .admonition.info,
.md-typeset details.note,
.md-typeset details.info {
  border-color: rgba(91, 79, 201, 0.3);
  background-color: rgba(124, 111, 224, 0.06);
}
.md-typeset .admonition.note > .admonition-title,
.md-typeset .admonition.info > .admonition-title {
  background-color: rgba(124, 111, 224, 0.10);
  color: #5b4fc9;
}

.md-typeset .admonition.warning,
.md-typeset details.warning {
  border-color: rgba(255, 152, 0, 0.35);
  background-color: rgba(255, 152, 0, 0.05);
}
.md-typeset .admonition.warning > .admonition-title {
  background-color: rgba(255, 152, 0, 0.10);
}

.md-typeset .admonition.danger,
.md-typeset details.danger {
  border-color: rgba(229, 57, 53, 0.3);
  background-color: rgba(229, 57, 53, 0.04);
}
.md-typeset .admonition.danger > .admonition-title {
  background-color: rgba(229, 57, 53, 0.08);
  color: #c62828;
}

.md-typeset .admonition.tip,
.md-typeset .admonition.success,
.md-typeset details.tip,
.md-typeset details.success {
  border-color: rgba(56, 142, 60, 0.3);
  background-color: rgba(56, 142, 60, 0.04);
}
.md-typeset .admonition.tip > .admonition-title,
.md-typeset .admonition.success > .admonition-title {
  background-color: rgba(56, 142, 60, 0.08);
  color: #2e7d32;
}

/* ══════════════════════════════════════
   CODE
   ══════════════════════════════════════ */
.md-typeset code {
  background: #f4f3fb;
  border: 1px solid var(--had-border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.85em;
  color: #322d50;
}

.md-typeset pre {
  border-radius: 8px;
  border: 1px solid var(--had-border);
  box-shadow: var(--had-shadow-sm);
}

.md-typeset pre > code {
  border: none;
  background: transparent;
  padding: 0;
}

/* ══════════════════════════════════════
   FOOTER
   ══════════════════════════════════════ */
.md-footer {
  background-color: #322d50;
}

.md-footer-meta {
  background-color: #281e45;
}

.md-footer__link {
  color: rgba(255,255,255,0.75) !important;
  transition: color var(--had-transition);
}

.md-footer__link:hover {
  color: #ffffff !important;
}

.md-footer-copyright {
  color: rgba(255,255,255,0.5);
}

.md-social__link svg {
  fill: rgba(255,255,255,0.6);
  transition: fill var(--had-transition);
}
.md-social__link:hover svg {
  fill: #ffffff;
}

/* ══════════════════════════════════════
   SEARCH RESULTS
   ══════════════════════════════════════ */
.md-search-result__meta {
  background-color: #f9f8fd;
  color: #7a779a;
}

.md-search-result mark {
  background: rgba(124, 111, 224, 0.2);
  color: #5b4fc9;
  border-radius: 2px;
}

/* ══════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(50, 45, 80, 0.18);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(50, 45, 80, 0.32);
}
