/* ============================================================
   Centre de Dialyse Lioussfi — Design System
   ============================================================ */

:root {
  --primary:        #7AE2CF;
  --primary-dark:   #1F9488;
  --primary-darker: #0F766E;
  --primary-light:  #EAFBF7;
  --surface:        #F8FAFC;
  --text:           #0F172A;
  --text-muted:     #64748B;
  --border:         #E2E8F0;
  --sidebar-w:      260px;
  --radius:         14px;
  --shadow-sm:      0 2px 8px rgba(0,0,0,.05);
  --shadow-md:      0 8px 32px rgba(15,118,110,.08);
  --shadow-lg:      0 20px 60px rgba(15,118,110,.14);
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--surface); color: var(--text); }

/* ── Typography ── */
.font-display { font-family: 'Poppins', sans-serif; }
.text-gradient {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-darker));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ── Gradients ── */
.bg-primary-grad { background: linear-gradient(135deg, #7AE2CF 0%, #1F9488 100%); }
.bg-primary-grad-dark { background: linear-gradient(135deg, #1F9488 0%, #0F766E 100%); }

/* ── Glass ── */
.glass {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(122,226,207,.22);
  box-shadow: var(--shadow-md);
}

/* ── Sidebar ── */
#sidebar {
  position: fixed; left: 0; top: 0;
  width: var(--sidebar-w); height: 100vh;
  background: #fff;
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 20px rgba(0,0,0,.04);
  display: flex; flex-direction: column;
  z-index: 40;
  transition: transform .3s ease;
}

.sidebar-logo {
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #7AE2CF, #1F9488);
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logo-text .line1 { font-family: 'Poppins',sans-serif; font-weight: 700; font-size: 11.5px; color: var(--text); line-height: 1.3; }
.sidebar-logo-text .line2 { font-family: 'Poppins',sans-serif; font-weight: 700; font-size: 11.5px; color: var(--primary-dark); line-height: 1.3; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 10px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 2px; }

.nav-section-title {
  padding: 14px 10px 5px;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: #94A3B8;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 11px;
  color: var(--text-muted); font-size: 13.5px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: background .15s, color .15s;
  margin-bottom: 1px;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--primary-light); color: var(--primary-darker); }
.nav-item.active {
  background: var(--primary-light); color: var(--primary-darker);
  font-weight: 600; border-left-color: var(--primary-dark);
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-user {
  padding: 14px 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #7AE2CF, #1F9488);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }
.logout-btn { color: #94A3B8; transition: color .2s; cursor: pointer; }
.logout-btn:hover { color: #EF4444; }

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

/* ── Header ── */
.page-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(248,250,252,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
}
.page-header-left { display: flex; align-items: center; gap: 14px; }
.page-title { font-family: 'Poppins',sans-serif; font-size: 17px; font-weight: 700; color: var(--text); }
.page-breadcrumb { font-size: 12px; color: var(--text-muted); }
.header-actions { display: flex; align-items: center; gap: 8px; }

/* ── Content ── */
.page-content { padding: 28px; flex: 1; }

/* ── Stat Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform .25s, box-shadow .25s;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-value { font-family: 'Poppins',sans-serif; font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.stat-change { font-size: 11.5px; margin-top: 8px; display: flex; align-items: center; gap: 3px; }
.stat-change.up { color: #16A34A; }
.stat-change.down { color: #DC2626; }

/* ── Card / Panel ── */
.card {
  background: #fff; border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-family:'Poppins',sans-serif; font-size: 14px; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }

/* ── Table ── */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl thead th {
  padding: 11px 14px;
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.tbl tbody td {
  padding: 13px 14px; border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover td { background: var(--primary-light); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 50px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-success { background: #DCFCE7; color: #15803D; }
.badge-warning { background: #FEF9C3; color: #A16207; }
.badge-error   { background: #FEE2E2; color: #DC2626; }
.badge-info    { background: #DBEAFE; color: #1D4ED8; }
.badge-primary { background: var(--primary-light); color: var(--primary-darker); }
.badge-gray    { background: #F1F5F9; color: #64748B; }
.badge-purple  { background: #F3E8FF; color: #7C3AED; }

/* ── Avatar ── */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 11px; font-size: 13.5px;
  font-weight: 600; cursor: pointer; border: none; transition: all .2s;
  white-space: nowrap; font-family: inherit;
}
.btn:focus { outline: 3px solid rgba(122,226,207,.5); outline-offset: 2px; }
.btn-primary  { background: linear-gradient(135deg,#7AE2CF,#1F9488); color: #fff; }
.btn-primary:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(31,148,136,.3); }
.btn-secondary { background: #fff; color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--surface); }
.btn-danger   { background: #FEE2E2; color: #DC2626; border: 1px solid #FECACA; }
.btn-danger:hover { background: #FCA5A5; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 10px; justify-content: center; }
.btn-icon svg { width: 18px; height: 18px; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

/* ── Form ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--border); border-radius: 11px;
  font-size: 13.5px; color: var(--text);
  background: #fff; outline: none; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 3px rgba(122,226,207,.25);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(4px);
  z-index: 100; display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff; border-radius: 20px;
  width: 100%; max-width: 620px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.22);
  animation: modalIn .25s ease;
}
.modal-box.sm { max-width: 420px; }
.modal-box.lg { max-width: 820px; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family:'Poppins',sans-serif; font-size: 16px; font-weight: 700; color: var(--text); }
.modal-body  { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close { cursor: pointer; color: var(--text-muted); transition: color .2s; }
.modal-close:hover { color: var(--text); }
@keyframes modalIn { from { opacity:0; transform:scale(.94); } to { opacity:1; transform:scale(1); } }

/* ── Search bar ── */
.search-wrap {
  position: relative; display: flex; align-items: center;
}
.search-wrap svg { position: absolute; left: 11px; width: 16px; height: 16px; color: #94A3B8; }
.search-input {
  padding: 9px 13px 9px 34px;
  border: 1.5px solid var(--border); border-radius: 11px;
  font-size: 13.5px; color: var(--text); background: #fff; outline: none;
  font-family: inherit; width: 260px; transition: border-color .2s, width .3s;
}
.search-input:focus { border-color: var(--primary-dark); width: 320px; }

/* ── Toolbar ── */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .spacer { flex: 1; }

/* ── Notification bell ── */
.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; background: #EF4444;
  border-radius: 50%; border: 1.5px solid #fff;
}

/* ── Toast ── */
.toast-container { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--text); color: #fff;
  padding: 12px 20px; border-radius: 12px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: toastIn .3s ease;
}
.toast.success { background: #15803D; }
.toast.error   { background: #DC2626; }
@keyframes toastIn { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }

/* ── WhatsApp float ── */
.wa-float {
  position: fixed; bottom: 24px; right: 24px;
  width: 54px; height: 54px; border-radius: 50%;
  background: #25D366; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(37,211,102,.45);
  cursor: pointer; z-index: 999; text-decoration: none;
  transition: transform .25s, box-shadow .25s;
}
.wa-float:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(37,211,102,.55); }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Charts area ── */
.chart-area { position: relative; height: 260px; }

/* ── Print ── */
@media print {
  #sidebar, .page-header, .no-print, .modal-overlay { display: none !important; }
  .main-wrap { margin-left: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; display: none; }
  .sidebar-overlay.open { display: block; }
}
@media (max-width: 640px) {
  .page-content { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .search-input { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}
