/* ========================================================
   EPS Consult — Admin panel
   ======================================================== */
:root {
    --sidebar-bg: #1f2937;
    --sidebar-bg-dark: #111827;
    --sidebar-text: #cbd5e1;
    --sidebar-text-active: #ffffff;
    --sidebar-hover: #374151;
    --sidebar-active: #1abc9c;
    --primary: #1abc9c;
    --primary-dark: #16a085;
    --content-bg: #f4f6fa;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --topbar-h: 60px;
    --sidebar-w: 250px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--content-bg);
    color: var(--text-main);
    font-size: 14px;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary); }

/* Layout */
.app-wrapper { display: flex; min-height: 100vh; }
.app-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ============== Sidebar ============== */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
}
.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    color: #fff !important;
}
.sidebar-brand:hover { color: #fff !important; }
.brand-logo {
    width: 38px; height: 38px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; letter-spacing: 1px;
}
.brand-logo-lg {
    width: 56px; height: 56px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; letter-spacing: 2px;
    margin: 0 auto 12px;
}
.brand-title { font-size: 15px; font-weight: 600; line-height: 1.2; }
.brand-subtitle { font-size: 11px; color: rgba(255,255,255,0.5); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-nav .nav-section {
    padding: 14px 20px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}
.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
.sidebar-nav a.active {
    background: var(--sidebar-bg-dark);
    color: var(--sidebar-text-active);
    border-left-color: var(--sidebar-active);
}
.sidebar-nav a i { font-size: 16px; width: 18px; text-align: center; }

.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.05); }
.user-card { display: flex; align-items: center; gap: 10px; }
.user-card-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
}
.user-card-name { color: #fff; font-size: 13px; font-weight: 500; }
.user-card-role { color: rgba(255,255,255,0.45); font-size: 11px; text-transform: capitalize; }

/* ============== Topbar ============== */
.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 500;
}
.topbar-title { font-size: 17px; font-weight: 600; margin: 0; }
.topbar-left { display: flex; align-items: center; gap: 14px; }
.btn-toggle-sidebar {
    background: transparent; border: none; font-size: 22px; color: var(--text-main); padding: 4px 8px;
}
.user-menu {
    display: flex; align-items: center; gap: 10px;
    background: transparent; border: none; color: var(--text-main);
    padding: 6px 10px; border-radius: 6px;
}
.user-menu:hover { background: var(--content-bg); }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 600;
}
.user-name { font-weight: 500; }

/* ============== Content ============== */
.app-content { padding: 24px; flex: 1; }
.app-footer { padding: 14px 24px; text-align: center; color: var(--text-muted); }

.page-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.page-header-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 600; margin: 0; color: var(--text-main); }

/* Cards / Panels */
.panel {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.panel-title { font-size: 14px; font-weight: 600; color: var(--text-main); margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Stat cards */
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.stat-icon {
    width: 48px; height: 48px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: #fff;
}
.stat-card-blue .stat-icon { background: #3498db; }
.stat-card-orange .stat-icon { background: #e67e22; }
.stat-card-green .stat-icon { background: #2ecc71; }
.stat-card-turquoise .stat-icon { background: var(--primary); }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* List overview */
.list-overview { list-style: none; padding: 0; margin: 0; }
.list-overview li {
    display: flex; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.list-overview li:last-child { border-bottom: none; }

/* ============== Tables ============== */
.table-projects { font-size: 13.5px; margin-bottom: 0; }
.table-projects thead th {
    background: #f9fafb;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
}
.table-projects tbody td {
    padding: 12px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}
.table-projects tbody tr:hover { background: #f9fafb; }
.th-sort { color: var(--text-muted); text-decoration: none; }
.th-sort:hover { color: var(--primary); }
.link-strong { font-weight: 600; color: var(--text-main); }
.link-strong:hover { color: var(--primary); }

.progress-wrapper { min-width: 160px; }
.progress-pct { font-size: 11px; color: var(--text-muted); margin-top: 3px; display: inline-block; }

.btn-action {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 4px 8px;
}
.btn-action:hover { background: var(--content-bg); color: var(--text-main); }

/* Badges */
.badge-actif       { background: #3498db; color: #fff; }
.badge-depose      { background: #2ecc71; color: #fff; }
.badge-reclamation { background: #e67e22; color: #fff; }
.badge-termine     { background: #1abc9c; color: #fff; }
.badge-archive     { background: #95a5a6; color: #fff; }

.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.role-super_admin { background: #fee2e2; color: #b91c1c; }
.role-admin       { background: #dbeafe; color: #1d4ed8; }
.role-utilisateur { background: #e5e7eb; color: #374151; }

/* Tasks */
.task-category { margin-bottom: 18px; }
.task-category-header {
    background: #f3f4f6;
    padding: 8px 14px;
    border-radius: 6px 6px 0 0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-bottom: none;
}
.table-tasks { font-size: 14px; margin-bottom: 0; border: 1px solid var(--border); border-radius: 0 0 6px 6px; overflow: hidden; }
.table-tasks tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-tasks tbody tr:last-child td { border-bottom: none; }
.task-title { font-weight: 500; }
.task-done { text-decoration: line-through; color: var(--text-muted); }
.task-status { font-size: 11px; padding: 3px 8px; border-radius: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.status-new  { background: #fef3c7; color: #92400e; }
.status-done { background: #d1fae5; color: #065f46; }

/* User list */
.user-list { list-style: none; padding: 0; margin: 0; }
.user-list li {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.user-list li:last-child { border-bottom: none; }
.user-list-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary); color: #fff; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
}

/* ============== Login ============== */
.login-page { background: linear-gradient(135deg, #1f2937 0%, #1abc9c 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-wrapper { width: 100%; max-width: 420px; }
.login-card { background: #fff; border-radius: 14px; padding: 36px 30px; box-shadow: 0 10px 35px rgba(0,0,0,0.2); }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand h1 { font-size: 22px; font-weight: 700; margin: 0; }
.login-brand p { color: var(--text-muted); font-size: 13px; margin: 4px 0 0; }
.btn-login { background: var(--primary); border-color: var(--primary); padding: 10px 0; font-weight: 600; }
.btn-login:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.login-footer { text-align: center; color: var(--text-muted); font-size: 12px; margin: 18px 0 0; }

/* Bootstrap primary override */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }

/* ============== Responsive ============== */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .app-main { margin-left: 0; }
}
