/*
 * CDS — Custom Styles
 * Design System inspiré de Skote Admin
 * Sidebar sombre + cards KPI + badges workflow
 */

/* ─── Variables ──────────────────────────────────────────── */
:root {
    --sidebar-bg: #2a3042;
    --sidebar-hover: #2d3550;
    --sidebar-active: #3d4466;
    --sidebar-text: #a6b0cf;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 240px;
    --topbar-height: 64px;
    --topbar-bg: #ffffff;
    --body-bg: #f8f9fa;
    --card-border-radius: 12px;
    --primary: #556ee6;
    --success: #34c38f;
    --warning: #f1b44c;
    --danger: #f46a6a;
    --info: #50a5f1;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ─── Base ───────────────────────────────────────────────── */
* { box-sizing: border-box; }
body {
    font-family: var(--font-family);
    background-color: var(--body-bg);
    color: #495057;
    margin: 0;
}

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

/* ─── Sidebar ────────────────────────────────────────────── */
.cds-sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.cds-sidebar::-webkit-scrollbar { width: 4px; }
.cds-sidebar::-webkit-scrollbar-thumb { background: #3d4466; border-radius: 2px; }

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    text-decoration: none;
}
.brand-icon {
    width: 38px;
    height: 38px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.brand-name {
    display: block;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1.2;
}
.brand-sub {
    display: block;
    color: var(--sidebar-text);
    font-size: 0.68rem;
}

/* Nav */
.sidebar-nav {
    padding: 12px 8px;
    flex: 1;
}
.nav-section-label {
    padding: 16px 12px 6px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7a99;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.83rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all 0.15s ease;
}
.nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}
.nav-link.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(85, 110, 230, 0.35);
}
.nav-link i { font-size: 1rem; flex-shrink: 0; }

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.exercice-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--sidebar-text);
    background: rgba(255,255,255,0.05);
    padding: 8px 10px;
    border-radius: 8px;
}

/* ─── Main Area ──────────────────────────────────────────── */
.cds-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ─── Topbar ─────────────────────────────────────────────── */
.cds-topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid #e8eaed;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.sidebar-toggle { color: #495057 !important; padding: 0 !important; }
.topbar-search {
    align-items: center;
    gap: 8px;
    background: #f4f6f8;
    border-radius: 8px;
    padding: 4px 12px;
    color: #aaa;
    min-width: 200px;
}
.topbar-search input { min-width: 0; }

/* ─── Content ────────────────────────────────────────────── */
.cds-content {
    padding: 24px;
    flex: 1;
}
.messages-container { margin-bottom: 16px; }

/* ─── Page Header ────────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}
.page-title { font-size: 1.3rem; font-weight: 700; margin: 0; color: #2a3042; }
.page-subtitle { font-size: 0.8rem; color: #74788d; margin: 0; }

/* ─── KPI Cards ──────────────────────────────────────────── */
.kpi-card {
    background: #fff;
    border-radius: var(--card-border-radius);
    padding: 20px 24px;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}
.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.kpi-value { font-size: 1.6rem; font-weight: 700; color: #2a3042; line-height: 1.2; }
.kpi-label { font-size: 0.78rem; color: #74788d; margin-top: 2px; }
.kpi-trend { font-size: 0.75rem; margin-top: 8px; }

/* ─── Cards ──────────────────────────────────────────────── */
.cds-card {
    background: #fff;
    border-radius: var(--card-border-radius);
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.cds-card .card-header {
    background: transparent;
    border-bottom: 1px solid #f0f2f5;
    padding: 16px 20px;
    font-weight: 600;
    font-size: 0.92rem;
    color: #2a3042;
}
.cds-card .card-body { padding: 20px; }

/* ─── Tables ─────────────────────────────────────────────── */
.table { font-size: 0.85rem; }
.table thead th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #74788d;
    background: #f8f9fa;
    border-bottom: 1px solid #e8eaed;
    padding: 12px 16px;
}
.table tbody td { padding: 12px 16px; vertical-align: middle; border-color: #f0f2f5; }
.table tbody tr:hover { background: #fafbff; }

/* ─── Badges Statut Dépenses ─────────────────────────────── */
.badge-initiated { background: #dff2fb; color: #0d6efd; }
.badge-targeted  { background: #fff3cd; color: #856404; }
.badge-approved  { background: #d1e7dd; color: #0f5132; }
.badge-disbursed { background: #cfe2ff; color: #084298; }
.badge-rejected  { background: #f8d7da; color: #842029; }

/* ─── Forms ──────────────────────────────────────────────── */
.form-control, .form-select {
    border-radius: 8px;
    border-color: #e8eaed;
    font-size: 0.875rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(85, 110, 230, 0.15);
}
.form-label { font-weight: 500; font-size: 0.85rem; color: #495057; margin-bottom: 6px; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn { border-radius: 8px; font-size: 0.85rem; font-weight: 500; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #4862e0; border-color: #4862e0; }
.btn-whatsapp { background: #25D366; border-color: #25D366; color: #fff; }
.btn-whatsapp:hover { background: #20bd5a; border-color: #20bd5a; color: #fff; box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3); }

/* ─── Workflow Steps ─────────────────────────────────────── */
.workflow-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 16px 0;
    flex-wrap: wrap;
}
.workflow-step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    padding: 6px 12px;
    border-radius: 4px;
    background: #f4f6f8;
    color: #74788d;
    position: relative;
}
.workflow-step.completed { background: #d1e7dd; color: #0f5132; }
.workflow-step.current   { background: var(--primary); color: #fff; font-weight: 600; }
.workflow-step.rejected  { background: #f8d7da; color: #842029; }
.workflow-arrow { color: #adb5bd; font-size: 0.9rem; margin: 0 2px; }

/* ─── Login Page ─────────────────────────────────────────── */
.login-wrapper { display: flex; min-height: 100vh; }
.login-left {
    width: 45%;
    background: linear-gradient(135deg, #2a3042 0%, #556ee6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.login-illustration { text-align: center; }
.health-icon-ring {
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    color: #fff;
}
.feature-item { color: rgba(255,255,255,0.8); font-size: 0.85rem; margin: 8px 0; text-align: left; }
.feature-item i { margin-right: 8px; }
.login-right { flex: 1; background: #fff; }
.login-card { width: 100%; max-width: 380px; padding: 20px; }
.login-logo { width: 64px; height: 64px; background: #eef0fb; border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto; }

/* ─── Sidebar Collapsed (mobile) ─────────────────────────── */
@media (max-width: 991px) {
    .cds-sidebar { transform: translateX(-100%); }
    .cds-sidebar.open { transform: translateX(0); }
    .cds-main { margin-left: 0; }
}

/* ─── Utilities ──────────────────────────────────────────── */
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.text-muted-sm { font-size: 0.78rem; color: #74788d; }
.border-radius-lg { border-radius: var(--card-border-radius); }
