/* ============================================================
   Prestacall Dashboard — Styles globaux
   Palette : navy #1F3864 / bleu #2563EB / orange #E67E22
   ============================================================ */

:root {
    --navy:     #1F3864;
    --blue:     #2563EB;
    --blue2:    #3B82F6;
    --blueL:    #DBEAFE;
    --green:    #16A34A;
    --greenL:   #DCFCE7;
    --orange:   #E67E22;
    --orangeL:  #FEF3C7;
    --red:      #DC2626;
    --redL:     #FEE2E2;
    --purple:   #7C3AED;
    --teal:     #0F766E;
    --white:    #FFFFFF;
    --gray50:   #F8FAFC;
    --gray100:  #F1F5F9;
    --gray200:  #E2E8F0;
    --gray400:  #94A3B8;
    --gray600:  #475569;
    --gray800:  #1E293B;
    --sidebar-w: 240px;
    --header-h:  60px;
    --radius:    8px;
    --shadow:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    color: var(--gray800);
    background: var(--gray100);
    line-height: 1.5;
}

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

.sidebar {
    width: var(--sidebar-w);
    background: var(--navy);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

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

/* ── Header ─────────────────────────────────────────────── */
.topbar {
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid var(--gray200);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--navy);
    flex: 1;
}

.topbar-user {
    font-size: 13px;
    color: var(--gray600);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Sidebar nav ─────────────────────────────────────────── */
.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo h1 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.3px;
}

.sidebar-logo p {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
}

.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.35);
    padding: 12px 20px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13.5px;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
}

.nav-item.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-left-color: var(--blue2);
}

.nav-item .icon { font-size: 16px; width: 18px; text-align: center; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

/* ── Content ─────────────────────────────────────────────── */
.content { padding: 24px; flex: 1; }

.page-header {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--navy);
}

/* ── Filter bar ──────────────────────────────────────────── */
.filter-bar {
    background: var(--white);
    border: 1px solid var(--gray200);
    border-radius: var(--radius);
    padding: 14px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    box-shadow: var(--shadow);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}

.filter-group label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray600);
}

.filter-group select,
.filter-group input[type="date"],
.filter-group input[type="text"] {
    padding: 7px 10px;
    border: 1px solid var(--gray200);
    border-radius: 6px;
    font-size: 13px;
    color: var(--gray800);
    background: var(--white);
    outline: none;
    transition: border-color 0.15s;
}

.filter-group select:focus,
.filter-group input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.filter-group select[multiple] {
    min-height: 72px;
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary   { background: var(--blue);   color: #fff; }
.btn-secondary { background: var(--gray100); color: var(--gray800); border: 1px solid var(--gray200); }
.btn-danger    { background: var(--red);    color: #fff; }
.btn-success   { background: var(--green);  color: #fff; }
.btn-orange    { background: var(--orange); color: #fff; }
.btn:hover     { opacity: 0.88; }

/* ── KPI Cards ───────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px 20px;
    border: 1px solid var(--gray200);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--kpi-color, var(--blue));
}

.kpi-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--kpi-color, var(--navy));
    line-height: 1.1;
}

.kpi-label {
    font-size: 12px;
    color: var(--gray600);
    margin-top: 4px;
    font-weight: 500;
}

.kpi-sub {
    font-size: 11px;
    color: var(--gray400);
    margin-top: 2px;
}

/* ── Charts ──────────────────────────────────────────────── */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray200);
    box-shadow: var(--shadow);
    padding: 20px;
}

.chart-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gray100);
}

.chart-container { position: relative; }

/* ── Tables ──────────────────────────────────────────────── */
.table-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray200);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

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

.table-card-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    background: var(--gray50);
    color: var(--gray600);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray200);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--gray100);
    transition: background 0.1s;
}
tbody tr:hover { background: var(--gray50); }
tbody tr:last-child { border-bottom: none; }

tbody td {
    padding: 9px 14px;
    color: var(--gray800);
    vertical-align: middle;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-good    { background: var(--greenL);  color: #14532d; }
.badge-bad     { background: var(--redL);    color: #7f1d1d; }
.badge-blue    { background: var(--blueL);   color: #1e40af; }
.badge-orange  { background: var(--orangeL); color: #92400e; }
.badge-gray    { background: var(--gray100); color: var(--gray600); }
.badge-purple  { background: #ede9fe;        color: #4c1d95; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: var(--greenL);  color: #14532d; border: 1px solid #bbf7d0; }
.alert-error   { background: var(--redL);    color: #7f1d1d; border: 1px solid #fecaca; }
.alert-info    { background: var(--blueL);   color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: var(--orangeL); color: #92400e; border: 1px solid #fde68a; }

/* ── Upload ──────────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--gray200);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--white);
}
.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--blue);
    background: var(--blueL);
}
.upload-zone .upload-icon { font-size: 40px; color: var(--blue); margin-bottom: 12px; }
.upload-zone h3 { font-size: 16px; color: var(--navy); margin-bottom: 6px; }
.upload-zone p  { font-size: 13px; color: var(--gray600); }

/* ── Login ───────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy);
}

.login-card {
    background: var(--white);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.login-card .logo { text-align: center; margin-bottom: 28px; }
.login-card .logo h1 { font-size: 20px; color: var(--navy); font-weight: 700; }
.login-card .logo p  { font-size: 13px; color: var(--gray600); margin-top: 4px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--gray600); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray200);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}
.form-group input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-group .btn { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid var(--gray200);
    color: var(--gray800);
}
.pagination a:hover { background: var(--blueL); border-color: var(--blue); color: var(--blue); }
.pagination .current { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ── Progress bar ────────────────────────────────────────── */
.progress-bar { height: 6px; background: var(--gray200); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--blue); transition: width 0.3s; }

/* ── Rank badges ─────────────────────────────────────────── */
.rank { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; font-size: 11px; }
.rank-1 { background: #FEF3C7; color: #92400E; }
.rank-2 { background: var(--gray100); color: var(--gray600); }
.rank-3 { background: #FEF3C7; color: #78350F; opacity: 0.7; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-grid { grid-template-columns: 1fr; }
}
