@import url('./fonts.css');

/* Charte validée (spec §8, maquette 2026-10-23-dashboard-maquette.html). */
:root {
  --ficsit-orange: #FA9549;   /* fonds et accents, toujours avec du texte sombre dessus */
  --orange-text:   #A04A0B;   /* orange lisible sur fond clair (6:1) */
  --blue-gray:     #5F668C;   /* peinture secondaire par défaut du jeu (5,6:1) */
  --charcoal:      #2A2C31;
  --bg:      #F3F0EA;
  --surface: #FFFFFF;
  --border:  #D6D0C4;
  --text:    #1C1D21;
  --text-2:  #464A55;
  --ok:      #17692C;  --ok-bg:  #E1F2E4;
  --bad:     #B3261E;  --bad-bg: #FBE6E4;
  --warn:    #8A5A00;  --warn-bg: #FFF1D6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Montserrat", system-ui, sans-serif; background: var(--bg); color: var(--text);
       font-size: 17px; line-height: 1.5; font-weight: 500; min-height: 100vh; }
button, input { font-family: inherit; }
:focus-visible { outline: 3px solid var(--blue-gray); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ===== En-tête anthracite + bande de danger ===== */
.hdr { background: var(--charcoal); color: #fff; display: flex; align-items: center; gap: 16px; padding: 16px 24px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark { width: 38px; height: 38px; border-radius: 8px; background: var(--ficsit-orange); color: var(--charcoal);
        display: grid; place-items: center; font-weight: 800; font-size: 20px; flex-shrink: 0; }
.brand b { font-size: 20px; font-weight: 800; letter-spacing: .04em; color: var(--ficsit-orange); }
.brand span { display: block; font-size: 15px; color: #E9E7E2; font-weight: 600; }
.hdr .sp { flex: 1; }
.logout { background: none; color: #fff; border: 2px solid #6B6F78; border-radius: 8px; padding: 6px 14px; font-weight: 700; font-size: 15px; cursor: pointer; }
.logout:hover { border-color: #fff; }
.hazard { height: 8px; background: repeating-linear-gradient(-45deg, var(--ficsit-orange) 0 14px, var(--charcoal) 14px 28px); }

.page { padding: 24px; display: grid; gap: 20px; max-width: 1100px; margin: 0 auto; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 22px 24px; min-width: 0; }
.card h2 { font-size: 15px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2);
           margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.card h2::before { content: ""; width: 6px; height: 18px; background: var(--ficsit-orange); border-radius: 2px; }

/* ===== Bandeau d'alerte ===== */
.banner { background: var(--bad-bg); color: var(--bad); border: 1px solid #F0B8B3; border-radius: 10px; padding: 12px 16px; font-weight: 700; }

/* ===== Bloc état ===== */
.srvstate { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; border-left: 8px solid var(--ok); }
.srvstate.down { border-left-color: var(--bad); }
.srvstate.wait { border-left-color: #C98A00; }
.srvstate.pause { border-left-color: var(--blue-gray); }
.badge { display: inline-flex; align-items: center; gap: 10px; padding: 8px 18px; border-radius: 999px;
         font-weight: 800; font-size: 18px; letter-spacing: .04em; white-space: nowrap; }
.badge::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.badge.on   { background: var(--ok-bg);  color: var(--ok); }
.badge.off  { background: var(--bad-bg); color: var(--bad); }
.badge.wait { background: var(--warn-bg); color: var(--warn); }
.badge.pause { background: #E8E9F0; color: #4A5070; } /* gris-bleu du jeu, 6,4:1 */
.uptime { font-size: 30px; font-weight: 800; line-height: 1.15; }
.uptime small { display: block; font-size: 16px; font-weight: 600; color: var(--text-2); margin-top: 4px; }
.uptime small.unexpected { color: var(--bad); font-weight: 800; }
.actions { margin-left: auto; display: flex; gap: 12px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 17px; font-weight: 700;
       padding: 12px 22px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.primary { background: var(--ficsit-orange); color: var(--charcoal); border-color: #E07A2C; }
.btn.primary:hover { background: #F7863A; }
.btn.secondary { background: var(--surface); color: var(--blue-gray); border-color: var(--blue-gray); }
.btn.secondary:hover { background: #F1F2F7; }
.btn.danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.danger.solid { background: var(--bad); color: #fff; }
.btn.small { padding: 10px 18px; font-size: 16px; }
.btn.big { font-size: 20px; padding: 16px 26px; }

/* ===== Chiffres clés ===== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; min-width: 0; }
.stat .k { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.stat .v { font-size: 28px; font-weight: 800; margin-top: 2px; }
.stat .v em { font-style: normal; color: var(--text-2); font-size: 20px; font-weight: 700; }
.meter { height: 8px; background: #E7E2D8; border-radius: 99px; margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--blue-gray); border-radius: 99px; transition: width .4s; }
.meter i.high { background: var(--bad); }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ===== Listes ===== */
.item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid #ECE7DE; }
.item:first-child { border-top: none; padding-top: 0; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.dot.on { background: #2E9E4B; box-shadow: 0 0 0 4px var(--ok-bg); }
.dot.off { background: #fff; border: 3px solid #8C909A; }
.name { font-weight: 700; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { margin-left: auto; text-align: right; font-size: 15px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.meta.on { color: var(--ok); font-weight: 700; }
.file { min-width: 0; }
.file .name { font-size: 17px; }
.file .sub { font-size: 15px; color: var(--text-2); font-weight: 600; }
.dl { margin-left: auto; flex-shrink: 0; background: var(--blue-gray); color: #fff; font-weight: 700; font-size: 15px;
      padding: 9px 16px; border-radius: 8px; text-decoration: none; }
.dl:hover { background: #4E5475; }
.more { display: inline-block; margin-top: 12px; color: var(--blue-gray); font-weight: 700; font-size: 17px; text-decoration: underline;
        text-underline-offset: 3px; background: none; border: none; cursor: pointer; padding: 0; }
.empty { color: var(--text-2); font-weight: 600; }
.group-title { font-size: 15px; font-weight: 800; color: var(--orange-text); text-transform: uppercase; letter-spacing: .06em; margin: 16px 0 4px; }
.group-title:first-child { margin-top: 0; }

/* ===== Logs ===== */
.logbar { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.search { flex: 1; min-width: 200px; border: 2px solid var(--border); border-radius: 10px; padding: 10px 14px; color: var(--text); font-size: 16px; background: #fff; }
.search::placeholder { color: var(--text-2); }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: var(--text); padding: 10px 6px; cursor: pointer; position: relative; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle i { width: 40px; height: 24px; border-radius: 99px; background: #8C909A; position: relative; transition: background .2s; }
.toggle i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; }
.toggle input:checked + i { background: var(--ok); }
.toggle input:checked + i::after { left: 19px; }
.toggle input:focus-visible + i { outline: 3px solid var(--blue-gray); outline-offset: 2px; }
.logs { background: #FBFAF7; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; max-height: 440px; overflow: auto;
        font-family: "Cascadia Mono", Consolas, "Courier New", monospace; font-size: 15px; line-height: 1.7; color: #23252B; }
.logs .ln { white-space: pre-wrap; word-break: break-word; }
.logs .t { color: var(--text-2); }
.logs .j { color: var(--ok); font-weight: 700; }
.logs .w { color: var(--warn); font-weight: 700; }
.logs .e { color: var(--bad); font-weight: 700; }
.logs .empty { font-family: "Montserrat", system-ui, sans-serif; }

/* ===== Blueprints ===== */
.card-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin-bottom: 0; }
.card-sub { color: var(--text-2); font-weight: 600; font-size: 15px; }
.card-head .sp { flex: 1; }
.reco { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: #FFF5EC; border: 1px solid #F6CFA9;
        border-left: 6px solid var(--ficsit-orange); border-radius: 10px; padding: 14px 18px; margin-bottom: 14px; }
.reco p { flex: 1; min-width: 240px; color: var(--text); font-weight: 600; }
.reco p small { display: block; color: var(--text-2); font-weight: 600; font-size: 15px; margin-top: 2px; }
.bp-icon { width: 40px; height: 40px; border-radius: 8px; background: #E8E9F0; display: grid; place-items: center;
           font-weight: 800; color: #4A5070; flex-shrink: 0; font-size: 15px; }
.file { flex: 1; }
.tag { display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 800;
       background: var(--warn-bg); color: var(--warn); vertical-align: 2px; white-space: nowrap; }
.drop { display: block; border: 3px dashed var(--blue-gray); border-radius: 12px; background: #F6F7FA; padding: 22px;
        text-align: center; color: var(--text); font-weight: 700; cursor: pointer; }
.drop.over { background: #E8E9F0; border-color: #4A5070; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 3px solid var(--blue-gray); outline-offset: 2px; }
.drop small { display: block; color: var(--text-2); font-weight: 600; margin-top: 4px; font-size: 15px; }
.found { margin-top: 12px; max-height: 40vh; overflow: auto; }
.found .item { padding: 10px 0; }
.found .state { margin-left: auto; text-align: right; font-weight: 700; font-size: 15px; max-width: 55%; }
.found .ok { color: var(--ok); }
.found .warn { color: var(--warn); }
.found .bad { color: var(--bad); }
.dialog-error { color: var(--bad); font-weight: 700; margin-top: 12px; }

/* ===== Boîtes de dialogue ===== */
dialog { border: 1px solid var(--border); border-radius: 14px; padding: 26px 28px; max-width: min(560px, calc(100vw - 32px));
         width: 100%; color: var(--text); background: var(--surface); box-shadow: 0 12px 40px rgba(42,44,49,.25); margin: auto; }
dialog::backdrop { background: rgba(42,44,49,.55); }
dialog h3 { font-size: 22px; font-weight: 800; margin-bottom: 10px; }
dialog p { color: var(--text-2); margin-bottom: 8px; }
dialog p.strong { color: var(--text); font-weight: 700; }
.dialog-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.dialog-list { max-height: 60vh; overflow: auto; margin: 8px 0; }

/* ===== Page de connexion ===== */
.login-wrap { display: grid; place-items: center; padding: 48px 16px; }
.login-card { width: 100%; max-width: 420px; display: grid; gap: 12px; }
.login-card h1 { font-size: 26px; font-weight: 800; }
.login-intro { color: var(--text-2); }
.login-card label { font-weight: 700; margin-top: 4px; }
.login-card input { border: 2px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 18px; width: 100%; color: var(--text); }
.login-card input:focus { border-color: var(--blue-gray); }
.login-card .btn { margin-top: 8px; width: 100%; }
.login-error { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 10px 14px; font-weight: 700; }

/* ===== Écrans moyens ===== */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two { grid-template-columns: 1fr; }
  .actions { margin-left: 0; }
}

/* ===== Téléphone : bloc d'état centré, bouton pleine largeur ===== */
@media (max-width: 640px) {
  .hdr { padding: 12px 16px; }
  .mark { width: 32px; height: 32px; font-size: 17px; }
  .brand b { font-size: 17px; }
  .brand span { font-size: 14px; }
  .page { padding: 14px; gap: 14px; }
  .card { padding: 18px; }
  .srvstate { flex-direction: column; align-items: stretch; text-align: center; gap: 12px;
              border-left: 1px solid var(--border); border-top: 8px solid var(--ok); }
  .srvstate.down { border-left-color: var(--border); border-top-color: var(--bad); }
  .srvstate.wait { border-left-color: var(--border); border-top-color: #C98A00; }
  .srvstate.pause { border-left-color: var(--border); border-top-color: var(--blue-gray); }
  .srvstate .badge { align-self: center; }
  .srvstate .actions { margin: 0; flex-direction: column; }
  .srvstate .actions .btn { width: 100%; }
  .srvstate .actions .btn.primary { font-size: 20px; padding: 16px 26px; }
  .stats { gap: 14px; }
  .dl-text { display: none; }
  .card-head .btn, .reco .btn { width: 100%; justify-content: center; }
}
