/* styles.css — brique 5 : charte graphique de Victor, VERSION SOMBRE (mode nuit).
   Palette et typo extraites de ses 3 fichiers HTML. Fond sombre, texte clair. */

:root {
  /* Marque */
  --magenta:        #A1228B;
  --magenta-bright: #D14FBF;  /* magenta eclairci, lisible sur fond sombre */
  --magenta-deep:   #3D0C36;
  --rose-fluo:      #E91E63;
  --rose-light:     #FCE7F1;
  /* Fonds sombres & neutres */
  --bg:         #191419;   /* fond de page, tres sombre (plum) */
  --surface:    #241E28;   /* tableaux, cartes */
  --surface-2:  #2E2630;   /* en-tetes, bandeaux */
  --border:     #3A3340;
  --texte:      rgba(255, 255, 255, 0.90);
  --texte-soft: rgba(255, 255, 255, 0.62);
  /* Statuts (versions eclaircies pour le fond sombre) */
  --vert:   #4fbf85;
  --orange: #f2a03d;
  --rouge:  #ec6a5f;
  /* Typo */
  --sans:  'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: 'Playfair Display', Georgia, serif;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; max-width: 100%; }

body {
  font-family: var(--sans);
  color: var(--texte);
  margin: 0;
  padding: 28px;
  background: var(--bg);
  line-height: 1.45;
  overflow-x: hidden;   /* jamais de defilement horizontal / effet "flottant" */
}

/* En-tete */
header { border-bottom: 3px solid var(--magenta); padding-bottom: 12px; margin-bottom: 18px; }
header h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 26px;
  color: var(--rose-light);
  margin: 0 0 4px;
}
.today { margin: 0; color: var(--texte-soft); font-size: 14px; }
.today span { font-weight: 600; color: var(--texte); }

/* Onglets */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 18px; }
.tab {
  border: none; background: transparent; padding: 10px 18px; cursor: pointer;
  font-family: var(--sans); font-size: 15px; color: var(--texte-soft);
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--magenta-bright); }
.tab.active { color: var(--rose-light); font-weight: 600; border-bottom-color: var(--magenta-bright); }

/* Vues */
.view { display: none; }
.view.active { display: block; }

/* Tableaux */
table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  font-size: 13px; border-radius: 8px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th {
  background: var(--surface-2); font-weight: 600; color: var(--rose-light);
  position: sticky; top: 0; font-size: 12px; letter-spacing: 0.02em;
}
tr.section td {
  background: var(--magenta-deep); color: var(--rose-light); font-weight: 700;
  font-family: var(--serif); font-size: 15px; padding: 11px 12px;
  border-left: 4px solid var(--magenta-bright);
}
.notes { color: var(--texte-soft); font-size: 12px; margin-top: 3px; }
.trou { color: var(--rouge); font-weight: 600; }

/* Tint des lignes de diffusion selon l'urgence */
tr.row-vert   td:first-child { border-left: 4px solid var(--vert); }
tr.row-orange td:first-child { border-left: 4px solid var(--orange); }
tr.row-rouge  td:first-child { border-left: 4px solid var(--rouge); }
tr.row-orange { background: rgba(242, 160, 61, 0.08); }
tr.row-rouge  { background: rgba(236, 106, 95, 0.09); }

/* Badges */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.vert   { background: rgba(79, 191, 133, 0.18); color: #7fe0aa; }
.badge.orange { background: rgba(242, 160, 61, 0.18); color: #f2b56b; }
.badge.rouge  { background: rgba(236, 106, 95, 0.18); color: #f0928a; }

/* Bilan */
.bilan {
  margin-bottom: 14px; font-size: 14px; color: var(--texte);
  background: var(--surface); padding: 12px 14px; border-radius: 8px;
  border-left: 4px solid var(--magenta-bright);
}
.bilan strong { color: var(--rose-light); }
.bilan .badge { margin-left: 4px; }

/* ===== Mobile : le tableau devient des cartes empilees (< 640px) ===== */
@media (max-width: 640px) {
  body { padding: 16px; }
  header h1 { font-size: 22px; }

  /* onglets : chacun prend la moitie de la largeur, texte centre qui tient */
  .tabs { gap: 4px; }
  .tab { flex: 1 1 0; min-width: 0; padding: 10px 6px; font-size: 14px; text-align: center; }

  table { display: block; background: transparent; box-shadow: none; border-radius: 0; }
  thead { display: none; }         /* les libelles passent dans chaque carte */
  tbody { display: block; }
  tr { display: block; }

  /* chaque ligne de donnees = une carte */
  tr:not(.section) {
    background: var(--surface);
    border-radius: 10px;
    padding: 4px 2px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    border-left: 4px solid var(--border);
  }
  tr.row-vert   { border-left-color: var(--vert); }
  tr.row-orange { border-left-color: var(--orange); background: var(--surface); }
  tr.row-rouge  { border-left-color: var(--rouge); background: var(--surface); }

  td {
    display: block;
    border: none;
    padding: 5px 14px;
    text-align: left;
  }
  td:first-child { border-left: none; }
  td:empty { display: none; }       /* on masque les champs vides */
  td::before {
    content: attr(data-label) " : ";
    font-weight: 600;
    color: var(--texte-soft);
  }

  /* bandeaux de section : restent des titres pleine largeur */
  tr.section { margin: 16px 0 8px; }
  tr.section td {
    display: block; padding: 10px 12px;
    background: var(--magenta-deep); color: var(--rose-light);
    border-radius: 8px; border-left: 4px solid var(--magenta-bright);
  }
  tr.section td::before { content: none; }
}

/* Verrou de consultation */
.lock {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lock-box {
  background: var(--surface); border-radius: 12px; padding: 32px 28px;
  width: 100%; max-width: 360px; text-align: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  border-top: 3px solid var(--magenta);
}
.lock-box h2 {
  font-family: var(--serif); color: var(--rose-light);
  margin: 0 0 6px; font-size: 22px;
}
.lock-box p { color: var(--texte-soft); font-size: 14px; margin: 0 0 18px; }
.lock-box input {
  width: 100%; padding: 11px 14px; font-size: 15px; font-family: var(--sans);
  background: var(--bg); color: var(--texte);
  border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px;
}
.lock-box input:focus { outline: none; border-color: var(--magenta-bright); }
.lock-box button {
  width: 100%; padding: 11px; font-size: 15px; font-weight: 600; font-family: var(--sans);
  color: #fff; background: var(--magenta); border: none; border-radius: 8px; cursor: pointer;
}
.lock-box button:hover { background: var(--magenta-bright); }
.lock-error { color: var(--rouge) !important; min-height: 18px; margin: 10px 0 0 !important; font-weight: 600; }

/* Legende */
footer {
  margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px;
}
.legend-title { color: var(--texte-soft); font-weight: 600; }
