/* material.css — tokens, reset, layout, header, progression, sommaire */

/* === Tokens lemur-creneaux === */
:root {
  --primary:         #1976d2;
  --primary-hover:   #1565c0;
  --primary-soft:    #e3f2fd;
  --on-primary:      #fff;

  --surface:         #fff;
  --surface-alt:     #f6f7f9;
  --surface-hover:   #f0f2f5;
  --on-surface:      #1f1f1f;
  --on-surface-soft: #5f6368;
  --outline:         #dadce0;
  --outline-soft:    #e8eaed;

  --success:         #137333;
  --success-soft:    #e6f4ea;
  --warning:         #b06000;
  --warning-soft:    #fef7e0;
  --error:           #b3261e;
  --error-soft:      #fce8e6;
  --info:            #1967d2;
  --info-soft:       #e8f0fe;

  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-8: 3rem;

  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-pill: 9999px;

  --shadow-1: 0 1px 2px rgba(60,64,67,.10), 0 1px 3px rgba(60,64,67,.08);
  --shadow-2: 0 2px 6px rgba(60,64,67,.12), 0 1px 2px rgba(60,64,67,.08);
  --shadow-3: 0 4px 12px rgba(60,64,67,.14), 0 2px 4px rgba(60,64,67,.08);
  --shadow-4: 0 8px 24px rgba(60,64,67,.16);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
}

/* === Reset léger === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* L'attribut hidden doit primer sur les display: des classes (login, vues…). */
[hidden] { display: none !important; }

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--on-surface);
  background: var(--surface-alt);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

h1, h2, h3, h4 { margin: 0; font-weight: 500; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* === Layout === */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* Header blanc, style site-header lemur */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--outline-soft);
  box-shadow: var(--shadow-1);
  padding: var(--sp-3) var(--sp-4);
}

.app-header h1 {
  font-size: 20px;
  font-weight: 500;
  color: var(--on-surface);
  letter-spacing: 0.01em;
}

/* Bandeau AG style lemur : fond primary-soft, bordure gauche primary */
.header-meta,
.header-mandant,
.header-notice {
  display: block;
}

/* Le bloc bandeau AG est construit par renderHeader qui empile
   header-meta + header-mandant + header-notice dans .app-header.
   On stylise l'ensemble via un pseudo-wrapper : les 3 divs après h1
   reçoivent le traitement bandeau groupé. */
.app-header > .header-meta {
  margin-top: var(--sp-3);
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  padding: var(--sp-3) var(--sp-4) 0;
  font-size: 14px;
  color: var(--on-surface);
  font-weight: 500;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.app-header > .header-mandant {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  padding: var(--sp-1) var(--sp-4);
  font-size: 13px;
  color: var(--on-surface-soft);
  border-radius: 0;
}

.app-header > .header-notice {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: var(--sp-2) var(--sp-4) var(--sp-3);
  font-size: 13px;
  font-style: italic;
  color: var(--on-surface-soft);
  margin-bottom: var(--sp-1);
}

.main-content {
  flex: 1;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: var(--sp-4);
  padding-bottom: 6rem;
}

@media (min-width: 720px) {
  .main-content { padding: var(--sp-5); }
}

/* === Barre de progression === */
.progress-wrap {
  background: var(--outline-soft);
  border-radius: var(--radius-pill);
  height: 4px;
  overflow: hidden;
  margin: var(--sp-3) 0 var(--sp-1);
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

.progress-label {
  font-size: 12px;
  color: var(--on-surface-soft);
  text-align: right;
  margin-bottom: var(--sp-3);
}

/* === Sommaire (TOC) — style carte/disclosure lemur === */
.toc-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--outline-soft);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface);
  cursor: pointer;
  margin-bottom: var(--sp-1);
  text-align: left;
  transition: background 120ms ease, border-color 120ms ease;
  box-shadow: var(--shadow-1);
}

.toc-toggle:hover { background: var(--surface-hover); border-color: var(--outline); }

.toc-toggle[aria-expanded="true"] {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.toc-list {
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--outline-soft);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: var(--sp-1) 0 var(--sp-2);
  margin-bottom: var(--sp-4);
  max-height: 60vh;
  overflow-y: auto;
  box-shadow: var(--shadow-1);
}

.toc-list[hidden] { display: none; }

.toc-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  cursor: pointer;
  color: var(--on-surface);
  font-size: 13px;
  line-height: 1.4;
  border-left: 3px solid transparent;
  min-height: 36px;
  transition: background 120ms ease;
}

.toc-item:hover,
.toc-item:focus { background: var(--surface-hover); outline: none; }

.toc-item.toc-done {
  color: var(--success);
  border-left-color: var(--success);
}

.toc-item.toc-partial { border-left-color: var(--warning); }

.toc-item.toc-unseen { opacity: 0.7; }

.toc-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid currentColor;
}

.toc-item.toc-done .toc-dot {
  background: var(--success);
  border-color: var(--success);
}

.toc-item.toc-partial .toc-dot {
  background: var(--warning);
  border-color: var(--warning);
}
