/* WAT Manager — UI moderne basée sur la palette WAT :
   lavande #CBBFF5 (accent), marine #100F4B (action), vert #4FF78F (positif). */

@font-face {
    font-family: 'Gilroy';
    src: url('../fonts/Gilroy-Regular.woff2') format('woff2');
    font-weight: 400;
}
@font-face {
    font-family: 'Gilroy';
    src: url('../fonts/Gilroy-Medium.woff2') format('woff2');
    font-weight: 500 700;
}

:root {
    --bg: #F5F3FB;
    --surface: #ffffff;
    --border: #E7E2F6;
    --ink: #1F1D3A;
    --ink-2: #6B6889;
    --brand: #100F4B;
    --brand-hover: #23215F;
    --accent: #CBBFF5;
    --accent-soft: #F1EDFB;
    --green: #4FF78F;
    --ok: #15803D;      --ok-bg: #E4F9EE;   --ok-dot: #22C55E;
    --warn: #92600A;    --warn-bg: #FDF1DC; --warn-dot: #F59E0B;
    --crit: #B91C1C;    --crit-bg: #FCE9E9; --crit-dot: #EF4444;
    --off: #4B5563;     --off-bg: #EDEFF2;  --off-dot: #6B7280;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(16, 15, 75, .07), 0 1px 2px rgba(16, 15, 75, .05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    /* Fond lavande plein, comme le WAT Tracker connecté. */
    background: var(--accent);
    color: var(--ink);
    font-family: 'Gilroy', sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

#wrapper { min-height: 100vh; display: flex; flex-direction: column; }

/* ---- Header : logo posé sur le lavande ---- */
#header {
    padding: 18px max(24px, calc((100% - 1160px) / 2)) 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
#logo a { display: inline-flex; align-items: center; gap: 22px; }
#logo a:hover { text-decoration: none; }
#logo .logo-wat { height: 62px; width: auto; }
#logo .logo-title { height: 52px; width: auto; }
@media (max-width: 700px) {
    #logo .logo-title { display: none; }
}

/* ---- Barre de navigation marine (onglets façon Tracker) ---- */
#mainnav {
    background: var(--brand);
    position: sticky;
    top: 0;
    z-index: 10;
}
#mainnav .nav-inner {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: stretch;
    gap: .2rem;
}
#mainnav a.tab {
    color: #fff;
    font-weight: 600;
    padding: 13px 20px;
    display: inline-flex;
    align-items: center;
}
#mainnav a.tab:hover { background: rgba(255, 255, 255, .12); text-decoration: none; }
#mainnav a.tab.active { background: #0A0A33; }
#mainnav a.nav-add {
    margin-left: auto;
    align-self: center;
    background: var(--green);
    color: var(--brand);
    font-weight: 700;
    font-size: 14px;
    padding: 7px 14px;
    border-radius: 999px;
}
#mainnav a.nav-add:hover { filter: brightness(.94); text-decoration: none; }

/* ---- Contenu : feuille blanche sur le lavande ---- */
#content {
    width: 100%;
    max-width: 1160px;
    margin: 20px auto 40px;
    padding: 28px 28px 36px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 2px 14px rgba(16, 15, 75, .10);
    flex: 1;
}

h2, .page-title { font-size: 21px; font-weight: 700; margin-bottom: .8em; }
h4 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin: 2em 0 .7em; }
p { margin-bottom: .8em; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }
code { background: var(--accent-soft); padding: .1em .4em; border-radius: 4px; font-size: .92em; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.2em;
}
.page-header h2 { margin: 0; }

/* ---- Cartes ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin-bottom: 1.4em;
}
.card > table:last-child { margin-bottom: 0; }

/* ---- Tuiles KPI ---- */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 1.6em;
}
.stat-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 18px;
}
.stat-tile .stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-tile .stat-label { color: var(--ink-2); font-size: 13px; display: flex; align-items: center; gap: .45em; }
.stat-tile.is-zero .stat-value { color: var(--ink-2); font-weight: 400; }

/* ---- Messages flash ---- */
.messages {
    padding: .75rem 1.1rem;
    margin-bottom: 1.2em;
    border-radius: 10px;
    background: var(--ok-bg);
    color: var(--ok);
    font-weight: 600;
}
.messages.warning { background: var(--warn-bg); color: var(--warn); }

/* ---- Tableaux ---- */
table { border-collapse: collapse; width: 100%; margin-bottom: 1.2em; }
th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-2);
    border-bottom: 1px solid var(--border);
}
td { padding: 11px 12px; border-bottom: 1px solid #F0EDF9; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #F8F6FD; }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: var(--accent-soft); }

/* ---- Boutons ---- */
button, input[type="submit"], a.button {
    display: inline-flex;
    align-items: center;
    gap: .4em;
    background: var(--brand);
    border: 1px solid var(--brand);
    border-radius: 10px;
    color: #fff;
    font-family: 'Gilroy', sans-serif;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
    line-height: 1.3;
    transition: background .12s ease;
}
button:hover, input[type="submit"]:hover, a.button:hover {
    background: var(--brand-hover);
    text-decoration: none;
}
button.secondary, a.button.secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--ink);
}
button.secondary:hover, a.button.secondary:hover { background: var(--accent-soft); }
button.danger, a.button.danger {
    background: var(--surface);
    border-color: #F3CBCB;
    color: var(--crit);
}
button.danger:hover, a.button.danger:hover { background: var(--crit-bg); }
button.small, a.button.small { padding: 5px 12px; font-size: 13px; }
button:focus-visible, a.button:focus-visible, a:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 1px;
}

/* ---- Formulaires ---- */
label { display: block; font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
input[type="text"], input[type="email"], input[type="url"], input[type="password"], textarea, select {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-family: 'Gilroy', sans-serif;
    font-size: 16px;
    padding: 11px 13px;
    width: 100%;
    max-width: 620px;
    color: var(--ink);
}
input:focus, textarea:focus, select:focus {
    outline: 3px solid var(--accent);
    outline-offset: 0;
    border-color: var(--brand);
}
textarea { min-height: 100px; }
.form-item, form > div > div { margin-bottom: 1.6em; }
form ul { list-style: none; }

/* Groupes de cases à cocher : case et libellé côte à côte, gros clic. */
.checkbox-group {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px 10px;
    align-items: center;
    max-width: 620px;
    padding: 4px 0;
}
.checkbox-group label {
    display: inline;
    font-weight: 400;
    font-size: 16px;
    margin: 0;
    cursor: pointer;
}
input[type="checkbox"], input[type="radio"] {
    width: 19px;
    height: 19px;
    margin: 0;
    accent-color: var(--brand);
    cursor: pointer;
}
input[type="checkbox"] + label, input[type="radio"] + label {
    display: inline;
    font-weight: 400;
    font-size: 16px;
    margin: 0;
}
.help-text, .form-help { color: var(--ink-2); font-size: 14px; margin-top: 5px; }
ul.form-errors { color: var(--crit); list-style: none; margin-bottom: 1em; }

/* ---- Pastilles (toujours accompagnées d'un libellé ou badge) ---- */
.dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; vertical-align: baseline; flex: none; }
.dot-green { background: var(--ok-dot); }
.dot-yellow { background: var(--warn-dot); }
.dot-red { background: var(--crit-dot); }
.dot-unreachable { background: var(--off-dot); }
.dot-unknown { background: transparent; border: 2px solid var(--off-dot); }

.badge {
    font-size: 12px;
    font-weight: 600;
    padding: .18rem .6rem;
    border-radius: 999px;
    background: var(--off-bg);
    color: var(--off);
    white-space: nowrap;
}
.badge-security { background: var(--crit-bg); color: var(--crit); }
.badge-update { background: var(--warn-bg); color: var(--warn); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-custom { background: var(--accent-soft); color: var(--brand); }

.php-warn { color: var(--warn); font-weight: 600; white-space: nowrap; cursor: help; }
.muted { color: var(--ink-2); font-style: italic; }
small { font-size: 13px; color: var(--ink-2); }
td form { display: inline; }
.actions-inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* ---- Footer : discret, sur le lavande ---- */
#footer {
    color: var(--brand);
    opacity: .65;
    padding: 0 max(24px, calc((100% - 1160px) / 2)) 20px;
    font-size: 13px;
}
#footer a { color: var(--brand); }
