:root {
    --m2e-dark: #1a3a5c;
    --m2e-blue: #1a6fa8;
    --m2e-water: #1a8fc4;
    --m2e-gold: #e8a020;
    --m2e-light: #f0f4f8;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--m2e-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Navbar ── */
#main-navbar {
    background: linear-gradient(135deg, var(--m2e-dark) 0%, #2c5282 100%);
    box-shadow: 0 2px 12px rgba(0,0,0,.25);
    padding: .7rem 1rem;
}
.navbar-logo {
    height: 52px;
    width: 52px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
}

.logo-badge {
    background: linear-gradient(135deg, var(--m2e-water), var(--m2e-gold));
    color: #fff;
    font-weight: 800;
    font-size: .95rem;
    padding: 6px 11px;
    border-radius: 8px;
    letter-spacing: 1px;
}
.brand-name  { font-weight: 700; font-size: 1.15rem; line-height: 1.1; }
.brand-sub   { font-size: .62rem; opacity: .8; line-height: 1; }

/* ── Pages ── */
.page { display: none; }
.page.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Hero ── */
.hero-section {
    background: linear-gradient(135deg, var(--m2e-dark) 0%, var(--m2e-water) 100%);
    color: #fff;
    padding: 5rem 0 7rem;
    clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
    margin-bottom: -3rem;
}
.hero-title    { font-size: 2.4rem; font-weight: 700; line-height: 1.2; }
.hero-subtitle { font-size: 1.05rem; opacity: .9; margin-bottom: 2rem; }
.hero-icon     { font-size: 4rem; filter: drop-shadow(0 4px 8px rgba(0,0,0,.3)); }

/* ── Service Cards ── */
.service-card {
    background: #fff;
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: transform .25s, box-shadow .25s;
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    height: 100%;
}
.service-card:hover { transform: translateY(-7px); box-shadow: 0 10px 28px rgba(0,0,0,.14); }
.service-icon {
    width: 68px; height: 68px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.2rem; font-size: 1.75rem; color: #fff;
}

/* ── Stats band ── */
.stats-section { background: var(--m2e-dark); color: #fff; padding: 3rem 0; margin-top: 4rem; }
.stat-number   { font-size: 2.6rem; font-weight: 700; color: var(--m2e-gold); }
.stat-label    { font-size: .88rem; opacity: .75; }

/* ── Page header (inside pages) ── */
.page-header { text-align: center; padding: 2rem 0 1.5rem; }
.page-header i  { font-size: 2.4rem; display: block; margin-bottom: .4rem; }
.page-header h2 { font-weight: 700; margin-bottom: .2rem; }

/* ── Login ── */
.login-logo {
    background: linear-gradient(135deg, var(--m2e-dark), var(--m2e-water));
    color: #fff; width: 80px; height: 80px; border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.45rem; font-weight: 800;
}

/* ── Upload zone ── */
.upload-zone {
    border: 3px dashed #ced4da; border-radius: 12px;
    padding: 2.5rem 1.5rem; text-align: center;
    cursor: pointer; transition: all .25s; color: #6c757d;
}
.upload-zone i  { font-size: 2.8rem; display: block; margin-bottom: .8rem; }
.upload-zone:hover, .upload-zone.dragover {
    border-color: #198754; background: #f0fff4; color: #198754;
}

/* ── Sidebar ── */
.sidebar {
    background: #fff; border-radius: 12px;
    padding: .5rem 0; box-shadow: 0 2px 12px rgba(0,0,0,.08);
    position: sticky; top: 76px;
}
.sidebar-item {
    display: flex; align-items: center; gap: .7rem;
    padding: .7rem 1.2rem; color: #495057;
    text-decoration: none; transition: all .2s;
    border-left: 3px solid transparent; font-size: .92rem;
}
.sidebar-item:hover, .sidebar-item.active {
    background: #f3f6fa; color: var(--m2e-dark);
    border-left-color: var(--m2e-dark); font-weight: 600;
}

/* ── Stat cards (reports) ── */
.stat-card {
    border-radius: 12px; padding: 1.5rem; text-align: center;
}
.stat-card i           { font-size: 2rem; }
.stat-card-val         { font-size: 2rem; font-weight: 700; }
.stat-card-lbl         { font-size: .82rem; opacity: .9; }

/* ── Client result card ── */
.client-info-card      { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,.1); }
.client-info-header    {
    background: linear-gradient(135deg, var(--m2e-dark), var(--m2e-water));
    color: #fff; padding: 1.5rem;
}
.client-avatar {
    width: 60px; height: 60px; border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
}
.client-info-body { padding: 1.5rem; }
.info-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: .65rem 0; border-bottom: 1px solid #f0f0f0;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: #6c757d; font-size: .88rem; }
.info-value { font-weight: 600; font-size: .95rem; }

/* ── Admin tab animation ── */
.admin-tab { animation: fadeIn .25s ease; }

/* ── Footer ── */
.footer {
    background: var(--m2e-dark); color: rgba(255,255,255,.65);
    padding: 1.2rem 0; margin-top: auto; font-size: .88rem;
}

/* ── Client Tabs ── */
.client-tabs .nav-link {
    color: var(--m2e-dark); font-weight: 500;
    border-radius: 8px 8px 0 0; padding: .65rem 1rem; font-size: .92rem;
}
.client-tabs .nav-link.active { color: var(--m2e-dark); font-weight: 700; border-bottom-color: #fff; }
.client-tabs .nav-link i { font-size: 1rem; }

/* ── Calculator ── */
.calc-result-box {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px; padding: 1.25rem; margin-top: .5rem;
}
.calc-result-box .res-val { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.calc-result-box .res-lbl { font-size: .78rem; color: #6c757d; }
.calc-detail {
    background: #f8f9fa; border-radius: 8px;
    padding: .6rem 1rem; font-size: .82rem; color: #6c757d; margin-top: .75rem;
}
#appareils-table input { width: 90px; }
.calc-stat-box { transition: transform .2s; }
.calc-stat-box:hover { transform: translateY(-2px); }

/* ── Map ── */
#map-container { background: #e8f4f8; }
.leaflet-container { font-family: 'Segoe UI', sans-serif; }

/* ── Réclamations ── */
.rec-type-plainte         { background: #dc3545 !important; }
.rec-type-demande_service { background: #0d6efd !important; }
.rec-type-information     { background: #0dcaf0 !important; color:#000 !important; }
.rec-type-releve_compteur { background: #198754 !important; }
.rec-type-autre           { background: #6c757d !important; }
.rec-stat-en_attente      { background: #ffc107 !important; color:#000 !important; }
.rec-stat-en_cours        { background: #0d6efd !important; }
.rec-stat-resolu          { background: #198754 !important; }

/* ── Bandeau annonces (haut de page accueil) ── */
.annonces-banner-inner {
    background: linear-gradient(135deg, var(--m2e-dark) 0%, #2c5282 100%);
    border-bottom: 4px solid var(--m2e-gold);
}
.annonces-banner-header {
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: .65rem;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.annonces-banner-header .ann-title {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .3px;
}
.annonces-banner-header .ann-count {
    background: var(--m2e-gold);
    color: #1a3a5c;
    font-weight: 800;
    font-size: .75rem;
    padding: 1px 8px;
    border-radius: 20px;
    margin-left: auto;
}
.annonces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: .85rem;
    padding: .85rem 1.5rem 1.2rem;
}
.annonce-banner-card {
    background: #fff;
    border-radius: 10px;
    padding: .9rem 1rem .75rem;
    transition: box-shadow .2s, transform .2s;
    position: relative;
    border-top: 4px solid var(--m2e-gold);
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.annonce-banner-card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0,0,0,.22); }
.ann-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: .67rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
    margin-bottom: .4rem;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.ann-card-badge.fr { background: #e8f0fe; color: #1a6fa8; }
.ann-card-badge.ar { background: #fff8e6; color: #b07700; }
.ann-card-title {
    font-weight: 700;
    color: #1a3a5c;
    font-size: .95rem;
    margin-bottom: .3rem;
    line-height: 1.3;
}
.ann-card-body {
    color: #444;
    font-size: .84rem;
    line-height: 1.6;
    margin-bottom: .5rem;
}
.ann-card-footer {
    color: #888;
    font-size: .71rem;
    display: flex;
    align-items: center;
    gap: 4px;
    border-top: 1px solid #f0f0f0;
    padding-top: .4rem;
    margin-top: .3rem;
}

/* ── Éditeur de formatage annonces ── */
.ann-toolbar {
    display: flex; flex-wrap: wrap; gap: 3px;
    background: #f8f9fa; border: 1px solid #dee2e6;
    border-bottom: none; border-radius: 6px 6px 0 0;
    padding: 5px 6px;
}
.ann-toolbar .btn { padding: 2px 7px; font-size: .82rem; }
.ann-toolbar .vr  { margin: 2px 3px; }
#ann-editor {
    min-height: 130px; border-radius: 0 0 6px 6px;
    border: 1px solid #dee2e6; padding: .5rem .75rem;
    background: #fff; outline: none; overflow-y: auto;
    font-size: .92rem; line-height: 1.55;
}
#ann-editor:focus { border-color: #86b7fe; box-shadow: 0 0 0 .2rem rgba(13,110,253,.15); }

/* ── Annonce cards (admin list) ── */
.annonce-card {
    border-left: 4px solid var(--m2e-gold);
    background: #fffdf5;
    border-radius: 8px;
    padding: .9rem 1rem;
}
[dir="rtl"] .annonce-card {
    border-left: none;
    border-right: 4px solid var(--m2e-gold);
}

/* ── Station comparison boxes ── */
.comparison-box {
    border-left: 4px solid;
    border-radius: 8px;
    padding: 1rem;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
}

/* ── RTL support ── */
[dir="rtl"] .sidebar-item {
    border-left: none;
    border-right: 3px solid transparent;
}
[dir="rtl"] .sidebar-item:hover,
[dir="rtl"] .sidebar-item.active {
    border-left: none;
    border-right-color: var(--m2e-dark);
}
[dir="rtl"] .sidebar-item .badge {
    margin-left: 0;
    margin-right: auto;
}
[dir="rtl"] .me-auto { margin-right: 0 !important; margin-left: auto !important; }
[dir="rtl"] .ms-auto { margin-left: 0 !important; margin-right: auto !important; }
[dir="rtl"] .me-2    { margin-right: 0 !important; margin-left: .5rem !important; }
[dir="rtl"] .ms-2    { margin-left: 0 !important;  margin-right: .5rem !important; }
[dir="rtl"] .text-start { text-align: right !important; }
[dir="rtl"] .text-end   { text-align: left  !important; }
[dir="rtl"] .dropdown-menu-end { --bs-position: start; }
[dir="rtl"] .brand-sub,
[dir="rtl"] .brand-name { text-align: right; }
[dir="rtl"] .input-group > :not(:last-child) { border-radius: 0 .375rem .375rem 0; }
[dir="rtl"] .input-group > :not(:first-child) { border-radius: .375rem 0 0 .375rem; }

/* ── Sortable headers ── */
.sort-th { cursor: pointer; white-space: nowrap; user-select: none; }
.sort-th:hover { background: rgba(255,255,255,.1); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .hero-title   { font-size: 1.65rem; }
    .hero-section { clip-path: none; padding: 3rem 0; margin-bottom: 0; }
    .client-tabs .nav-link { padding: .5rem .4rem; font-size: .82rem; }
}
