:root {
  color-scheme: light dark;
  --bg: #fff;
  --fg: #111;
  --muted: #6b7280;
  --primary: #0D47A1;
  --border: #e5e7eb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0d;
    --fg: #f3f4f6;
    --border: #1f2937;
    --muted: #9ca3af;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Roboto', system-ui, -apple-system, Segoe UI, Arial, sans-serif;
}

/* === HEADER avec image + overlay et titres lisibles === */
header {
  position: relative;
  top: 0;
  z-index: 10;
  text-align: center;
  padding: 32px 12px 24px;
  border-bottom: 1px solid var(--border);
  background: url("./icons/foie-band.jpg") center/cover no-repeat;
}

/* voile sombre pour la lisibilité du texte */
header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 0;
}

/* Tout le contenu du header au-dessus du voile */
header * {
  position: relative;
  z-index: 1;
}

/* Titres généraux */
h1 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 700;
  color: #0D47A1;
}

.subtitle {
  margin: 0 0 20px 0;
  font-size: 16px;
  font-weight: 400;
  color: #374151;
}

.subtitle strong {
  font-weight: 700;
  color: #111827;
}

/* Forcer les couleurs des titres DANS le header */
header h1 {
  color: #fff;
}

header .subtitle {
  color: #f1f5f9;
}

header .subtitle strong {
  color: #fff;
}

/* Recherche */
.search-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  position: relative;
}

header .search-wrap {
  margin-top: 8px;
}

#q {
  flex: 1;
  padding: 10px 12px;
  padding-right: 30px; /* pour laisser la place à la croix */
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
}

/* Champ de recherche dans le header (sur l'image) */
header .search-wrap input[type="search"] {
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  padding: 10px 12px;
  width: min(520px, 92vw);
}

/* Lien "Signaler" en haut à droite, blanc */
header .report-actions {
  position: absolute;
  top: 12px;
  right: 12px;
}

header .report-actions .link {
  color: #fff;
  text-decoration: underline;
}

/* Croix pour effacer la recherche */
.clear-x {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  cursor: pointer;
  color: #888;
  display: none;
  user-select: none;
}

/* Masquer le bouton clear natif des navigateurs desktop */
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

input[type="search"]::-ms-clear {
  display: none;
}

input[type="search"]::-moz-search-clear {
  display: none;
}

/* Liste des contacts */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.name {
  font-weight: 700;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phones {
  list-style: none;
  margin: 6px 0 0 0;
  padding: 0;
}

.phone-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.phone {
  font-size: 15px;
  color: var(--fg);
  font-weight: 400;
}

/* —————————— FOOTER —————————— */
footer {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
}

/* Mobile : un peu plus haut */
@media (max-width: 640px) {
  footer {
    padding: 16px 22px;
    font-size: 16px;
  }
}

.footer-left,
.footer-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.link {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--primary);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

/* —————————— MODALES —————————— */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal.hidden {
  display: none;
}

.modal-box {
  width: min(560px, 92vw);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 12px;
}

.modal input,
.modal textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 6px 0;
  font-size: 16px;
}

#c-phones {
  min-height: 120px;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Boutons */
button {
  cursor: pointer;
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
}

button.secondary {
  background: #64748b;
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

button.danger {
  background: #b91c1c;
}

