/* Charte graphique BETA ENERGY AFRIQUE (2016) */
:root {
    --brand-green: #066B36;
    --brand-green-dark: #04512a;
    --brand-orange: #ED662D;
    --brand-orange-dark: #d1541f;
    --brand-orange-medium: #F79552;
    --brand-peach: #FCC9A0;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f3f4f6;
    color: #111827;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--brand-green);
    color: white;
    padding: 0.75rem 1.5rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

/* logo-emblem.png est déjà recadré par le client (carré 60x60, non modifié) : pas besoin de
   recadrage CSS, juste un affichage à taille fixe dans le badge de la barre de navigation. */
.brand-badge {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    display: inline-block;
    background: #fff;
}
.brand-logo {
    width: 100%;
    height: 100%;
}

.navbar-links a {
    color: var(--brand-peach);
    text-decoration: none;
    margin-right: 1.25rem;
}
.navbar-links a:hover { color: white; }

.navbar-user { display: flex; align-items: center; gap: 0.75rem; }

.btn-link { color: var(--brand-peach); text-decoration: none; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.cards-row {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.metric-card { flex: 1; min-width: 220px; }
.metric-label { color: #6b7280; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.metric-value { font-size: 2rem; font-weight: 700; margin: 0.25rem 0; }
.metric-value span { font-size: 1rem; font-weight: 400; color: #6b7280; }
.metric-sub { color: #6b7280; font-size: 0.85rem; }

.status-online { color: var(--brand-green); }
.status-offline { color: #dc2626; }

.filters-card {
    background: white;
    border-radius: 10px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.25rem;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.filter-group { display: flex; flex-direction: column; gap: 0.35rem; }
.filter-group label { font-size: 0.8rem; color: #6b7280; }
.filter-group select, .filter-group input {
    padding: 0.45rem 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
}

button {
    background: var(--brand-orange);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
}
button:hover { background: var(--brand-orange-dark); }

.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.9rem;
}
.table th { color: #6b7280; font-weight: 600; }

.inline-form { display: flex; gap: 0.5rem; }
.inline-form input { padding: 0.35rem 0.5rem; border: 1px solid #d1d5db; border-radius: 6px; }

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 2rem 2.5rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* logo.png complet (non recadré) : largeur fixe, hauteur automatique pour garder ses proportions */
.login-logo { display: block; margin: 0 auto; width: 200px; height: auto; max-width: 100%; }
.login-card .subtitle { text-align: center; color: #6b7280; margin: 0 0 0.5rem; font-size: 0.9rem; }
.login-card label { font-size: 0.85rem; color: #374151; }
.login-card input {
    padding: 0.6rem 0.7rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
}
.login-card button { margin-top: 0.75rem; padding: 0.65rem; }

.alert { padding: 0.6rem 0.8rem; border-radius: 6px; font-size: 0.85rem; margin-bottom: 1rem; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }

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

.actions-cell { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.actions-cell form { display: inline; }
.actions-cell button {
    background: none;
    color: var(--brand-orange);
    padding: 0;
    font-size: 0.85rem;
    text-decoration: underline;
}
.actions-cell button:hover { background: none; color: var(--brand-orange-dark); }

.stacked-form { display: flex; flex-direction: column; gap: 0.6rem; max-width: 480px; }
.stacked-form label { font-size: 0.85rem; color: #374151; margin-top: 0.4rem; }
.stacked-form input, .stacked-form select, .stacked-form textarea {
    padding: 0.55rem 0.7rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}
.stacked-form button { margin-top: 0.75rem; align-self: flex-start; }

.field-hint { color: #6b7280; font-size: 0.8rem; margin: 0.2rem 0 0; }

.checkbox-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; font-weight: 400; margin: 0.3rem 0; }

.code-block {
    background: #111827;
    color: #e5e7eb;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
}

.table-scroll { overflow-x: auto; }

/* --- Responsive (mobile) --- */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .navbar-links {
        display: flex;
        overflow-x: auto;
        width: 100%;
        gap: 0.5rem;
    }
    .navbar-links a { margin-right: 0; white-space: nowrap; }
    .navbar-user { width: 100%; justify-content: space-between; }

    .container { padding: 1rem; }

    .cards-row { flex-direction: column; }
    .metric-card { min-width: 0; }

    .filters-card { flex-direction: column; align-items: stretch; }
    .filter-group select, .filter-group input { width: 100%; }

    .table { font-size: 0.8rem; }
    .table th, .table td { padding: 0.45rem 0.5rem; white-space: nowrap; }

    .inline-form { flex-direction: column; align-items: stretch; }

    .login-card { padding: 1.5rem; max-width: 100%; }

    .card-header-row { flex-direction: column; align-items: stretch; }
}
