/* ============================================================
   HMS3 - Global Design System
   Navy + White Professional Medical Theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Noto+Nastaliq+Urdu:wght@400;700&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  --primary:       #1a3a5c;
  --primary-light: #2a5298;
  --primary-dark:  #0d1f33;
  --accent:        #00b4d8;
  --accent-hover:  #0096c7;
  --success:       #2ecc71;
  --warning:       #f39c12;
  --danger:        #e74c3c;
  --info:          #3498db;

  /* ─── Unified Navy Palette ────────────────────────────────── */
  --primary:       #1a3a5c; /* Deep Navy (Landing Page Color) */
  --primary-light: #2c5282;
  --primary-dark:  #102a43;
  
  --accent:        #3182ce; /* Professional Blue Accent */
  --accent-hover:  #2b6cb0;

  /* Muted, Harmonious Secondary Colors */
  --success:       #2f855a; /* Forest Green (Muted) */
  --warning:       #c05621; /* Ochre/Burnt Orange (Muted) */
  --danger:        #9b2c2c; /* Deep Crimson (Muted) */
  --info:          #2c5282; /* Navy-Blue */

  --bg-body:       #f7fafc;
  --bg-card:       #ffffff;
  --bg-sidebar:    #102a43;
  --border:        #e2e8f0;
  
  --text-main:     #102a43; /* Dark Navy Text */
  --text-muted:    #486581; /* Muted Slate-Blue */
  --text-light:    #829ab1;
  
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --footer-height: 48px;

  /* Consistent Spacing & Radius */
  --radius:        8px;
  --radius-sm:     6px;
  --radius-lg:     12px;
  
  --shadow-sm:     0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg:     0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  
  --transition:    all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Bootstrap Color Overrides ─────────────────────────────────── */
/* Primary */
.bg-primary { background-color: var(--primary) !important; }
.bg-primary-subtle { background-color: rgba(26, 58, 92, 0.1) !important; }
.text-primary { color: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }
.border-primary-subtle { border-color: rgba(26, 58, 92, 0.2) !important; }
.btn-primary { background-color: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background-color: var(--primary-light); border-color: var(--primary-light); color: #fff; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background-color: var(--primary); color: #fff; }

/* Success */
.bg-success { background-color: var(--success) !important; }
.text-success { color: var(--success) !important; }
.border-success { border-color: var(--success) !important; }
.btn-success { background-color: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover, .btn-success:focus { background-color: color-mix(in srgb, var(--success) 85%, black); border-color: color-mix(in srgb, var(--success) 85%, black); color: #fff; }

/* Danger */
.bg-danger { background-color: var(--danger) !important; }
.text-danger { color: var(--danger) !important; }
.border-danger { border-color: var(--danger) !important; }
.btn-danger { background-color: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover, .btn-danger:focus { background-color: color-mix(in srgb, var(--danger) 85%, black); border-color: color-mix(in srgb, var(--danger) 85%, black); color: #fff; }

/* Warning */
.bg-warning { background-color: var(--warning) !important; }
.text-warning { color: var(--warning) !important; }
.border-warning { border-color: var(--warning) !important; }
.btn-warning { background-color: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning:hover, .btn-warning:focus { background-color: color-mix(in srgb, var(--warning) 85%, black); border-color: color-mix(in srgb, var(--warning) 85%, black); color: #fff; }

/* Info */
.bg-info { background-color: var(--info) !important; }
.text-info { color: var(--info) !important; }
.border-info { border-color: var(--info) !important; }
.btn-info { background-color: var(--info); border-color: var(--info); color: #fff; }
.btn-info:hover, .btn-info:focus { background-color: color-mix(in srgb, var(--info) 85%, black); border-color: color-mix(in srgb, var(--info) 85%, black); color: #fff; }

/* Secondary & Dark */
.bg-secondary { background-color: var(--text-muted) !important; }
.text-secondary { color: var(--text-muted) !important; }
.btn-secondary { background-color: var(--text-muted); border-color: var(--text-muted); color: #fff; }
.btn-secondary:hover, .btn-secondary:focus { background-color: color-mix(in srgb, var(--text-muted) 85%, black); border-color: color-mix(in srgb, var(--text-muted) 85%, black); color: #fff; }

.bg-dark { background-color: var(--primary-dark) !important; }
.text-dark { color: var(--primary-dark) !important; }
.btn-dark { background-color: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-dark:hover, .btn-dark:focus { background-color: #000; border-color: #000; color: #fff; }
.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 0.25rem rgba(26, 58, 92, 0.25);
}

/* ─── Select2 Custom Styling ────────────────────────────────────── */
.select2-container--bootstrap-5 .select2-selection {
  border-color: var(--border) !important;
  min-height: 38px !important;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
  border-color: var(--primary-light) !important;
  box-shadow: 0 0 0 0.25rem rgba(26, 58, 92, 0.25) !important;
}
.select2-container--bootstrap-5 .select2-dropdown {
  border-color: var(--primary-light) !important;
  border-radius: var(--radius) !important;
  overflow: hidden !important;
}
.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected],
.select2-container--bootstrap-5 .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: var(--primary) !important;
  color: #ffffff !important;
}
.select2-container--bootstrap-5 .select2-results__option[aria-selected="true"] {
  background-color: rgba(26, 58, 92, 0.1) !important;
  color: var(--primary) !important;
}
.select2-container--bootstrap-5 .select2-search__field:focus {
  border-color: var(--primary-light) !important;
  box-shadow: 0 0 0 0.2rem rgba(26, 58, 92, 0.15) !important;
}

/* ─── Modal Custom Styling ──────────────────────────────────────── */
.modal-content {
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* ─── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  background: var(--bg-body);
  color: var(--text-main);
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* ─── Layout ──────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: padding-left .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.collapsed {
  padding-left: var(--sidebar-collapsed);
}

.app-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  width: 100%;
}

/* ─── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-color, var(--bg-sidebar));
  background: linear-gradient(160deg, var(--sidebar-color, #0d1f33) 0%, color-mix(in srgb, var(--sidebar-color, #0d1f33) 70%, black) 100%);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width .3s cubic-bezier(0.4, 0, 0.2, 1), left .3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  min-height: 70px;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}

.sidebar-brand {
  flex: 1;
  overflow: hidden;
}

.brand-name {
  display: block;
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: 0.5px;
  color: #fff;
  line-height: 1.3;
}

.brand-role {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.6);
}

.sidebar-toggle {
  color: rgba(255,255,255,0.6);
  padding: 4px 8px;
  border: none;
  background: none;
  font-size: 18px;
  flex-shrink: 0;
  transition: var(--transition);
}
.sidebar-toggle:hover { color: #fff; background: rgba(255,255,255,0.1); border-radius: 4px; }

/* Sidebar User */
.sidebar-user {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.user-avatar {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.user-info { overflow: hidden; }

.user-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,.5);
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  list-style: none;
  padding: 10px 0;
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.05); }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 10px; transition: background 0.3s; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

.sidebar-nav .nav-item .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: rgba(255,255,255,.75);
  border-radius: 0;
  transition: var(--transition);
  white-space: nowrap;
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-item .nav-link i { font-size: 18px; flex-shrink: 0; }
.sidebar-nav .nav-item .nav-link span { font-size: 13px; font-weight: 500; }

.sidebar-nav .nav-item .nav-link:hover,
.sidebar-nav .nav-item.active .nav-link {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-left-color: rgba(255,255,255,.8);
}

.sidebar-nav .nav-item.active .nav-link {
  background: rgba(255,255,255,.18);
  border-left-color: #fff;
}

.sidebar-footer {
  padding: 0;
  border-top: 1px solid rgba(255,255,255,.1);
  margin-top: auto;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: #ff6b6b;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  border-radius: 0;
  transition: var(--transition);
  text-decoration: none;
  width: 100%;
}
.logout-btn i {
  font-size: 18px;
  flex-shrink: 0;
}
.logout-btn span {
  font-size: 13px;
  font-weight: 500;
}
.logout-btn:hover {
  background: rgba(231, 76, 60, 0.1);
  color: #ff8a8a;
  border-left-color: #ff6b6b;
}

.sidebar.collapsed .logout-btn {
  padding: 12px 0;
  font-size: 0;
}
.sidebar.collapsed .logout-btn i {
  margin: 0 !important;
  font-size: 18px;
}

/* Collapsed sidebar */
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .sidebar-footer .nav-link span {
  display: none;
}

.sidebar.collapsed .nav-item .nav-link { padding: 14px; justify-content: center; }
.sidebar.collapsed .sidebar-header { 
    flex-direction: column; 
    gap: 12px; 
    padding: 15px 0; 
    justify-content: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sidebar.collapsed .sidebar-toggle { 
    display: flex; 
    margin: 0 auto;
    opacity: 0.8;
}
.sidebar.collapsed .sidebar-user { justify-content: center; }

/* ─── Topbar ──────────────────────────────────────────────────── */
.topbar {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.mobile-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 24px;
    padding: 0;
    margin-right: 10px;
}

@media (max-width: 991.98px) {
    .mobile-nav-toggle { display: block; }
}

.topbar-title { font-size: 18px; font-weight: 700; color: var(--text-main); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; position: relative; z-index: 5; }

/* Topbar User */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
  height: 32px;
}

.topbar-user .user-avatar {
  width: 32px;
  height: 32px;
  background: var(--primary-light);
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-user .user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar-user .user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.topbar-user .user-role {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

/* ─── Stat Cards ──────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 16px;
  row-gap: 4px;
  align-items: center;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--card-color, var(--primary-light));
  border-radius: var(--radius) 0 0 var(--radius);
}

.stat-icon {
  grid-row: 1 / span 2;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: color-mix(in srgb, var(--card-color, var(--primary-light)) 15%, white);
  color: var(--card-color, var(--primary-light));
  margin-bottom: 0;
}

.stat-value { 
  grid-column: 2;
  align-self: end;
  font-size: 28px; 
  font-weight: 800; 
  color: var(--text-main); 
  line-height: 1; 
}
.stat-label { 
  grid-column: 2;
  align-self: start;
  font-size: 12px; 
  color: var(--text-muted); 
  margin-top: 0; 
  text-transform: uppercase; 
  letter-spacing: .5px; 
  font-weight: 600; 
}
.stat-change { 
  grid-column: 2;
  font-size: 12px; 
  margin-top: 4px; 
}

/* ─── Cards ───────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--bg-card);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }

/* ─── Tables ──────────────────────────────────────────────────── */
.table-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table {
  margin-bottom: 0;
  font-size: 13px;
}

.table thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .5px;
  border-bottom: 2px solid var(--border);
  padding: 12px 16px;
  white-space: nowrap;
}

.table tbody td { padding: 12px 16px; vertical-align: middle; border-color: var(--border); }
.table tbody tr:hover { background: #f8fafc; }
.table-actions { white-space: nowrap; }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn { border-radius: var(--radius-sm); font-weight: 500; font-size: 13px; }
.btn-primary { background: var(--primary-light); border-color: var(--primary-light); }
.btn-primary:hover { background: var(--primary); border-color: var(--primary); }

/* ─── Forms ───────────────────────────────────────────────────── */
.form-label { font-weight: 600; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 6px; }
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 14px;
  padding: 9px 12px;
  transition: var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(42,82,152,.1);
}

/* ─── Badges ──────────────────────────────────────────────────── */
.badge { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; }

/* ─── Alert ───────────────────────────────────────────────────── */
.alert { border-radius: var(--radius-sm); border: none; font-size: 14px; }

/* ─── Search Bar ──────────────────────────────────────────────── */
.search-box { position: relative; }
.search-box .form-control { padding-left: 38px; }
.search-box .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

.token-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 700;
  background: var(--bg-body);
  color: var(--primary);
  border: 2px solid var(--primary);
}

/* ─── Select2 Customization ───────────────────────────────────── */
.select2-container--bootstrap-5 .select2-selection {
    border: 1.5px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    min-height: 42px !important;
    display: flex !important;
    align-items: center !important;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--primary-light) !important;
    box-shadow: 0 0 0 3px rgba(42,82,152,.1) !important;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--border) !important;
    box-shadow: var(--shadow-md) !important;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
}

.select2-container--bootstrap-5 .select2-search__field {
    border-radius: 20px !important;
    padding: 6px 15px !important;
}

/* ─── Integrated Search Dropdown ────────────────────────────── */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}

.search-result-item {
    cursor: pointer;
    transition: all 0.2s;
}

.search-result-item:hover,
.search-result-item.active {
    background-color: #f8fafc;
}

.search-result-item.active .badge {
    background-color: var(--primary) !important;
    color: #fff !important;
}

.search-result-item:last-child {
    border-bottom: none !important;
}

.token-badge.waiting { 
  background: color-mix(in srgb, var(--warning) 10%, white);
  color: var(--warning);
  border-color: var(--warning);
}
.token-badge.in-progress { 
  background: color-mix(in srgb, var(--success) 10%, white);
  color: var(--success);
  border-color: var(--success);
}

/* ─── Bed Grid ────────────────────────────────────────────────── */
.bed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; }
.bed-cell {
  aspect-ratio: 1;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.bed-cell:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.bed-available  { border-top: 4px solid var(--success); }
.bed-occupied   { border-top: 4px solid var(--danger); }
.bed-maintenance{ border-top: 4px solid var(--warning); }
.bed-reserved   { border-top: 4px solid var(--info); }
.bed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }
.bed-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}
.bed-cell:hover { transform: scale(1.05); box-shadow: var(--shadow-md); }
.bed-available  { background: #e8fdf2; color: #198754; border-color: #198754; }
.bed-occupied   { background: #fde8e8; color: #dc3545; border-color: #dc3545; }
.bed-maintenance{ background: #fff3e0; color: #fd7e14; border-color: #fd7e14; }
.bed-reserved   { background: #e3f2fd; color: #0d6efd; border-color: #0d6efd; }

/* ─── Print Styles ────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .app-footer, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  body { background: #fff; }
}

/* ─── Urdu / RTL Support ──────────────────────────────────────── */
.urdu { font-family: 'Noto Nastaliq Urdu', serif; direction: rtl; text-align: right; }
.rtl-mode { direction: rtl; }

/* ─── Chart container ─────────────────────────────────────────── */
.chart-container { position: relative; height: 300px; }
.chart-container-sm { position: relative; height: 200px; }

/* ─── Login Page ──────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 60%, var(--accent) 100%);
}

.login-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  color: #fff;
}

.login-right {
  width: 440px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  box-shadow: -8px 0 40px rgba(0,0,0,.2);
}

.login-card { width: 100%; max-width: 360px; }

.login-logo {
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,.15);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin-bottom: 24px;
  backdrop-filter: blur(8px);
}

/* ─── Responsive Queries ────────────────────────────────────────── */
@media (max-width: 991.98px) {
  :root {
    --sidebar-width: 260px;
  }

  .sidebar {
    left: calc(-1 * var(--sidebar-width));
  }

  .sidebar.mobile-open {
    left: 0;
    box-shadow: 20px 0 50px rgba(0,0,0,0.3);
  }

  .main-content, .app-footer {
    padding-left: 0 !important;
  }

  .topbar {
    padding: 0 15px;
  }

  .topbar-search {
    display: none !important;
  }

  .sidebar-toggle {
    display: block !important;
  }

  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    z-index: 999;
    display: none;
  }

  .sidebar-backdrop.show {
    display: block;
  }

  /* Grid adjustments */
  .stat-card {
    padding: 15px;
  }
  
  .stat-value {
    font-size: 22px;
  }
}

@media (max-width: 767.98px) {
  .page-content {
    padding: 15px;
  }

  .topbar-title {
    font-size: 16px;
  }

  .card-body {
    padding: 15px;
  }

  .table thead {
    display: none; /* Consider stacking for very small screens or horizontal scroll */
  }

  .table-responsive {
    border: none;
  }

  .login-wrapper {
    flex-direction: column;
  }

  .login-left {
    display: none;
  }

  .login-right {
    width: 100% !important;
    padding: 20px !important;
  }
}

@media (max-width: 575.98px) {
    .btn-sm-square { width: 32px; height: 32px; padding: 0; display: flex; align-items: center; justify-content: center; }
    .stat-card { grid-template-columns: 1fr; text-align: center; justify-items: center; }
    .stat-icon { grid-row: 1; margin-bottom: 10px; }
    .stat-value, .stat-label, .stat-change { grid-column: 1; }
}

.login-logo {
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,.15);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin-bottom: 24px;
  backdrop-filter: blur(8px);
}

/* ─── Landing Page ────────────────────────────────────────────── */
.hero-section {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 60%, #0096c7 100%);
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.dept-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
  height: 100%;
}

.dept-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.dept-icon { font-size: 40px; margin-bottom: 12px; }
.dept-name { font-weight: 700; font-size: 15px; color: var(--text-main); }
.dept-name-urdu { font-family: 'Noto Nastaliq Urdu'; font-size: 16px; color: var(--text-muted); direction: rtl; }

/* ─── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── Utility ─────────────────────────────────────────────────── */
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }
.text-pkr { color: #198754; font-weight: 700; }
.gap-2 { gap: .5rem; }
.rounded-xl { border-radius: var(--radius) !important; }
.shadow-card { box-shadow: var(--shadow-sm) !important; }
.bg-gradient-primary { background: linear-gradient(135deg, var(--primary-light), var(--accent)); }

/* ─── Unified Design Utilities ────────────────────────────────── */
.bg-white-10 { background-color: rgba(255, 255, 255, 0.1) !important; }
.bg-white-20 { background-color: rgba(255, 255, 255, 0.2) !important; }
.border-white-10 { border-color: rgba(255, 255, 255, 0.1) !important; }
.border-white-20 { border-color: rgba(255, 255, 255, 0.2) !important; }
.smaller { font-size: 0.75rem !important; }
.letter-spacing-1 { letter-spacing: 1px !important; }
.hover-opacity-100:hover { opacity: 1 !important; }
.transition-base { transition: var(--transition); }

.card-header {
    background-color: #fff !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 1.25rem 1.5rem !important;
    font-weight: 700 !important;
    color: var(--primary-dark) !important;
}

.stat-card {
    border: none !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
    border-radius: var(--radius-lg) !important;
}

.btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 4px 6px -1px rgba(26, 58, 92, 0.2), 0 2px 4px -1px rgba(26, 58, 92, 0.1) !important;
}

.btn-primary:hover {
    background-color: var(--primary-light) !important;
    border-color: var(--primary-light) !important;
    transform: translateY(-1px);
}

.table thead th {
    background-color: #f8fafc !important;
    text-transform: uppercase !important;
    font-size: 0.7rem !important;
    letter-spacing: 0.05em !important;
    color: var(--text-muted) !important;
    border-top: none !important;
}

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .app-footer { margin-left: 0; }
  .login-left { display: none; }
  .login-right { width: 100%; }
}
