/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0A0A0A;
  --bg-2:       #131313;
  --bg-3:       #1C1C1C;
  --accent:     #E8000D;
  --accent-dim: #b50009;
  --text:       #F2F2F2;
  --text-dim:   #999;
  --text-muted: #555;
  --green:      #22c55e;
  --orange:     #f97316;
  --border:     #252525;
  --border-2:   #333;
  --radius:     6px;
  --radius-lg:  8px;
  --font:       'Inter', 'DM Sans', system-ui, -apple-system, sans-serif;
  --max-w:      720px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

img, svg { display: block; }
button { cursor: pointer; font-family: inherit; }

/* === LAYOUT === */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px;
}

.page-wrap { padding-bottom: 80px; }

/* === HEADER === */
.site-header {
  background: var(--bg-2);
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  gap: 2px;
}

.nav-link {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--bg-3);
  text-decoration: none;
}

/* === HERO ALERT (contrôle en cours) === */
.control-alert {
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  margin: 20px 0;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
  letter-spacing: -0.01em;
}

.control-alert:hover { background: var(--accent-dim); }

.control-alert-icon {
  width: 38px;
  height: 38px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.control-alert-text { flex: 1; }
.control-alert-text span { display: block; font-size: 0.8rem; font-weight: 500; opacity: 0.85; margin-top: 2px; letter-spacing: 0; }

.control-alert-arrow { opacity: 0.6; font-size: 1.4rem; font-weight: 300; }

/* === SEARCH === */
.search-wrap {
  position: relative;
  margin: 16px 0;
}

.search-input {
  width: 100%;
  background: var(--bg-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  padding: 13px 16px 13px 44px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  -webkit-appearance: none;
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); background: var(--bg-2); }

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

#search-results { margin-top: 8px; }

/* === TAGS / FILTERS (search page) === */
.tags-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 20px;
}

.tag {
  background: var(--bg-3);
  border: 1.5px solid var(--border);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.tag:hover, .tag.active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(232,0,13,0.08);
}

/* === SECTION TITLES === */
.section-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 28px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === CARDS (articles de loi) === */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 8px;
  transition: background 0.15s, border-color 0.15s;
  display: block;
  color: var(--text);
}

.card:hover {
  background: var(--bg-3);
  border-color: var(--border-2);
  border-left-color: var(--accent);
  text-decoration: none;
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}

.card-law {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(232,0,13,0.1);
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.card-title {
  font-weight: 800;
  font-size: 1.06rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.card-desc {
  color: var(--text-dim);
  font-size: 0.93rem;
  margin-top: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.card-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.card-tag {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-3);
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: lowercase;
}

/* === SCENARIO CARD === */
.scenario-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--orange);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 8px;
  transition: background 0.15s, border-color 0.15s;
  display: block;
  color: var(--text);
}

.scenario-card:hover {
  background: var(--bg-3);
  border-color: var(--border-2);
  border-left-color: var(--orange);
  text-decoration: none;
}

.scenario-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(249,115,22,0.1);
  padding: 3px 10px;
  border-radius: 3px;
  margin-bottom: 8px;
}

/* === DETAIL PAGE === */
.detail-header {
  margin: 24px 0 20px;
}

.detail-law-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.detail-title {
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

/* === INFO BLOCKS (peut / ne peut pas) === */
.rules-grid {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

@media (min-width: 540px) {
  .rules-grid { grid-template-columns: 1fr 1fr; }
}

.rules-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.rules-block-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.rules-block-header img { width: 16px; height: 16px; }

.rules-block ul { list-style: none; }
.rules-block li {
  font-size: 0.95rem;
  color: var(--text-dim);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}
.rules-block li:last-child { border-bottom: none; }

/* === LEGAL TEXT BLOCK === */
.legal-block {
  background: var(--bg-3);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 16px;
  margin: 14px 0;
}

.legal-block-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 6px;
}

.legal-block-text {
  font-size: 0.95rem;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.6;
}

/* === EXPLANATION BLOCK === */
.explication-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
  font-size: 1.03rem;
  line-height: 1.65;
}

/* === STATUS BADGES (cat A/B/C) === */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.cat-badge-A {
  background: rgba(34,197,94,0.12);
  color: var(--green);
  border: 1px solid rgba(34,197,94,0.25);
}

.cat-badge-B {
  background: rgba(249,115,22,0.12);
  color: var(--orange);
  border: 1px solid rgba(249,115,22,0.25);
}

.cat-badge-C {
  background: rgba(232,0,13,0.12);
  color: var(--accent);
  border: 1px solid rgba(232,0,13,0.25);
}

/* === MODIFICATION CARD === */
.modif-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-2);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 8px;
}

.modif-card[data-cat="A"] { border-left-color: var(--green); }
.modif-card[data-cat="B"] { border-left-color: var(--orange); }
.modif-card[data-cat="C"] { border-left-color: var(--accent); }

.modif-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.modif-card-title {
  font-weight: 800;
  font-size: 1.02rem;
  line-height: 1.3;
  flex: 1;
  letter-spacing: -0.01em;
}

.modif-condition {
  font-size: 0.93rem;
  color: var(--text-dim);
  margin: 6px 0;
  line-height: 1.5;
}

.modif-law-ref {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
  margin-top: 6px;
}

/* === MES MODIFS PAGE === */
.modif-check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-2);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.modif-check-item:hover { background: var(--bg-3); }
.modif-check-item.checked { border-left-color: var(--green); }
.modif-check-item.checked-B { border-left-color: var(--orange); }
.modif-check-item.checked-C { border-left-color: var(--accent); }

.modif-check-box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-2);
  border-radius: 4px;
  background: var(--bg-3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  margin-top: 1px;
}

.modif-check-box.checked { background: var(--green); border-color: var(--green); }
.modif-check-box.checked::after { content: ''; display: block; width: 5px; height: 9px; border: 2px solid #fff; border-top: none; border-left: none; transform: rotate(45deg) translateY(-1px); }

.modif-check-info { flex: 1; }
.modif-check-name { font-weight: 700; font-size: 0.9rem; }
.modif-check-cat { font-size: 0.78rem; margin-top: 4px; color: var(--text-dim); }

/* === SUMMARY PANEL === */
.summary-panel {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 20px 0;
  position: sticky;
  bottom: 16px;
  z-index: 10;
}

.summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.summary-row:last-child { border-bottom: none; }
.summary-count {
  font-weight: 800;
  font-size: 1.1rem;
  width: 28px;
  text-align: center;
}

/* === CTA BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 11px 20px;
  border-radius: var(--radius);
  border: none;
  transition: all 0.15s;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dim); color: #fff; text-decoration: none; }

.btn-secondary {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover { border-color: #555; color: var(--text); text-decoration: none; }
.btn-full { width: 100%; }

/* === BACK LINK === */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding: 6px 0;
}
.back-link:hover { color: var(--text); text-decoration: none; }

/* === FOOTER === */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding: 24px 0;
}

.footer-disclaimer {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  max-width: 500px;
  margin: 0 auto;
}

/* === TABS === */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 10px 16px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
}

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab-btn:hover { color: var(--text); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}
.empty-state p { margin-top: 8px; font-size: 0.9rem; }

/* === CATEGORY GRID === */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 14px 0 20px;
}

.cat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-top: 2px solid transparent;
  border-radius: var(--radius);
  padding: 12px 6px 10px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.cat-card:hover {
  background: var(--bg-3);
  border-color: var(--border-2);
}

.cat-card.active {
  border-top-color: var(--accent);
  background: rgba(232,0,13,0.06);
  border-color: rgba(232,0,13,0.2);
}

.cat-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.cat-card.active .cat-icon { color: var(--accent); }

.cat-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  line-height: 1.2;
}

.cat-card.active .cat-label { color: var(--text); }

@media (max-width: 420px) {
  .cat-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .cat-label { font-size: 0.62rem; }
}

/* === PRINT STYLES === */
@media print {
  body { background: #fff; color: #000; font-size: 12pt; }
  .site-header, .site-footer, .btn, .back-link, .no-print { display: none !important; }
  .container { max-width: 100%; padding: 0; }

  .print-block { border: 1px solid #ccc; border-radius: 4px; padding: 14px; margin-bottom: 12px; page-break-inside: avoid; }
  .print-title { font-size: 18pt; font-weight: bold; margin-bottom: 8px; }
  .print-label { font-size: 8pt; text-transform: uppercase; letter-spacing: 0.08em; color: #666; font-weight: bold; margin-bottom: 4px; }
  .print-law { font-family: monospace; font-size: 10pt; background: #f5f5f5; padding: 8px 10px; border-left: 3px solid #E8000D; margin: 8px 0; }
  a { color: #000; text-decoration: none; }
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
  html { font-size: 17px; }
  .detail-title { font-size: 1.3rem; }
  .site-nav { display: none; }
  .container { padding: 0 16px; }
  .card-desc { -webkit-line-clamp: 3; }
  .back-link { font-size: 0.92rem; }
  .tab-btn { font-size: 0.76rem; padding: 10px 12px; }
}

/* === OFFLINE INDICATOR === */
.offline-banner {
  background: var(--orange);
  color: #fff;
  text-align: center;
  padding: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  display: none;
}
body.offline .offline-banner { display: block; }

/* === INSTALL PROMPT === */
.install-prompt {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
  font-size: 0.88rem;
}
.install-prompt-text { flex: 1; color: var(--text-dim); }
.install-prompt-text strong { color: var(--text); }

/* === ACCESSIBILITY === */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

/* === FEDLEX LAW LINKS === */
.law-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 700;
  white-space: nowrap;
}
.law-link:hover { color: #ff3340; text-decoration: underline; }

/* === CONSEQUENCES BLOCK === */
.consequences-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
}
.consequences-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.consequences-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.consequences-list li {
  font-size: 0.95rem;
  color: var(--text-dim);
  padding-left: 16px;
  position: relative;
  line-height: 1.5;
}
.consequences-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 800;
}

/* === HIGHLIGHT (search results) === */
mark {
  background: rgba(232,0,13,0.2);
  color: var(--text);
  border-radius: 2px;
  padding: 0 2px;
}
