/* ============================================================
   HOSPITAL ADMIN PANEL — MAIN STYLESHEET
   ============================================================ */

:root {
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --primary: #0f4c81;
  --primary-light: #1a8fe3;
  --bg: #f0f4f8;
  --card-bg: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: .9375rem;
}

/* ---- Overlay ---- */
#overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 900;
}
#overlay.show { display: block; }

/* ============================================================
   SIDEBAR
   ============================================================ */
#sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: linear-gradient(180deg, #0a3560 0%, #0f4c81 100%);
  color: #fff; display: flex; flex-direction: column;
  z-index: 1000; transition: transform .3s ease;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex; align-items: center;
  padding: 1.25rem 1.25rem 1rem;
  font-size: 1.1rem; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.1);
  letter-spacing: .3px;
}
.sidebar-brand i { font-size: 1.4rem; color: #60c8ff; }

/* Nav */
.sidebar-nav { flex: 1; padding: .75rem 0; }
.sidebar-nav ul { list-style: none; }

.nav-label {
  font-size: .7rem; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: rgba(255,255,255,.4);
  padding: 1rem 1.25rem .35rem;
}

.sidebar-nav > ul > li > a,
.sidebar-nav > ul > li.has-sub > a {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.25rem; color: rgba(255,255,255,.8);
  text-decoration: none; border-radius: 8px;
  margin: 1px .5rem; transition: background .2s, color .2s;
  font-size: .9rem;
}
.sidebar-nav > ul > li > a:hover,
.sidebar-nav > ul > li.has-sub > a:hover { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-nav > ul > li > a.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.sidebar-nav > ul > li > a i { width: 18px; text-align: center; font-size: .95rem; }

/* Sub-menu */
.sub-arrow { margin-left: auto !important; font-size: .7rem !important; transition: transform .25s; }
.has-sub.open .sub-arrow { transform: rotate(180deg); }

.sub-menu {
  list-style: none; max-height: 0; overflow: hidden;
  transition: max-height .3s ease;
}
.sub-menu.open { max-height: 300px; }
.sub-menu li a {
  display: block; padding: .5rem 1.25rem .5rem 3.2rem;
  color: rgba(255,255,255,.65); text-decoration: none;
  font-size: .875rem; transition: color .2s;
}
.sub-menu li a:hover { color: #fff; }

/* Footer */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-footer a {
  color: rgba(255,255,255,.7); text-decoration: none;
  font-size: .875rem; transition: color .2s;
}
.sidebar-footer a:hover { color: #fff; }

/* ============================================================
   MAIN WRAPPER
   ============================================================ */
#main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left .3s ease;
  display: flex; flex-direction: column;
}

/* ---- Topbar ---- */
#topbar {
  position: sticky; top: 0; z-index: 800;
  height: var(--topbar-h);
  background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.toggle-btn {
  background: none; border: none; font-size: 1.2rem;
  color: var(--muted); cursor: pointer; padding: .25rem .5rem;
  border-radius: 6px; transition: background .2s;
}
.toggle-btn:hover { background: var(--bg); }
.topbar-title { font-weight: 600; font-size: 1rem; color: var(--text); flex: 1; }
.topbar-right { margin-left: auto; }

/* ---- Page Content ---- */
#page-content {
  flex: 1; padding: 1.75rem;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  display: flex; align-items: center; gap: 1.25rem;
  color: #fff; box-shadow: var(--shadow);
}
.stat-blue   { background: linear-gradient(135deg, #1a8fe3, #0f4c81); }
.stat-green  { background: linear-gradient(135deg, #22c55e, #15803d); }
.stat-orange { background: linear-gradient(135deg, #f59e0b, #b45309); }
.stat-red    { background: linear-gradient(135deg, #ef4444, #b91c1c); }

.stat-icon { font-size: 2rem; opacity: .85; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; opacity: .85; margin-top: .2rem; }

/* ============================================================
   CARDS
   ============================================================ */
.card { border-radius: var(--radius) !important; }
.card-header { font-size: .9rem; }

/* ============================================================
   TABLES
   ============================================================ */
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.table td { vertical-align: middle; font-size: .9rem; }

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select {
  border-radius: 8px; border-color: var(--border);
  font-size: .9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(26,143,227,.15);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge-opd  { background: #dbeafe; color: #1d4ed8; }
.badge-ipd  { background: #fce7f3; color: #9d174d; }

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media (max-width: 991.98px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #main-wrapper { margin-left: 0; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: .75rem;
}
.page-header h4 { font-weight: 700; margin: 0; }

.btn-primary-custom {
  background: linear-gradient(135deg, #0f4c81, #1a8fe3);
  border: none; color: #fff; font-weight: 600;
  border-radius: 8px; transition: opacity .2s;
}
.btn-primary-custom:hover { opacity: .88; color: #fff; }

/* Toast animation */
@keyframes slideIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
