/* ============================================================
   ESPACE ACQUÉREUR – SABLUX Côte d'Ivoire
   Dashboard client moderne et professionnel
   ============================================================ */

:root {
    --primary: #8F4396;
    --primary-dark: #6d3373;
    --primary-light: #b06ab8;
    --primary-glow: rgba(143,67,150,.15);
    --blue: #0068B0;
    --blue-light: #e8f4fd;
    --orange: #F59331;
    --orange-light: #fff4e6;
    --green: #10b981;
    --green-light: #ecfdf5;
    --red: #ef4444;
    --red-light: #fef2f2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --sidebar-w: 260px;
    --topbar-h: 64px;
}

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

body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }

/* ============================================================
   LAYOUT
   ============================================================ */
.client-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w); background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex; flex-direction: column;
    z-index: 100; transition: transform .3s ease;
}

.sidebar-brand {
    padding: 20px 24px; border-bottom: 1px solid var(--gray-100);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-brand img { height: 36px; width: auto; }
.sidebar-brand-text { font-size: 13px; font-weight: 600; color: var(--gray-700); line-height: 1.3; }
.sidebar-brand-sub { font-size: 10px; color: var(--gray-400); font-weight: 500; }

.sidebar-user {
    padding: 20px 24px; border-bottom: 1px solid var(--gray-100);
    display: flex; align-items: center; gap: 12px;
}
.sidebar-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--blue));
    display: flex; align-items: center; justify-content: center;
    color: var(--white); font-weight: 700; font-size: 15px;
    flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-email { font-size: 11px; color: var(--gray-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-nav .nav-section { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--gray-400); padding: 16px 12px 6px; }
.sidebar-nav .nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; color: var(--gray-600);
    transition: all .15s ease; margin-bottom: 2px;
}
.sidebar-nav .nav-item:hover { background: var(--gray-50); color: var(--gray-800); }
.sidebar-nav .nav-item.active { background: var(--primary-glow); color: var(--primary); font-weight: 600; }
.sidebar-nav .nav-item i { width: 18px; text-align: center; font-size: 14px; }
.sidebar-nav .nav-badge {
    margin-left: auto; background: var(--red); color: var(--white);
    font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px;
    min-width: 18px; text-align: center;
}

.sidebar-footer {
    padding: 16px 12px; border-top: 1px solid var(--gray-100);
}
.sidebar-footer .nav-item { color: var(--gray-400); font-size: 12px; }
.sidebar-footer .nav-item:hover { color: var(--red); background: var(--red-light); }

/* Main area */
.client-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}

.client-topbar {
    height: var(--topbar-h); background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px; position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-toggle { display: none; background: none; border: none; font-size: 20px; color: var(--gray-600); cursor: pointer; }
.topbar-title { font-size: 18px; font-weight: 700; color: var(--gray-900); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-notif {
    position: relative; width: 36px; height: 36px; border-radius: 50%;
    background: var(--gray-50); border: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-500); cursor: pointer; transition: all .15s;
}
.topbar-notif:hover { background: var(--primary-glow); color: var(--primary); border-color: var(--primary); }
.topbar-notif .notif-dot {
    position: absolute; top: 6px; right: 6px; width: 8px; height: 8px;
    background: var(--red); border-radius: 50%; border: 2px solid var(--white);
}
.topbar-help {
    font-size: 12px; color: var(--gray-400); padding: 6px 14px;
    border: 1px solid var(--gray-200); border-radius: 20px;
    transition: all .15s;
}
.topbar-help:hover { border-color: var(--primary); color: var(--primary); }

.client-content { padding: 32px; max-width: 1200px; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 14px 20px; border-radius: var(--radius-sm); margin-bottom: 20px;
    font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px;
}
.alert-success { background: var(--green-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: var(--red-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--orange-light); color: #92400e; border: 1px solid #fed7aa; }
.alert-info { background: var(--blue-light); color: #1e40af; border: 1px solid #bfdbfe; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--white); border-radius: var(--radius);
    border: 1px solid var(--gray-200); overflow: hidden;
}
.card-header {
    padding: 20px 24px; border-bottom: 1px solid var(--gray-100);
    display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--gray-900); }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--gray-100); background: var(--gray-50); }

/* ============================================================
   STATUS BADGE
   ============================================================ */
.status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 12px; border-radius: 20px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
.status-badge .dot { width: 6px; height: 6px; border-radius: 50%; }

/* ============================================================
   DOSSIER OVERVIEW (Dashboard)
   ============================================================ */
.dossier-hero {
    background: linear-gradient(135deg, #1a1033 0%, #2d1b4e 50%, #0c1929 100%);
    border-radius: var(--radius-lg); padding: 32px;
    color: var(--white); margin-bottom: 24px; position: relative; overflow: hidden;
}
.dossier-hero::before {
    content: ''; position: absolute; top: -50%; right: -20%;
    width: 400px; height: 400px; border-radius: 50%;
    background: radial-gradient(circle, rgba(143,67,150,.2), transparent 70%);
}
.dossier-hero-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; position: relative; z-index: 1; }
.dossier-ref { font-size: 12px; color: rgba(255,255,255,.5); font-weight: 500; letter-spacing: 1px; }
.dossier-programme { font-size: 20px; font-weight: 700; margin-top: 4px; }
.dossier-hero-status .status-badge { font-size: 12px; padding: 6px 16px; }

.dossier-meta {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px; position: relative; z-index: 1;
}
.dossier-meta-item label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: rgba(255,255,255,.4); display: block; margin-bottom: 2px; }
.dossier-meta-item span { font-size: 14px; font-weight: 600; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-section { margin-bottom: 24px; }
.progress-steps {
    display: flex; justify-content: space-between; position: relative;
    padding: 0; margin: 20px 0 0;
}
.progress-steps::before {
    content: ''; position: absolute; top: 14px; left: 0; right: 0;
    height: 2px; background: var(--gray-200);
}
.progress-step {
    display: flex; flex-direction: column; align-items: center;
    position: relative; z-index: 1; flex: 1;
}
.progress-step .step-dot {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--white); border: 2px solid var(--gray-300);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: var(--gray-400); margin-bottom: 8px;
    transition: all .3s;
}
.progress-step.done .step-dot { background: var(--green); border-color: var(--green); color: var(--white); }
.progress-step.active .step-dot { background: var(--primary); border-color: var(--primary); color: var(--white); box-shadow: 0 0 0 4px var(--primary-glow); }
.progress-step .step-label { font-size: 10px; color: var(--gray-400); text-align: center; max-width: 80px; line-height: 1.3; }
.progress-step.done .step-label { color: var(--green); font-weight: 600; }
.progress-step.active .step-label { color: var(--primary); font-weight: 600; }

/* ============================================================
   CHECKLIST
   ============================================================ */
.checklist-item {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 0; border-bottom: 1px solid var(--gray-100);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-icon {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}
.checklist-icon.missing { background: var(--gray-100); color: var(--gray-400); }
.checklist-icon.uploaded, .checklist-icon.en_review, .checklist-icon.received { background: var(--orange-light); color: var(--orange); }
.checklist-icon.validated { background: var(--green-light); color: var(--green); }
.checklist-icon.rejected { background: var(--red-light); color: var(--red); }
.checklist-info { flex: 1; min-width: 0; }
.checklist-label { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.checklist-desc { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.checklist-action { flex-shrink: 0; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 13px; font-weight: 600;
    border: none; cursor: pointer; transition: all .15s;
    text-decoration: none;
}
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); color: var(--white); }
.btn-outline { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-300); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--green); color: var(--white); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-ghost { background: transparent; color: var(--gray-500); padding: 6px 10px; }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-700); }

/* ============================================================
   MESSAGES
   ============================================================ */
.messages-container { display: flex; flex-direction: column; gap: 16px; }
.message-bubble { max-width: 80%; }
.message-bubble.client { align-self: flex-end; }
.message-bubble.staff { align-self: flex-start; }
.message-content {
    padding: 14px 18px; border-radius: var(--radius);
    font-size: 13px; line-height: 1.6;
}
.message-bubble.client .message-content { background: var(--primary); color: var(--white); border-bottom-right-radius: 4px; }
.message-bubble.staff .message-content { background: var(--white); color: var(--gray-800); border: 1px solid var(--gray-200); border-bottom-left-radius: 4px; }
.message-meta { font-size: 10px; color: var(--gray-400); margin-top: 4px; padding: 0 4px; }
.message-bubble.client .message-meta { text-align: right; }
.message-sender { font-weight: 600; color: var(--gray-500); }

.message-input-area {
    display: flex; gap: 12px; padding: 20px 24px;
    border-top: 1px solid var(--gray-100); background: var(--gray-50);
}
.message-input {
    flex: 1; padding: 10px 16px; border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm); font-family: var(--font); font-size: 13px;
    resize: none; outline: none; transition: border-color .15s;
}
.message-input:focus { border-color: var(--primary); }

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
    content: ''; position: absolute; left: 10px; top: 0; bottom: 0;
    width: 2px; background: var(--gray-200);
}
.timeline-item { position: relative; padding-bottom: 24px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute; left: -28px; top: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; color: var(--white); z-index: 1;
}
.timeline-title { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.timeline-desc { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.timeline-date { font-size: 10px; color: var(--gray-400); margin-top: 4px; }

/* ============================================================
   PROFILE FORM
   ============================================================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 600; color: var(--gray-600); }
.form-input, .form-select {
    padding: 10px 14px; border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm); font-family: var(--font); font-size: 13px;
    color: var(--gray-800); background: var(--white); outline: none;
    transition: border-color .15s;
}
.form-input:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.form-input:disabled { background: var(--gray-50); color: var(--gray-400); }

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

.stat-card {
    background: var(--white); border: 1px solid var(--gray-200);
    border-radius: var(--radius); padding: 20px;
}
.stat-card-icon {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; margin-bottom: 12px;
}
.stat-card-value { font-size: 24px; font-weight: 800; color: var(--gray-900); }
.stat-card-label { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ============================================================
   NOTIFICATIONS DROPDOWN (simple)
   ============================================================ */
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item {
    display: flex; gap: 12px; padding: 14px 20px;
    border-bottom: 1px solid var(--gray-100); transition: background .1s;
}
.notif-item:hover { background: var(--gray-50); }
.notif-item.unread { background: #faf5ff; }
.notif-icon {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; flex-shrink: 0;
}
.notif-text { flex: 1; min-width: 0; }
.notif-title { font-size: 12px; font-weight: 600; color: var(--gray-800); }
.notif-body { font-size: 11px; color: var(--gray-500); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time { font-size: 10px; color: var(--gray-400); margin-top: 4px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center; padding: 48px 24px; color: var(--gray-400);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: .3; }
.empty-state p { font-size: 14px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .client-sidebar { transform: translateX(-100%); }
    .client-sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .client-main { margin-left: 0; }
    .topbar-toggle { display: block; }
    .client-content { padding: 20px 16px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .dossier-meta { grid-template-columns: 1fr 1fr; }
    .progress-steps { flex-wrap: wrap; gap: 8px; }
    .message-bubble { max-width: 95%; }
}
