/* ============================================================
   JadinWeb — charte alignée sur FlamecWeb (et l'app MAUI) :
     Fond page : #e5eff0   Cartes : #437498 (bleu)
     Labels : white        Valeurs : greenyellow
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #e5eff0;
    color: #1d3a4d;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
    overflow-x: hidden;
}

:root {
    --jadin-primary: #437498;
    --jadin-bg: #e5eff0;
    --jadin-value: greenyellow;
}

/* ── App shell ─────────────────────────────────────────────── */
.jadin-app { display: flex; flex-direction: column; min-height: 100vh; background: var(--jadin-bg); }

.jadin-toolbar {
    position: sticky; top: 0; z-index: 100;
    background: #437498;
    display: flex; align-items: center; gap: 12px;
    padding: 8px 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    min-height: 52px;
}
.jadin-logo { height: 36px; cursor: pointer; user-select: none; -webkit-user-select: none; }
.toolbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.toolbar-gear { height: 28px; width: 28px; object-fit: contain; cursor: pointer; }
.status-icon { width: 28px; height: 28px; object-fit: contain; }
.toolbar-back {
    background: transparent; border: none; color: white; font-size: 26px; line-height: 1;
    cursor: pointer; min-width: 40px; min-height: 40px;
    display: flex; align-items: center; justify-content: center;
}
.toolbar-back:active { opacity: 0.5; }

.jadin-content { flex: 1; padding: 4px 0 16px; width: 100%; }
@media (min-width: 600px) { .jadin-content { max-width: 540px; margin: 0 auto; } }

.jadin-home { padding: 0 10px; }
.jadin-home-title { color: #1d3a4d; font-size: 1.4rem; margin: 14px 4px 8px; }

/* ── Cartes (FrameStyle MAUI : bleu, arrondi, ombre) ───────── */
.jadin-card {
    background-color: #437498;
    color: white;
    border-radius: 15px;
    margin: 10px;
    padding: 12px;
    box-shadow: 5px 5px 10px rgba(0,0,0,0.4);
}
.dash-card { margin: 10px; }
.jadin-card h2 { margin-top: 0; color: white; }

/* En-têtes / titres */
.dash-title { color: #1d3a4d; margin: 14px 10px 6px; font-size: 1.4rem; }
.dash-title .dash-topic { font-size: 0.85rem; opacity: 0.55; font-weight: 400; }
.dash-settings-link { cursor: pointer; margin-left: 8px; font-size: 1.1rem; opacity: 0.7; user-select: none; }
.dash-settings-link:hover { opacity: 1; }
.dash-card-head {
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 600; color: white; margin-bottom: 8px; font-size: 1.05rem;
}
.dash-card-action {
    font-size: 0.9rem; color: greenyellow; cursor: pointer; font-weight: 500;
    padding: 2px 6px; border-radius: 4px;
}

/* Listes clé / valeur */
.kv-list { display: flex; flex-direction: column; gap: 4px; color: white; font-size: 1.05rem; }
.kv-list strong { color: greenyellow; font-weight: bold; }
.txt-on  { color: greenyellow; }
.txt-off { color: #ffb3a8; }

/* ── Boutons ───────────────────────────────────────────────── */
.btn-open {
    background-color: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 8px; color: white; font-size: 1rem;
    padding: 8px 16px; cursor: pointer; min-height: 40px; font-weight: 500;
}
.btn-open:active { background-color: rgba(255,255,255,0.35); }
.jadin-hint { font-size: 0.85rem; opacity: 0.7; margin: 16px 10px; }

/* ── Accueil : cartes de site ──────────────────────────────── */
.site-card { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.site-card:active { transform: scale(0.99); opacity: 0.92; }
.site-num { font-size: 1.6rem; font-weight: bold; color: white; min-width: 30px; text-align: center; }
.site-info { flex: 1; }
.site-name { font-weight: 600; font-size: 1.15rem; color: white; }
.site-topic { font-size: 0.85rem; color: rgba(255,255,255,0.7); }
.site-detail { font-size: 0.95rem; color: white; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.site-detail strong { color: greenyellow; }
.site-status-icon { width: 40px; height: 40px; object-fit: contain; flex: 0 0 auto; }
.device-icon-sm { height: 22px; width: auto; vertical-align: middle; }

/* ── Icônes appareils ──────────────────────────────────────── */
.device-icon    { height: 48px; width: auto; object-fit: contain; }
.device-icon-lg { height: 80px; width: auto; object-fit: contain; }
.device-row { display: flex; align-items: center; gap: 14px; }
.device-row .kv-list { flex: 1; }

/* Switch image (≥44px touch) */
.icon-switch {
    width: 92px; height: 64px; object-fit: contain; cursor: pointer;
    user-select: none; -webkit-user-select: none;
}
.switch-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: white; }

/* ── Grille pompes ─────────────────────────────────────────── */
.pumps-row { display: flex; gap: 10px; flex-wrap: wrap; }
.pump-cell {
    flex: 1 1 0; min-width: 70px;
    background: rgba(255,255,255,0.12);
    border-radius: 10px; padding: 8px 6px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    color: white;
}
.pump-cell.pump-on  { background: rgba(173,255,47,0.18); }
.pump-num   { font-weight: 600; font-size: 0.95rem; }
.pump-rpm   { font-size: 0.8rem; color: greenyellow; }
.pump-consigne { font-size: 0.75rem; color: rgba(255,255,255,0.8); }

/* ── Réservoir ─────────────────────────────────────────────── */
.reservoir-block { display: flex; gap: 16px; align-items: center; }
.reservoir-bar-wrap { display: flex; flex-direction: column; align-items: center; }
.reservoir-bar {
    width: 36px; height: 90px; background: rgba(255,255,255,0.18);
    border-radius: 6px; position: relative; overflow: hidden;
}
.reservoir-fill {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, #2b88c8, #7bd0ef); transition: height 0.4s ease;
}
.reservoir-pct { font-size: 0.85rem; margin-top: 4px; color: greenyellow; font-weight: 600; }
.reservoir-block .kv-list { flex: 1; }

/* ── Groupe + jauge ────────────────────────────────────────── */
.group-block { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.group-right { display: flex; align-items: center; gap: 14px; flex: 1 1 200px; }
.group-right .kv-list { flex: 1; }
/* Jauge : taille figée, ne pas laisser le flex la comprimer/déformer (cf. FlamecWeb card-col-left) */
.fuel-gauge-svg { flex: 0 0 auto; display: block; overflow: visible; width: 100px; height: 110px; }

/* ── Commandes / paramètres ────────────────────────────────── */
.cmd-field { margin: 10px 0; color: white; }
.cmd-field > label { display: block; font-size: 0.95rem; margin-bottom: 4px; color: white; }
.cmd-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.cmd-back { margin: 16px 10px; }

/* Slider HTML (style FlamecWeb) */
.jadin-slider { width: 100%; height: 6px; accent-color: DeepSkyBlue; cursor: pointer; margin: 8px 0; }
/* Champ numérique souligné greenyellow */
.jadin-entry {
    background: transparent; border: none; border-bottom: 1px solid greenyellow;
    color: greenyellow; font-size: 1.25rem; width: 90px; text-align: center; outline: none;
    -moz-appearance: textfield;
}
.jadin-entry::-webkit-inner-spin-button, .jadin-entry::-webkit-outer-spin-button { -webkit-appearance: none; }

/* Texte / champs settings */
.settings-input {
    width: 100%; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.4);
    border-radius: 8px; color: white; font-size: 1rem; padding: 10px 12px; outline: none;
}
.settings-input::placeholder { color: rgba(255,255,255,0.45); }
.settings-input:focus { border-color: rgba(255,255,255,0.8); }
.settings-save-btn {
    width: 100%; background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.6);
    border-radius: 10px; color: white; font-size: 1.05rem; padding: 12px; cursor: pointer;
    margin-top: 16px; min-height: 48px;
}
.settings-save-btn:active { background-color: rgba(255,255,255,0.35); }
.settings-msg { text-align: center; margin-top: 10px; color: greenyellow; }

/* Boutons groupe électrogène (vert/rouge) */
.elec-actions { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 12px 0; }
.elec-btn {
    background: transparent; border: none; cursor: pointer; padding: 6px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    min-width: 44px; min-height: 44px;
}
.elec-btn:active { transform: scale(0.9); }
.elec-btn img { width: 120px; height: 80px; object-fit: contain; }
.elec-btn-label { color: white; font-size: 1.1rem; }

.flamec-divider, .conn-divider { border: none; border-top: 1px solid rgba(255,255,255,0.25); margin: 8px 0; }

/* Bandeau d'alerte */
.jadin-banner { border-radius: 8px; padding: 10px 14px; margin: 10px; font-size: 0.95rem; }
.jadin-banner-warn { background: rgba(255,255,255,0.15); color: #fff3d6; border: 1px solid rgba(255,221,128,0.6); }

/* ── Indicateur MQTT toolbar (animation) ───────────────────── */
@keyframes mqttPulse {
    0%   { opacity: 1;   transform: scale(1);   }
    50%  { opacity: 0.5; transform: scale(1.2); }
    100% { opacity: 1;   transform: scale(1);   }
}
.mqtt-pulse { animation: mqttPulse 0.4s ease-in-out; }

/* ── Badges connexion (page Settings) ──────────────────────── */
.conn-badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }
.conn-ok { background: #d8f3dd; color: #1f7a35; }
.conn-ko { background: #fde2dd; color: #b3311f; }
.conn-err { color: #ffb3a8; font-size: 0.9rem; }

/* ── Login ─────────────────────────────────────────────────── */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-card {
    background: #437498; color: white; border-radius: 15px; padding: 28px;
    box-shadow: 5px 5px 14px rgba(0,0,0,0.4); width: 100%; max-width: 360px;
}
.login-card h1 { color: white; margin: 0 0 4px 0; font-size: 1.8rem; }
.login-subtitle { margin: 0 0 20px 0; color: rgba(255,255,255,0.8); }
.login-card form { display: flex; flex-direction: column; gap: 8px; }
.login-card label { font-size: 0.85rem; margin-top: 8px; color: rgba(255,255,255,0.85); }
.login-card input[type="text"], .login-card input[type="password"] {
    padding: 10px 12px; border: 1px solid rgba(255,255,255,0.4); border-radius: 8px;
    font-size: 1rem; background: rgba(255,255,255,0.15); color: white;
}
.login-card input::placeholder { color: rgba(255,255,255,0.45); }
.login-card .remember-me { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; margin: 12px 0 4px; }
.login-card button[type="submit"] {
    background: rgba(255,255,255,0.2); color: white; padding: 12px; border: 1px solid rgba(255,255,255,0.6);
    border-radius: 10px; font-size: 1rem; font-weight: 500; cursor: pointer; margin-top: 16px;
}
.login-card button[type="submit"]:active { background: rgba(255,255,255,0.35); }
.login-error { background: rgba(255,80,60,0.2); color: #ffd7d0; padding: 10px; border-radius: 8px; margin-bottom: 12px; font-size: 0.9rem; border: 1px solid rgba(255,120,100,0.5); }

/* ── Scrollbar fine ────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #e5eff0; }
::-webkit-scrollbar-thumb { background: #437498; border-radius: 2px; }
