/* =============================================
   GestCompte — Styles principaux
   ============================================= */

:root {
    --primary:      #2579ab;
    --primary-dark: #0c325f;
    --success:      #06d6a0;
    --danger:       #ef476f;
    --warning:      #ffd166;
    --info:         #118ab2;
    --sidebar-w:    260px;
    --topbar-h:     60px;
    --bg:           #f4f6fb;
    --card-bg:      #ffffff;
    --border:       #e8ecf0;
    --text:         #1a1d23;
    --text-muted:   #8892a4;
    --radius:       12px;
    --shadow:       0 2px 12px rgba(0,0,0,.07);
}

/* ---- Override Bootstrap primary (boutons, liens, .text-primary) ---- */
:root {
    --bs-primary:       #2579ab;
    --bs-primary-rgb:   37,121,171;
    --bs-link-color:    #2579ab;
    --bs-link-color-rgb:37,121,171;
    --bs-link-hover-color: #0c325f;
}
.btn-primary {
    --bs-btn-bg:           #2579ab;
    --bs-btn-border-color: #2579ab;
    --bs-btn-hover-bg:           #0c325f;
    --bs-btn-hover-border-color: #0c325f;
    --bs-btn-active-bg:           #0c325f;
    --bs-btn-active-border-color: #0c325f;
    --bs-btn-disabled-bg:           #2579ab;
    --bs-btn-disabled-border-color: #2579ab;
}
.btn-outline-primary {
    --bs-btn-color:        #2579ab;
    --bs-btn-border-color: #2579ab;
    --bs-btn-hover-bg:           #2579ab;
    --bs-btn-hover-border-color: #2579ab;
    --bs-btn-active-bg:           #2579ab;
    --bs-btn-active-border-color: #2579ab;
}
.text-primary { color: #2579ab !important; }
.bg-primary   { background-color: #2579ab !important; }

/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: .9375rem; }

/* ---- App layout ---- */
.app-layout { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    background: #1a1d2e;
    color: #c8cde8;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    transition: transform .25s ease;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.app-logo {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 16px; flex-shrink: 0;
}

.app-name { font-weight: 700; font-size: 1.1rem; color: #fff; }

.workspace-btn {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    color: #c8cde8;
    display: flex; align-items: center; gap: 8px;
    font-size: .85rem;
    transition: background .15s;
}
.workspace-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.workspace-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.sidebar-nav { padding: 12px 12px; flex: 1; }
.nav-section-label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: #545a7c; padding: 4px 8px 6px; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 8px;
    color: #9aa0be; text-decoration: none;
    font-size: .88rem; font-weight: 500;
    transition: background .15s, color .15s;
    cursor: pointer;
}
.nav-item i { width: 18px; text-align: center; font-size: .95rem; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #c8cde8; }
.nav-item.active { background: var(--primary); color: #fff; }

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,.06);
    display: flex; align-items: center; gap: 8px;
}

.avatar-sm {
    width: 32px; height: 32px;
    background: var(--primary);
    color: white; font-weight: 700; font-size: .85rem;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.logout-btn { padding: 4px 8px; }

/* ---- Main content ---- */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    height: var(--topbar-h);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 100;
}

.page-title { font-weight: 600; font-size: 1.05rem; flex: 1; }
.top-bar-actions { display: flex; gap: 8px; }
.content-body { padding: 24px; flex: 1; max-width: 1400px; }

/* ---- Cards ---- */
.chart-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.chart-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.chart-body { padding: 20px; }

/* ---- KPI Cards ---- */
.kpi-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    display: flex; flex-direction: column; gap: 6px;
    transition: box-shadow .15s;
}
.kpi-card:hover { box-shadow: var(--shadow); }
.kpi-card.kpi-total { background: var(--primary); border-color: var(--primary); color: white; }
.kpi-total .kpi-value, .kpi-total .kpi-label, .kpi-total .kpi-icon { color: white !important; }

.kpi-icon { font-size: 1.25rem; color: var(--primary); margin-bottom: 4px; }
.kpi-value { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.kpi-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }

/* ---- Account list ---- */
.account-list { padding: 8px 0; }
.account-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    text-decoration: none; color: var(--text);
    transition: background .1s;
}
.account-row:last-child { border-bottom: none; }
.account-row:hover { background: var(--bg); }

.account-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}

/* ---- Transaction list ---- */
.tx-list { padding: 4px 0; }
.tx-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
}
.tx-row:last-child { border-bottom: none; }

.tx-icon {
    width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem; flex-shrink: 0;
}

.tx-amount { font-weight: 700; font-size: .95rem; white-space: nowrap; }
.tx-credit  { color: #06d6a0; }
.tx-debit   { color: #ef476f; }

/* ---- Auth layout ---- */
.auth-layout {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0c325f 0%, #2579ab 100%);
    padding: 20px;
}

.auth-card-wrapper { width: 100%; max-width: 420px; }
.auth-card {
    background: #fff; border-radius: 16px; padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.auth-logo { text-align: center; margin-bottom: 28px; }

/* ---- Password policy list ---- */
.policy-list { padding-left: 20px; margin: 0; }
.policy-list li { transition: color .2s, font-weight .2s; }

/* ---- Badges et états ---- */
.badge-credit { background: rgba(6,214,160,.15); color: #049c73; font-weight: 600; }
.badge-debit  { background: rgba(239,71,111,.15); color: #c03055; font-weight: 600; }

/* ---- Enveloppes ---- */
.envelope-card {
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    transition: border-color .15s;
}
.envelope-card:hover { border-color: var(--primary); }
.envelope-progress { height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; margin-top: 8px; }
.envelope-progress-bar { height: 100%; border-radius: 3px; transition: width .4s; }

/* ---- Admin ---- */
.admin-stat-card { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); padding: 20px; }

/* ---- Tables ---- */
.table-gc { border-collapse: separate; border-spacing: 0; }
.table-gc thead th { background: var(--bg); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom: 1px solid var(--border); padding: 10px 16px; }
.table-gc tbody tr:hover td { background: var(--bg); }
.table-gc td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }

/* ---- Responsive mobile ---- */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }

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

/* ---- Utilitaires ---- */
.min-w-0 { min-width: 0; }
.cursor-pointer { cursor: pointer; }
.gap-10 { gap: 10px; }
