/* ============================================================
   MédiDelegate Pro — Feuille de style principale
   ============================================================ */

:root {
    --sidebar-bg:    #1a2942;
    --sidebar-hover: #243550;
    --sidebar-active:#2980b9;
    --sidebar-width: 260px;
    --topbar-bg:     #2c3e50;
    --primary:       #3498db;
    --success:       #27ae60;
    --warning:       #f39c12;
    --danger:        #e74c3c;
    --content-bg:    #f0f2f5;
    --card-shadow:   0 2px 16px rgba(0,0,0,.07);
    --transition:    all .28s ease;
    --border-radius: 12px;
}

/* ── Reset & base ─────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Compatibilité Leaflet + Bootstrap ───────────────────── */
.leaflet-container img {
    max-width: none !important;
    max-height: none !important;
}
.leaflet-popup-content-wrapper,
.leaflet-popup-content,
.leaflet-popup-tip-container {
    margin: revert;
    padding: revert;
    box-sizing: content-box;
}
.leaflet-control,
.leaflet-control a,
.leaflet-bar a {
    margin: revert;
    padding: revert;
    box-sizing: content-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--content-bg);
    color: #333;
    overflow-x: hidden;
    font-size: .94rem;
}

/* ── Layout ───────────────────────────────────────────────── */
.wrapper        { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0;
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.12) transparent;
}
.sidebar::-webkit-scrollbar          { width: 4px; }
.sidebar::-webkit-scrollbar-thumb    { background: rgba(255,255,255,.15); border-radius:4px; }

.sidebar-header {
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
}
.sidebar-logo i   { font-size: 1.55rem; color: var(--primary); }
.sidebar-logo span{ font-size: .9rem; font-weight: 700; white-space: nowrap; color: white; }

.sidebar-toggle {
    background: none; border: none;
    color: rgba(255,255,255,.5); cursor: pointer;
    font-size: 1rem; padding: 6px;
    transition: color .2s;
}
.sidebar-toggle:hover { color: white; }

/* User block */
.sidebar-user {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8rem;
    flex-shrink: 0;
}
.user-info { min-width: 0; }
.user-name {
    font-size: .85rem; font-weight: 600; color: white;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role { font-size: .72rem; color: rgba(255,255,255,.5); margin-top: 2px; }

/* Menu */
.sidebar-menu { list-style: none; padding: 8px 0; flex: 1; }
.sidebar-menu .menu-header {
    font-size: .62rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.8px;
    color: rgba(255,255,255,.3);
    padding: 14px 20px 4px;
}
.sidebar-menu li:not(.menu-header) a {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 16px;
    color: rgba(255,255,255,.68);
    text-decoration: none;
    border-radius: 8px;
    margin: 1px 8px;
    transition: var(--transition);
    font-size: .875rem;
}
.sidebar-menu li:not(.menu-header) a:hover {
    background: var(--sidebar-hover);
    color: white;
}
.sidebar-menu li.active > a {
    background: var(--sidebar-active);
    color: white;
    box-shadow: 0 4px 12px rgba(52,152,219,.3);
}
.sidebar-menu li:not(.menu-header) a i {
    width: 20px; text-align: center;
    font-size: .9rem; flex-shrink: 0;
}

/* ── Main content ─────────────────────────────────────────── */
.content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

/* Top navbar */
.top-navbar {
    background: var(--topbar-bg);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0; z-index: 990;
    box-shadow: 0 2px 12px rgba(0,0,0,.18);
    flex-shrink: 0;
}

.main-content { padding: 22px 24px; flex: 1; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}
.card-header {
    background: white;
    border-bottom: 1px solid #eef0f3;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    padding: 14px 20px;
    font-weight: 600;
    color: #2c3e50;
    font-size: .9rem;
}

/* ── Stat cards ───────────────────────────────────────────── */
.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 18px;
    box-shadow: var(--card-shadow);
    transition: transform .2s, box-shadow .2s;
    height: 100%;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0,0,0,.11);
}
.stat-card .stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem; color: white;
    margin-bottom: 12px;
}
.stat-card .stat-value {
    font-size: 1.9rem; font-weight: 700;
    color: #2c3e50; line-height: 1;
}
.stat-card .stat-label {
    font-size: .8rem; color: #8a94a6; margin-top: 4px;
}

/* ── Page header ──────────────────────────────────────────── */
.page-header {
    background: white;
    border-radius: var(--border-radius);
    padding: 18px 22px;
    margin-bottom: 18px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap; gap: 10px;
}
.page-header h4 { margin: 0; font-weight: 700; color: #2c3e50; }

/* ── Forms ────────────────────────────────────────────────── */
.form-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 22px;
    box-shadow: var(--card-shadow);
    margin-bottom: 18px;
}
.form-section-title {
    font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 8px; margin-bottom: 18px;
}
.form-label       { font-size: .85rem; font-weight: 600; color: #555; }
.form-control,
.form-select {
    border-radius: 8px;
    border: 1.5px solid #dde2e8;
    padding: 8px 14px;
    font-size: .88rem;
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52,152,219,.14);
}

/* ── Tables ───────────────────────────────────────────────── */
.table th {
    font-size: .76rem; text-transform: uppercase;
    letter-spacing: .5px; color: #8a94a6;
    border-bottom: 2px solid #eef0f3;
    background: #fafbfc; padding: 10px 12px;
}
.table td { vertical-align: middle; font-size: .875rem; padding: 10px 12px; }
.table-hover tbody tr:hover { background: #f8f9ff; }

/* ── Badges potentiel ─────────────────────────────────────── */
.badge-potentiel-A { background: #27ae60 !important; color: white !important; }
.badge-potentiel-B { background: #f39c12 !important; color: white !important; }
.badge-potentiel-C { background: #e74c3c !important; color: white !important; }

/* ── Boutons ──────────────────────────────────────────────── */
.btn          { border-radius: 8px; font-size: .875rem; font-weight: 600; padding: 8px 18px; }
.btn-primary  { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #2980b9; border-color: #2980b9; }
.btn-xs       { padding: 2px 8px !important; font-size: .75rem !important; }

/* ── Login page ───────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a2942 0%, #2c3e50 50%, #1a2942 100%);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%; max-width: 430px;
    box-shadow: 0 24px 64px rgba(0,0,0,.35);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.logo-icon  {
    width: 72px; height: 72px; border-radius: 20px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2rem; color: white; margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(52,152,219,.4);
}
.login-logo h4  { font-weight: 800; color: #2c3e50; font-size: 1.5rem; }
.login-logo p   { color: #8a94a6; font-size: .875rem; }
.demo-box       {
    background: #f8f9fa; border-radius: 10px; padding: 14px;
    font-size: .8rem; border: 1px solid #eee;
}
.demo-title     { font-weight: 700; color: #555; margin-bottom: 8px; }
.demo-item      {
    display: flex; justify-content: space-between; align-items: center;
    padding: 3px 0; color: #444;
}
.demo-password  { margin-top: 8px; color: #888; font-style: italic; }

/* ── Animation ────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp .35s ease; }

/* ── Breadcrumb ───────────────────────────────────────────── */
.breadcrumb       { font-size: .8rem; }
.breadcrumb-item a{ color: var(--primary); text-decoration: none; }

/* ── Progress ─────────────────────────────────────────────── */
.progress { border-radius: 50px; background: #eef0f3; }

/* ── DataTables overrides ─────────────────────────────────── */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    border: 1.5px solid #dde2e8;
    padding: 5px 10px;
    font-size: .85rem;
}
.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary);
    outline: none;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px !important;
    font-size: .85rem !important;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .content {
        margin-left: 0;
        width: 100%;
    }
    .top-navbar {
        padding: 0 14px;
    }
    .main-content {
        padding: 14px;
    }
    .page-header {
        padding: 14px;
    }
}

/* Overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
}
.sidebar-overlay.show { display: block; }
