/* ==========================================================================
   Bobo GMAO Démo — Thème Industriel Élec (Dark Cyber-SCADA & Light Mode)
   Bootstrap 5 + Bootstrap Icons
   ========================================================================== */

:root,
[data-bs-theme="dark"] {
    --bobo-bg-base: #070d17;
    --bobo-bg-sidebar: #09101c;
    --bobo-bg-topbar: rgba(11, 19, 34, 0.92);
    --bobo-bg-panel: rgba(16, 24, 40, 0.90);
    --bobo-bg-panel-alt: rgba(21, 31, 50, 0.88);
    --bobo-bg-input: #10192b;
    --bobo-border: #25344d;
    --bobo-border-cyan: rgba(0, 232, 232, 0.45);
    --bobo-cyan: #00e8e8;
    --bobo-cyan-soft: rgba(0, 232, 232, 0.14);
    --bobo-cyan-text: #04131a;
    --bobo-amber: #e2a559;
    --bobo-amber-soft: rgba(226, 165, 89, 0.15);
    --bobo-green: #22d37b;
    --bobo-text-main: #edf2f9;
    --bobo-text-muted: #8b9bb4;
    --bobo-row-odd: #0a1733;
    --bobo-row-even: #242933;
    --bobo-shadow: 0 12px 32px rgba(0, 0, 0, 0.48);
    --bobo-circuit-dot: rgba(0, 232, 232, 0.08);
}

[data-bs-theme="light"] {
    --bobo-bg-base: #eef3f9;
    --bobo-bg-sidebar: #ffffff;
    --bobo-bg-topbar: rgba(255, 255, 255, 0.94);
    --bobo-bg-panel: #ffffff;
    --bobo-bg-panel-alt: #f5f8fc;
    --bobo-bg-input: #f8fafd;
    --bobo-border: #cfdbe8;
    --bobo-border-cyan: rgba(0, 148, 168, 0.45);
    --bobo-cyan: #0098ad;
    --bobo-cyan-soft: rgba(0, 152, 173, 0.12);
    --bobo-cyan-text: #ffffff;
    --bobo-amber: #b86b11;
    --bobo-amber-soft: rgba(184, 107, 17, 0.12);
    --bobo-green: #129452;
    --bobo-text-main: #102033;
    --bobo-text-muted: #5b6e86;
    --bobo-row-odd: #f2f7fc;
    --bobo-row-even: #ffffff;
    --bobo-shadow: 0 8px 24px rgba(16, 32, 51, 0.08);
    --bobo-circuit-dot: rgba(0, 152, 173, 0.08);
}

html, body {
    min-height: 100vh;
    background-color: var(--bobo-bg-base);
    color: var(--bobo-text-main);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-image:
        radial-gradient(var(--bobo-circuit-dot) 1px, transparent 1px),
        linear-gradient(135deg, rgba(0, 232, 232, 0.03) 0%, transparent 45%, rgba(226, 165, 89, 0.03) 100%);
    background-size: 22px 22px, 100% 100%;
}

/* Layout global : Sidebar fixe à gauche + Zone principale */
.bobo-app-shell {
    display: flex;
    min-height: 100vh;
}

.bobo-sidebar {
    width: 68px;
    flex-shrink: 0;
    background: var(--bobo-bg-sidebar);
    border-right: 1px solid var(--bobo-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.9rem 0.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1030;
}

.bobo-logo-mark {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bobo-cyan-soft);
    border: 1px solid var(--bobo-border-cyan);
    color: var(--bobo-cyan);
    text-decoration: none;
    margin-bottom: 1.4rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bobo-logo-mark:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 14px var(--bobo-cyan-soft);
    color: var(--bobo-cyan);
}

.bobo-side-nav {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
    align-items: center;
}

.bobo-side-link {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bobo-text-muted);
    text-decoration: none;
    font-size: 1.2rem;
    position: relative;
    transition: all 0.16s ease;
    border: 1px solid transparent;
}

.bobo-side-link:hover {
    color: var(--bobo-cyan);
    background: var(--bobo-cyan-soft);
}

.bobo-side-link.active {
    color: var(--bobo-cyan);
    background: var(--bobo-cyan-soft);
    border-color: var(--bobo-border-cyan);
    box-shadow: 0 0 12px var(--bobo-cyan-soft);
}

.bobo-side-link.active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: var(--bobo-cyan);
}

/* Zone principale (Topbar + Main + Footer) */
.bobo-main-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.bobo-topbar {
    background: var(--bobo-bg-topbar);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--bobo-border);
    padding: 0.65rem 1.4rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.bobo-breadcrumb-trail {
    font-size: 0.85rem;
    color: var(--bobo-text-muted);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.bobo-breadcrumb-trail .trail-highlight {
    color: var(--bobo-text-main);
    font-weight: 500;
}

/* Signal bars +27% widget comme sur les maquettes PJ */
.bobo-signal-widget {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.28rem 0.65rem;
    border-radius: 8px;
    background: var(--bobo-bg-panel-alt);
    border: 1px solid var(--bobo-border);
    font-size: 0.82rem;
}

.bobo-signal-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    height: 15px;
}

.bobo-signal-bars span {
    width: 3px;
    border-radius: 2px;
}

.bobo-signal-bars span:nth-child(1) { height: 5px; background: var(--bobo-amber); }
.bobo-signal-bars span:nth-child(2) { height: 8px; background: var(--bobo-amber); }
.bobo-signal-bars span:nth-child(3) { height: 11px; background: #f4d06f; }
.bobo-signal-bars span:nth-child(4) { height: 15px; background: var(--bobo-green); }

.bobo-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bobo-bg-panel-alt);
    border: 1px solid var(--bobo-border);
    color: var(--bobo-text-main);
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}

.bobo-icon-btn:hover {
    border-color: var(--bobo-cyan);
    color: var(--bobo-cyan);
}

/* Cartes & Panneaux techniques */
.bobo-panel {
    background: var(--bobo-bg-panel);
    border: 1px solid var(--bobo-border);
    border-radius: 12px;
    box-shadow: var(--bobo-shadow);
}

.bobo-panel-cyan {
    border-color: var(--bobo-border-cyan);
}

.bobo-filter-box {
    background: var(--bobo-bg-panel);
    border: 1px solid var(--bobo-border);
    border-radius: 10px;
    padding: 0.7rem 0.95rem;
}

.bobo-filter-label {
    font-size: 0.85rem;
    color: var(--bobo-text-main);
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.bobo-select,
.bobo-input {
    background-color: var(--bobo-bg-input) !important;
    border: 1px solid var(--bobo-border) !important;
    color: var(--bobo-text-main) !important;
    border-radius: 8px;
    font-size: 0.92rem;
}

.bobo-select:focus,
.bobo-input:focus {
    border-color: var(--bobo-cyan) !important;
    box-shadow: 0 0 0 0.2rem var(--bobo-cyan-soft) !important;
}

/* Onglets Cyan (GE 1 / GE 2 et Coffret 1 / Coffret 2) */
.bobo-segmented-tabs {
    display: flex;
    background: var(--bobo-bg-panel-alt);
    border: 1px solid var(--bobo-border);
    border-radius: 9px;
    overflow: hidden;
    padding: 2px;
    gap: 2px;
}

.bobo-seg-tab {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.85rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--bobo-text-muted);
    text-decoration: none;
    border-radius: 7px;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.bobo-seg-tab:hover {
    color: var(--bobo-text-main);
}

.bobo-seg-tab.active {
    background: var(--bobo-cyan);
    color: var(--bobo-cyan-text);
    box-shadow: 0 0 14px var(--bobo-cyan-soft);
}

/* Boutons contour Cyan (Historique coffret, Tendances coffret, Schéma, PDR) */
.btn-bobo-outline {
    background: rgba(0, 232, 232, 0.07);
    border: 1px solid var(--bobo-border-cyan);
    color: var(--bobo-cyan);
    border-radius: 8px;
    font-weight: 500;
    padding: 0.42rem 0.9rem;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    transition: all 0.16s ease;
}

.btn-bobo-outline:hover {
    background: var(--bobo-cyan);
    color: var(--bobo-cyan-text);
    border-color: var(--bobo-cyan);
}

.btn-bobo-pill {
    border-radius: 999px;
    padding: 0.42rem 1.05rem;
}

.btn-bobo-cyan {
    background: var(--bobo-cyan);
    color: var(--bobo-cyan-text);
    border: 1px solid var(--bobo-cyan);
    border-radius: 8px;
    font-weight: 600;
    padding: 0.5rem 1.15rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: filter 0.15s ease;
}

.btn-bobo-cyan:hover {
    filter: brightness(1.08);
    color: var(--bobo-cyan-text);
}

/* Lignes de spécifications Clé / Valeur ambrée (comme sur PJ 2, 3, 4, 5, 6) */
.bobo-spec-heading {
    font-size: 0.82rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--bobo-text-muted);
    font-weight: 600;
    margin-bottom: 0.65rem;
}

.bobo-spec-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bobo-spec-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.58rem 0;
    border-bottom: 1px solid var(--bobo-border);
    gap: 1rem;
    font-size: 0.93rem;
}

.bobo-spec-row:last-child {
    border-bottom: none;
}

.bobo-spec-key {
    color: var(--bobo-text-main);
    font-weight: 400;
}

.bobo-spec-val {
    color: var(--bobo-amber);
    font-weight: 500;
    text-align: right;
}

.bobo-status-operational {
    color: var(--bobo-green) !important;
    font-weight: 600;
}

.bobo-equip-photo-wrap {
    background: #060b13;
    border-radius: 9px;
    overflow: hidden;
    border: 1px solid var(--bobo-border);
    aspect-ratio: 16 / 8.5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bobo-equip-photo-wrap.photo-light-bg {
    background: #ffffff;
}

.bobo-equip-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Tableau "Pannes et remplacements du coffret" (maquette PJ 1) */
.bobo-table-wrap {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--bobo-border);
}

.bobo-table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
}

.bobo-table thead th {
    background: var(--bobo-cyan);
    color: #04131a;
    font-weight: 700;
    font-size: 0.84rem;
    padding: 0.68rem 0.75rem;
    border: none;
    vertical-align: middle;
}

.bobo-table thead th a {
    color: #04131a;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.bobo-table tbody tr:nth-child(odd) {
    background-color: var(--bobo-row-odd);
}

.bobo-table tbody tr:nth-child(even) {
    background-color: var(--bobo-row-even);
}

.bobo-table tbody td {
    padding: 0.72rem 0.75rem;
    font-size: 0.86rem;
    color: var(--bobo-text-main);
    border-bottom: 1px solid var(--bobo-border);
    vertical-align: middle;
}

.bobo-text-amber {
    color: var(--bobo-amber) !important;
}

.bobo-text-cyan {
    color: var(--bobo-cyan) !important;
}

.bobo-badge-cyan {
    background: var(--bobo-cyan);
    color: var(--bobo-cyan-text);
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.28rem 0.65rem;
    border-radius: 6px;
    display: inline-block;
}

/* État vide "Aucun coffret associé" (maquette PJ 6) */
.bobo-empty-cabinet {
    min-height: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

/* Barre flottante d'actions rapides bas de fiche (maquette PJ 5) */
.bobo-bottom-dock {
    background: linear-gradient(180deg, rgba(0, 128, 148, 0.16) 0%, var(--bobo-bg-panel) 100%);
    border: 1px solid var(--bobo-border-cyan);
    border-radius: 12px;
    padding: 0.85rem 1.25rem;
    box-shadow: var(--bobo-shadow);
}

/* Footer applicatif */
.bobo-footer {
    margin-top: auto;
    border-top: 1px solid var(--bobo-border);
    background: var(--bobo-bg-topbar);
    padding: 0.8rem 1.4rem;
    font-size: 0.8rem;
    color: var(--bobo-text-muted);
}

/* Responsive mobile */
@media (max-width: 767.98px) {
    .bobo-sidebar {
        width: 54px;
    }
    .bobo-topbar {
        padding: 0.6rem 0.85rem;
    }
}

/* Reporting : hauteurs bornées pour éviter les chevauchements de graphiques. */
.report-gauge { height: 135px; position: relative; }
.report-gauge-value { position: absolute; inset: auto 0 6px; text-align: center; font-size: 1.55rem; font-weight: 700; pointer-events: none; }
.report-donut { height: 150px; position: relative; }
.report-line { height: 300px; position: relative; }
.report-legend { list-style: none; padding: 0; margin: .75rem 0 0; font-size: .8rem; color: var(--bobo-text-muted); }
.report-legend li { display: flex; justify-content: space-between; gap: .5rem; border-bottom: 1px solid var(--bobo-border); padding: .2rem 0; }
.report-legend strong { color: var(--bobo-text-main); }

.report-legend-dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; margin-right: .45rem; }
.report-color-0 { background: #0c8581; } .report-color-1 { background: #55a9c1; }
.report-color-2 { background: #e3a35d; } .report-color-3 { background: #d56d72; }
.report-color-4 { background: #7b82bc; } .report-color-5 { background: #86b886; }
