/* ===== RESET MINIMAL ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 100%; }

/* ===== TOKENS ===== */
:root {
  --clr-text: #1a1a1a;
  --clr-bg: #ffffff;
  --clr-ok-bg: #e8f5e9;
  --clr-ok-text: #1b5e20;
  --clr-ok-border: #2e7d32;
  --clr-warn-bg: #fff3e0;
  --clr-warn-text: #4e2900;
  --clr-warn-border: #e65100;
  --clr-inc-bg: #fce4ec;
  --clr-inc-text: #880e1f;
  --clr-inc-border: #c62828;
  --clr-header-bg: #1565c0;
  --clr-header-text: #ffffff;
  --clr-focus: #005fcc;
  --clr-link: #1565c0;
  --radius: 6px;
  --space: 1rem;
}

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

.skip-link {
  position: absolute; top: -100%; left: 1rem;
  background: var(--clr-focus); color: #fff;
  padding: .5rem 1rem; border-radius: 0 0 var(--radius) var(--radius);
  font-weight: bold; text-decoration: none; z-index: 999;
}
.skip-link:focus { top: 0; }

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

/* ===== TYPOGRAPHIE ===== */
body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 1rem; line-height: 1.6;
  color: var(--clr-text); background: var(--clr-bg);
  min-height: 100vh; display: flex; flex-direction: column;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; margin-bottom: .75rem; }
a { color: var(--clr-link); }
a:hover { text-decoration: underline; }
p { margin-bottom: .5rem; }

/* ===== LAYOUT ===== */
header { background: var(--clr-header-bg); color: var(--clr-header-text); padding: 1.25rem var(--space); }
header a { color: #cce4ff; }
.header-inner { max-width: 860px; margin: 0 auto; }
.header-subtitle { font-size: .95rem; margin-top: .25rem; opacity: .9; }

main { flex: 1; max-width: 860px; margin: 0 auto; width: 100%; padding: 1.5rem var(--space); }
section { margin-bottom: 2rem; }

footer { background: #f5f5f5; border-top: 1px solid #ddd; padding: 1rem var(--space); text-align: center; font-size: .9rem; }
footer p { margin-bottom: .25rem; }

/* ===== ETAT GLOBAL ===== */
.etat-global {
  padding: 1rem 1.25rem; border-radius: var(--radius);
  font-size: 1.1rem; font-weight: bold; margin-bottom: 1.5rem;
}
.etat-global.ok { background: var(--clr-ok-bg); color: var(--clr-ok-text); border: 2px solid var(--clr-ok-border); }
.etat-global.warning { background: var(--clr-warn-bg); color: var(--clr-warn-text); border: 2px solid var(--clr-warn-border); }
.etat-global.incident { background: var(--clr-inc-bg); color: var(--clr-inc-text); border: 2px solid var(--clr-inc-border); }

/* ===== LISTE SERVICES ===== */
#liste-services { list-style: none; }
#liste-services li {
  display: flex; justify-content: space-between; align-items: center;
  padding: .75rem 1rem; border-bottom: 1px solid #e0e0e0;
  gap: 1rem;
}
#liste-services li:first-child { border-top: 1px solid #e0e0e0; }
.svc-nom { flex: 1; }
.svc-statut {
  font-weight: bold; padding: .2rem .75rem;
  border-radius: 100px; font-size: .9rem; white-space: nowrap;
}
.svc-statut.ok { background: var(--clr-ok-bg); color: var(--clr-ok-text); border: 1px solid var(--clr-ok-border); }
.svc-statut.warning { background: var(--clr-warn-bg); color: var(--clr-warn-text); border: 1px solid var(--clr-warn-border); }
.svc-statut.incident { background: var(--clr-inc-bg); color: var(--clr-inc-text); border: 1px solid var(--clr-inc-border); }

/* ===== INCIDENTS ===== */
.incident-card {
  border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem;
  border-left: 4px solid;
}
.incident-card.warning { background: var(--clr-warn-bg); border-color: var(--clr-warn-border); }
.incident-card.incident { background: var(--clr-inc-bg); border-color: var(--clr-inc-border); }
.incident-card.resolved { background: #f5f5f5; border-color: #9e9e9e; opacity: .8; }
.incident-titre { font-weight: bold; font-size: 1.05rem; margin-bottom: .35rem; }
.incident-meta { font-size: .875rem; color: #555; }
.etat-vide { color: #555; font-style: italic; }

/* ===== FORMULAIRE ADMIN ===== */
.form-field { margin-bottom: 1.25rem; }
label { display: block; font-weight: 600; margin-bottom: .35rem; }
input[type="text"], textarea, select {
  width: 100%; padding: .5rem .75rem;
  border: 2px solid #757575; border-radius: var(--radius);
  font-size: 1rem; font-family: inherit;
}
input[type="text"]:focus, textarea:focus, select:focus {
  border-color: var(--clr-focus); outline: 3px solid var(--clr-focus); outline-offset: 0;
}
input[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--clr-inc-border);
}
.field-error { color: var(--clr-inc-text); font-size: .9rem; margin-bottom: .35rem; min-height: 1.2em; }

.radio-label { display: block; margin-bottom: .5rem; cursor: pointer; font-weight: normal; }
.radio-label input { margin-right: .5rem; }

button {
  background: var(--clr-focus); color: #fff;
  border: none; border-radius: var(--radius);
  padding: .6rem 1.25rem; font-size: 1rem;
  cursor: pointer; font-weight: 600;
}
button:hover { background: #003d99; }
button:disabled { opacity: .6; cursor: not-allowed; }
button.btn-resolve {
  background: var(--clr-ok-text); font-size: .875rem; padding: .4rem .9rem; margin-top: .5rem;
}
button.btn-delete {
  background: var(--clr-inc-text); font-size: .875rem; padding: .4rem .9rem; margin-top: .5rem; margin-left: .5rem;
}

/* Admin services list */
#liste-services-admin { list-style: none; }
#liste-services-admin li {
  display: flex; align-items: center; gap: 1rem;
  padding: .65rem 0; border-bottom: 1px solid #e0e0e0; flex-wrap: wrap;
}
#liste-services-admin label { font-weight: 600; flex: 1; margin: 0; min-width: 200px; }
#liste-services-admin select { width: auto; min-width: 200px; }

/* ===== LOADER ===== */
.loader { color: #555; font-style: italic; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  #liste-services li { flex-direction: column; align-items: flex-start; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
