/* ═══════════════════════════════════════════════════════════════════════════
   CONGO HEALTH CONSULTING — Feuille de styles principale
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --chc-blue:       #1565C0;
  --chc-blue-dark:  #0D47A1;
  --chc-blue-light: #E3F2FD;
  --chc-green:      #2E7D32;
  --chc-red:        #C62828;
  --chc-orange:     #E65100;
  --sidebar-w:      240px;
  --topbar-h:       60px;
}

/* ── Reset / Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: #F0F4F8; }

/* ════════════════════════════════════════════════════════════════════════════
   PAGE DE CONNEXION
   ════════════════════════════════════════════════════════════════════════════ */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--chc-blue-dark) 0%, var(--chc-blue) 60%, #42A5F5 100%);
}

.login-container { width: 100%; max-width: 420px; padding: 1rem; }

.login-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.login-header {
  background: linear-gradient(135deg, var(--chc-blue-dark), var(--chc-blue));
  color: #fff;
  text-align: center;
  padding: 1.75rem 1.5rem;
}
.login-header h2 { font-size: 1.3rem; font-weight: 700; margin: .5rem 0 .25rem; }

.login-logo-wrap {
  display: inline-block;
  background: #fff;
  border-radius: 12px;
  padding: 8px 20px;
  margin-bottom: .75rem;
}
.login-logo { height: 60px; width: auto; display: block; }

.login-info {
  color: rgba(255,255,255,.6);
  font-size: .78rem;
  line-height: 1.7;
}

/* ════════════════════════════════════════════════════════════════════════════
   LAYOUT PRINCIPAL (sidebar + contenu)
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--chc-blue-dark) 0%, var(--chc-blue) 100%);
  display: flex; flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}

.sidebar-brand {
  display: flex; align-items: center;
  padding: .85rem 1.25rem;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .5px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.15);
}
.sidebar-logo-wrap {
  background: #fff;
  border-radius: 7px;
  padding: 3px 6px;
  display: flex; align-items: center;
  flex-shrink: 0;
  margin-right: .6rem;
}
.sidebar-logo { height: 26px; width: auto; }

.chc-contact {
  margin-top: .6rem;
  padding-top: .5rem;
  border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: .75rem 0;
}

.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .85rem;
  padding: .7rem 1.25rem;
  color: rgba(255,255,255,.78);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  border-radius: 0;
  transition: all .18s ease;
  border-left: 3px solid transparent;
}
.sidebar-nav .nav-link i { width: 18px; text-align: center; font-size: 1rem; }
.sidebar-nav .nav-link:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  border-left-color: rgba(255,255,255,.4);
}
.sidebar-nav .nav-link.active {
  background: rgba(255,255,255,.18);
  color: #fff;
  font-weight: 700;
  border-left-color: #fff;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.15);
}
.sidebar-footer .user-info { display: flex; align-items: center; color: #fff; }
.sidebar-footer .user-info i { opacity: .7; }
.sidebar-footer .x-small { font-size: .72rem; }

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

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e0e7ef;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 900;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ── Page content ────────────────────────────────────────────────────────── */
.page-content { padding: 1.5rem; flex: 1; }

/* ════════════════════════════════════════════════════════════════════════════
   KPI CARDS
   ════════════════════════════════════════════════════════════════════════════ */
.kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  transition: transform .2s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.10); }

.kpi-icon {
  width: 54px; height: 54px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.bg-primary-soft { background: #DBEAFE; }
.bg-success-soft { background: #DCFCE7; }
.bg-warning-soft { background: #FEF9C3; }
.bg-info-soft    { background: #CFFAFE; }
.bg-danger-soft  { background: #FEE2E2; }

.kpi-value { font-size: 1.75rem; font-weight: 800; line-height: 1; color: #1e293b; }
.kpi-label { font-size: .8rem; color: #64748b; margin-top: .2rem; font-weight: 500; }
.kpi-sub   { font-size: .75rem; color: #94a3b8; margin-top: .1rem; }

/* ════════════════════════════════════════════════════════════════════════════
   CARTES / TABLEAUX
   ════════════════════════════════════════════════════════════════════════════ */
.card { border: none !important; border-radius: 12px !important; }
.card-header {
  background: #fff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: .85rem 1.25rem !important;
  border-radius: 12px 12px 0 0 !important;
}
.table th {
  font-size: .75rem; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: #64748b;
  background: #F8FAFC;
  border-bottom: 2px solid #e2e8f0;
}
.table td { vertical-align: middle; font-size: .875rem; }
.table-hover tbody tr:hover { background: #F0F7FF; }

/* ── Search bar ──────────────────────────────────────────────────────────── */
.search-bar { position: relative; }
.search-bar input { padding-left: 2.4rem; border-radius: 8px; }
.search-bar .search-icon {
  position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
  color: #94a3b8;
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.page-header h5 { font-weight: 700; color: #1e293b; margin: 0; }

/* ════════════════════════════════════════════════════════════════════════════
   BADGES PERSONNALISÉS
   ════════════════════════════════════════════════════════════════════════════ */
.badge { font-weight: 600; font-size: .72rem; padding: .3em .6em; border-radius: 6px; }

/* ════════════════════════════════════════════════════════════════════════════
   MODALS
   ════════════════════════════════════════════════════════════════════════════ */
.modal-header {
  background: linear-gradient(135deg, var(--chc-blue-dark), var(--chc-blue));
  color: #fff;
  border-radius: .5rem .5rem 0 0;
}
.modal-header .btn-close { filter: invert(1); }
.modal-title { font-weight: 700; }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination-container { display: flex; justify-content: flex-end; padding: .75rem 1rem; }
.page-link { color: var(--chc-blue); border-radius: 6px !important; margin: 0 2px; }
.page-item.active .page-link { background: var(--chc-blue); border-color: var(--chc-blue); }

/* ── Stat row in sidebar footer ──────────────────────────────────────────── */
.revenue-row {
  display: flex; justify-content: space-between;
  padding: .4rem 0; font-size: .82rem;
  border-bottom: 1px dashed rgba(255,255,255,.1);
}

/* ── Detail sections ─────────────────────────────────────────────────────── */
.detail-label { font-size: .78rem; text-transform: uppercase; color: #94a3b8; font-weight: 600; }
.detail-value { font-size: .9rem; color: #1e293b; }

/* ── Action buttons in table ─────────────────────────────────────────────── */
.btn-action { padding: .2rem .45rem; font-size: .78rem; border-radius: 6px; }

/* ── Urgency badge colors ────────────────────────────────────────────────── */
.urgency-routine     { background: #0EA5E9; color: #fff; }
.urgency-urgent      { background: #F59E0B; color: #fff; }
.urgency-urgence     { background: #EF4444; color: #fff; }
.urgency-reanimation { background: #1e293b; color: #fff; }

/* ── Loading spinner overlay ─────────────────────────────────────────────── */
.loading-row td { text-align: center; padding: 2rem; color: #94a3b8; }

/* ── Badges de rôles ─────────────────────────────────────────────────────── */
.role-badge { display:inline-block; padding:.25em .65em; border-radius:6px; font-size:.72rem; font-weight:700; color:#fff; }
.role-admin               { background:#1e293b; }
.role-manager             { background:#7c3aed; }
.role-docteur,
.role-medecin             { background:#1565C0; }
.role-infirmiere          { background:#be185d; }
.role-receptionniste      { background:#0891b2; }
.role-assistant_laboratoire{ background:#d97706; }
.role-pharmacien          { background:#059669; }
.role-secretaire          { background:#0284c7; }
.role-comptable           { background:#ca8a04; }

/* ── Scrollbar sidebar ───────────────────────────────────────────────────── */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }

/* ── Hamburger toggle ────────────────────────────────────────────────────── */
.sidebar-toggle {
  background: none; border: none; color: #1e293b;
  font-size: 1.25rem; padding: .25rem .5rem;
  cursor: pointer; border-radius: 6px;
  display: flex; align-items: center;
}
.sidebar-toggle:hover { background: #f1f5f9; }

.sidebar-close {
  background: none; border: none; color: rgba(255,255,255,.7);
  font-size: 1.1rem; cursor: pointer;
  margin-left: auto; padding: .25rem .5rem;
  border-radius: 6px;
}
.sidebar-close:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ── Sidebar overlay (mobile) ────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 999;
  opacity: 0;
  transition: opacity .25s ease;
}
body.sidebar-open .sidebar-overlay {
  display: block;
  opacity: 1;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.x-small { font-size: .72rem; }

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE FIRST
   ════════════════════════════════════════════════════════════════════════════ */

/* ── ≤ 767 px : sidebar off-canvas ───────────────────────────────────────── */
@media (max-width: 767.98px) {
  .sidebar {
    left: -100%;
    width: 280px;
    transition: left .3s ease;
  }
  body.sidebar-open .sidebar { left: 0; }
  .main-content { margin-left: 0; }

  .topbar { padding: 0 .75rem; }
  .page-content { padding: 1rem .75rem; }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
  }
  .page-header h5 { font-size: 1rem; }

  .kpi-card { padding: 1rem; gap: .75rem; }
  .kpi-icon { width: 44px; height: 44px; font-size: 1.1rem; }
  .kpi-value { font-size: 1.25rem; }

  .card-header { padding: .65rem .85rem !important; }
  .table th, .table td { font-size: .75rem; padding: .4rem .5rem; }
  .table th { white-space: nowrap; }

  .modal-dialog { margin: .5rem; }
  .modal-header { padding: .75rem 1rem; }
  .modal-body { padding: 1rem; }
  .modal-footer { padding: .75rem 1rem; }
  .modal-title { font-size: 1rem; }

  .pagination-container { justify-content: center; }

  .search-bar input { font-size: .85rem; }

  .btn-sm { font-size: .75rem; padding: .25rem .5rem; }

  .detail-label { font-size: .72rem; }
  .detail-value { font-size: .82rem; }

  [class*="col-"] { padding-right: .5rem; padding-left: .5rem; }
  .row { margin-right: -.5rem; margin-left: -.5rem; }

  .toast-container { padding: .75rem !important; }
  .toast { max-width: 100% !important; }

  .dropdown-menu { font-size: .85rem; }
}

/* ── ≤ 575 px : très petits écrans ──────────────────────────────────────── */
@media (max-width: 575.98px) {
  .login-container { padding: .5rem; }
  .login-card { border-radius: 12px; }
  .login-header { padding: 1.25rem 1rem; }
  .login-header h2 { font-size: 1.1rem; }
  .login-logo { height: 48px; }
  .login-body > .login-container > .p-4 { padding: 1rem !important; }
  .page-content { padding: .75rem .5rem; }
  .topbar { padding: 0 .5rem; }
  .topbar h5 { font-size: .95rem; }

  .kpi-card { padding: .75rem; gap: .6rem; }
  .kpi-icon { width: 38px; height: 38px; font-size: .95rem; }
  .kpi-value { font-size: 1.1rem; }
  .kpi-label { font-size: .72rem; }

  .table th, .table td { font-size: .7rem; padding: .3rem .4rem; }
  .btn { font-size: .78rem; padding: .3rem .6rem; }

  .modal-dialog { margin: .25rem; }

  .card-header { padding: .5rem .65rem !important; }
  .card-body { padding: .75rem !important; }

  .pagination .page-link { font-size: .78rem; padding: .3rem .6rem; }
}

/* ── ≥ 768 px : sidebar fixe (desktop) ──────────────────────────────────── */
@media (min-width: 768px) {
  .sidebar-toggle, .sidebar-close, .sidebar-overlay { display: none !important; }
  .sidebar { left: 0 !important; }
}
