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

:root {
  /* 🎯 Primary Gradient Colors */
  --primary-dark: #1f4e79;
  --primary: #2f6f9f;
  --primary-light: #3fa7d6;

  /* 🎯 Secondary (Teal / Green Medical) */
  --secondary: #2bb8a6;
  --accent: #3ec7a3;

  /* 🎯 Neutral */
  --white: #ffffff;
  --gray: #a4c5df;
  --bg: #2f6f9f; /* Deep blue requested by user */

  /* 🎯 UI */
  --border: rgba(255, 255, 255, 0.15);
  --shadow: 0 8px 32px rgba(8, 28, 48, 0.2);
  --radius: 12px;

  /* Legacy mappings to preserve the rest of the app's components */
  --primary-mid: var(--primary);
  --accent-dark: var(--secondary);
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: var(--primary);

  --bg-dark: var(--bg);
  --bg-card: #ffffff;
  --bg-surface: rgba(255, 255, 255, 0.05); /* slightly transparent over blue */
  --bg-elevated: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.08);

  --text-primary: #ffffff; /* High contrast text on blue */
  --text-secondary: #e0f2fe;
  --text-muted: var(--gray);

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: var(--shadow);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.25);
  --radius-sm: 8px;
  --radius-lg: 16px;
}

/* 🌈 Gradient Bar */
.gradient-bar {
  height: 14px;
  border-radius: 20px;
  background: linear-gradient(
    to right,
    var(--primary-dark),
    var(--primary),
    var(--primary-light),
    var(--secondary),
    var(--accent)
  );
}

/* 📊 Queue Status Classes */
.status-current {
  color: var(--secondary);
  font-weight: bold;
}
.status-waiting {
  color: var(--primary-light);
}
.status-done {
  color: var(--gray);
}

/* 📝 Text Classes overrides */
.text-primary {
  color: var(--text-primary) !important;
}
.text-secondary {
  color: var(--text-secondary) !important;
}
.text-muted {
  color: var(--text-muted) !important;
}

/* ─── RTL Support ─── */
[dir='rtl'] .sidebar {
  border-right: none;
  border-left: 1px solid var(--border);
}
[dir='rtl'] .navbar-nav {
  margin-left: 0;
  margin-right: auto;
}
[dir='rtl'] th {
  text-align: right;
}
[dir='rtl'] .toast {
  right: auto;
  left: 20px;
  animation: slideInLeft 0.25s ease;
}
[dir='rtl'] .sidebar-item {
  text-align: right;
  flex-direction: row-reverse;
}
[dir='rtl'] .input-label {
  text-align: right;
}
[dir='rtl'] .page-header {
  text-align: right;
}
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ─── Theme / Lang Controls ─── */
.ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 8px;
  height: 34px;
  border: 1px solid var(--border-light);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.ctrl-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--primary);
}
.ctrl-btn svg {
  width: 14px;
  height: 14px;
}

html,
body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.6;
  direction: inherit; /* Handled dynamically by SettingsService */
  transition:
    background 0.3s,
    color 0.3s;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(63, 167, 214, 0.15);
  border-radius: 4px;
}

/* ─── Layout ─── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}
.container-sm {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ─── Glass (dark translucent surfaces — keep light text) ─── */
.glass {
  background: rgba(15, 30, 48, 0.6);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary); /* white text on dark bg */
}
.glass-strong {
  background: rgba(11, 22, 36, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  color: var(--text-primary); /* white text on dark bg */
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.btn-primary {
  background: var(--primary);
  color: var(--white);
  border: none;
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(31, 78, 121, 0.25);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-weight: 700;
}
.btn-accent:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(62, 199, 163, 0.45);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}
.btn-warning {
  background: var(--warning);
  color: #fff;
}
.btn-warning:hover {
  background: #d97706;
  transform: translateY(-1px);
}
.btn-ghost {
  background: rgba(63, 167, 214, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}
.btn-ghost:hover {
  background: rgba(31, 78, 121, 0.1);
  color: var(--text-primary);
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
}
.btn-lg {
  padding: 13px 28px;
  font-size: 14px;
  border-radius: 14px;
}
.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
  border-radius: 7px;
  gap: 6px;
}
.btn-xs {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 6px;
  gap: 4px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-primary {
  background: rgba(63, 167, 214, 0.13);
  color: var(--primary-light);
  border: 1px solid rgba(63, 167, 214, 0.28);
}
.badge-accent {
  background: rgba(62, 199, 163, 0.12);
  color: #3ec7a3;
  border: 1px solid rgba(62, 199, 163, 0.28);
}
.badge-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.badge-muted {
  background: rgba(61, 90, 115, 0.2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.badge-purple {
  background: rgba(47, 111, 159, 0.15);
  color: #7ec8e3;
  border: 1px solid rgba(47, 111, 159, 0.3);
}

/* ─── Cards (white background — MUST have dark text) ─── */
.card,
.stat-card,
.pstat-card,
.pay-card,
.manage-card,
.booking-card,
.current-panel,
.login-card {
  --text-primary: #1a3a5c !important;
  --text-secondary: #2d6899 !important;
  --text-muted: #5a7fa0 !important;
  --border: rgba(31, 78, 121, 0.1) !important;
  background: var(--bg-card) !important;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 4px 20px rgba(8, 28, 48, 0.1);
}

/* Hard-force ALL texts inside any white background card to be dark */
.card *,
.card h1,
.card h2,
.card h3,
.card div,
.card span,
.card p,
.stat-card *,
.stat-card div,
.stat-card span,
.stat-card p,
.pstat-card *,
.pstat-card div,
.pstat-card span,
.pay-card *,
.manage-card *,
.booking-card *,
.current-panel *,
.login-card * {
  color: var(--text-primary) !important;
}

/* Force SVGs to take local colors to ensure they aren't white */
.card svg,
.stat-card svg,
.pstat-card svg,
.manage-card svg,
.booking-card svg,
.current-panel svg,
.login-card svg {
  color: var(--text-muted) !important;
}

/* Restore colors for items that legitimately have their own explicit colors */
.card .btn,
.card .badge,
.card .specialty-tag,
.stat-card .btn,
.stat-card .badge,
.booking-card .btn,
.booking-card .badge,
.login-card .btn {
  color: revert !important;
}
.card .badge *,
.stat-card .badge * {
  color: revert !important;
}
.card .btn *,
.stat-card .btn * {
  color: revert !important;
}

/* Enforce button text explicitly */
.btn-primary,
.btn-danger,
.btn-warning,
.btn-accent {
  color: #fff !important;
}
.btn-primary *,
.btn-danger *,
.btn-warning *,
.btn-accent * {
  color: #fff !important;
}

/* ─── Inputs ─── */
.form-group {
  margin-bottom: 20px;
}
.input-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.input {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  outline: none;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s;
}
.input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 111, 159, 0.1);
}
.input::placeholder {
  color: var(--text-muted);
}
select.input option {
  background: var(--bg-card);
}
textarea.input {
  resize: vertical;
  min-height: 80px;
}

/* ─── Table ─── */
.table-wrapper {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead {
  background: var(--bg-elevated);
}
th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 13px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr {
  transition: background 0.15s;
}
tbody tr:hover {
  background: rgba(63, 167, 214, 0.04);
}
tbody tr:hover td {
  color: var(--text-primary);
}

/* ─── Navbar ─── */
.navbar {
  height: 64px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(47, 111, 159, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 32px;
  gap: 32px;
}

/* Home page: white/glass light navbar */
.home-navbar {
  background: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid rgba(31, 78, 121, 0.1) !important;
  box-shadow: 0 2px 20px rgba(31, 78, 121, 0.08) !important;
}
.home-navbar .navbar-title {
  color: var(--primary-dark) !important;
}
.home-navbar .navbar-subtitle {
  color: var(--primary) !important;
}
.home-navbar .nav-link {
  color: var(--primary) !important;
}
.home-navbar .nav-link:hover {
  background: rgba(47, 111, 159, 0.07) !important;
  color: var(--primary-dark) !important;
}
.home-navbar .nav-link.active {
  background: rgba(47, 111, 159, 0.12) !important;
  color: var(--primary-dark) !important;
}
.home-navbar .ctrl-btn {
  background: rgba(47, 111, 159, 0.06);
  border-color: rgba(47, 111, 159, 0.15);
  color: var(--primary-dark);
}
.home-navbar .ctrl-btn:hover {
  background: rgba(47, 111, 159, 0.12);
  color: var(--primary-dark);
}
.home-navbar .hamburger-btn {
  background: rgba(47, 111, 159, 0.07);
  border-color: rgba(47, 111, 159, 0.2);
  color: var(--primary-dark);
}
.home-navbar .pwa-install-btn {
  color: white !important;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}
.navbar-logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.navbar-logo svg {
  width: 18px;
  height: 18px;
}
.navbar-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
}
.navbar-subtitle {
  font-size: 10px;
  color: var(--primary-light);
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-top: 1px;
}
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
.nav-link {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  background: transparent;
}
.nav-link:hover {
  background: rgba(63, 167, 214, 0.08);
  color: var(--text-primary);
}
.nav-link.active {
  background: rgba(63, 167, 214, 0.14);
  color: var(--primary-light);
}

/* ─── Global Mobile Navbar for Doctor / Admin dashboards ─── */
/* Hidden by default (desktop shows sidebar instead). Shown on mobile. */
.doctor-navbar,
.admin-navbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  align-items: center;
  background: rgba(47, 111, 159, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 16px;
  gap: 10px;
  justify-content: space-between;
}

/* Hamburger button (shared) */
.hamburger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--primary-light);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
}

/* Mobile overlay backdrop */
.mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 28, 48, 0.65);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
}

/* Mobile slide-in drawer */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 201;
  width: min(82vw, 300px);
  background: linear-gradient(180deg, #1a3f68 0%, #0f2744 100%);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  animation: slideInDrawer 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow-y: auto;
}
[dir='rtl'] .mobile-drawer {
  right: auto;
  left: 0;
  border-left: none;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  animation-name: slideInDrawerRTL;
}
@keyframes slideInDrawerRTL {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.drawer-nav { padding: 12px 8px; flex: 1; }
.drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: all 0.15s;
  margin-bottom: 4px;
  border: 1px solid transparent;
}
.drawer-link:hover { background: rgba(255, 255, 255, 0.08); color: var(--white); }
.drawer-link.active { background: rgba(255, 255, 255, 0.12); color: var(--white); border-color: rgba(255, 255, 255, 0.15); }
.drawer-link svg { flex-shrink: 0; }
.drawer-controls { padding: 12px 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.drawer-install { padding: 12px 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); }

/* ─── Sidebar ─── */
.layout-sidebar {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  background: var(--primary-dark);
  border-right: 1px solid var(--border-light);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-section {
  padding: 16px 10px;
  flex: 1;
}
.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  margin-bottom: 2px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 1px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.sidebar-item:hover {
  background: rgba(63, 167, 214, 0.07);
  color: var(--text-primary);
}
.sidebar-item.active {
  background: rgba(63, 167, 214, 0.14);
  color: var(--primary-light);
}
.sidebar-item .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.65;
}
.sidebar-item.active .icon {
  opacity: 1;
}
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
}
.main-content {
  flex: 1;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Page Header ─── */
.page-header {
  padding: 32px 0 24px;
}
.page-header h1 {
  font-family: 'Inter Tight', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}
.page-header p {
  color: var(--text-secondary);
  margin-top: 4px;
  font-size: 14px;
}

/* ─── Stat Cards ─── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  color: var(--text-primary);
}
.stat-card .stat-val {
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 800;
  font-family: 'Cairo', sans-serif;
}
.stat-card .stat-lbl {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.stat-card.green::before {
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
}
.stat-card.yellow::before {
  background: var(--warning);
}
.stat-card.red::before {
  background: var(--danger);
}
.stat-card.purple::before {
  background: linear-gradient(90deg, var(--primary-dark), var(--primary));
}

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

/* ─── Avatar ─── */
.avatar {
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary), var(--accent-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  font-size: 15px;
}
.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}
.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 24px;
}
.avatar-xl {
  width: 100px;
  height: 100px;
  font-size: 36px;
}
.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* ─── Specialty Tag ─── */
.specialty-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(62, 199, 163, 0.1);
  color: var(--accent);
  border: 1px solid rgba(62, 199, 163, 0.25);
}

/* ─── Status Dot ─── */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.waiting {
  background: var(--warning);
}
.status-dot.in-progress {
  background: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}
.status-dot.done {
  background: var(--text-muted);
}
.status-dot.open {
  background: var(--accent);
}

/* ─── Filter Tabs ─── */
.filter-tabs {
  display: flex;
  gap: 6px;
}
.ftab {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.01em;
}
.ftab:hover {
  color: var(--text-primary);
  border-color: rgba(63, 167, 214, 0.3);
}
.ftab.active {
  background: rgba(63, 167, 214, 0.12);
  border-color: var(--primary);
  color: var(--primary-light);
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  animation: slideInRight 0.25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 240px;
}
.toast-success {
  background: #052e27;
  color: #3ec7a3;
  border: 1px solid rgba(62, 199, 163, 0.3);
}
.toast-error {
  background: #450a0a;
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.toast-info {
  background: #091829;
  color: #3fa7d6;
  border: 1px solid rgba(63, 167, 214, 0.3);
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 36px 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

/* ─── Section Title ─── */
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}

/* ─── Grid ─── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* ─── Spinner ─── */
.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: currentColor;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

/* ─── Animations ─── */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes slideInDrawer {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes glow {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(63, 167, 214, 0.2);
  }
  50% {
    box-shadow: 0 0 40px rgba(62, 199, 163, 0.45);
  }
}

.animate-fade-in {
  animation: fadeIn 0.25s ease;
}
.animate-fade-in-up {
  animation: fadeInUp 0.35s ease;
}
.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}
.animate-glow {
  animation: glow 2.5s ease-in-out infinite;
}

/* ─── Footer ─── */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 40px;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Home page: light footer */
.home-footer {
  background: rgba(255, 255, 255, 0.96) !important;
  border-top: 1px solid rgba(31, 78, 121, 0.1) !important;
  margin-top: 0 !important;
  box-shadow: 0 -4px 32px rgba(8, 28, 48, 0.1);
}
.home-footer .footer-inner {
  flex-direction: column;
  align-items: stretch;
}
.home-footer .navbar-title {
  color: var(--primary-dark) !important;
}
.home-footer .navbar-subtitle {
  color: var(--primary) !important;
}
.home-footer .footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 20px;
}
.home-footer .footer-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.home-footer .footer-link {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  border: 1px solid rgba(47, 111, 159, 0.15);
  transition: all 0.15s;
}
.home-footer .footer-link:hover {
  background: rgba(47, 111, 159, 0.07);
  color: var(--primary-dark);
}
.home-footer .footer-divider {
  height: 1px;
  background: rgba(31, 78, 121, 0.08);
  margin: 0;
}
.home-footer .footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 16px;
}
.home-footer .footer-copy {
  font-size: 12px;
  color: #777;
}
.home-footer .footer-badges {
  display: flex;
  gap: 8px;
}
.home-footer .footer-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(47, 111, 159, 0.07);
  color: var(--primary);
  border: 1px solid rgba(47, 111, 159, 0.15);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .container,
  .container-sm {
    padding: 0 16px;
  }

  /* Navbar mobile */
  .navbar {
    padding: 0 16px;
    gap: 10px;
    height: 56px;
  }
  .navbar-title {
    font-size: 14px;
  }
  .navbar-subtitle {
    display: none;
  }
  .nav-link span {
    display: none;
  }
  .pwa-btn-text {
    display: none;
  } /* hide text, show only icon */

  /* Cards */
  .card {
    padding: 16px;
  }

  /* Table scrollable */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Modal: bottom sheet on mobile */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-box {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    width: 100%;
    padding: 28px 20px 36px;
  }

  /* Filter tabs: horizontal scroll */
  .filter-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .filter-tabs::-webkit-scrollbar { display: none; }
  .ftab { white-space: nowrap; flex-shrink: 0; }

  /* ── Doctor / Admin mobile navbar ── */
  /* Show the sticky top navbar and hide the sidebar on mobile */
  .doctor-navbar,
  .admin-navbar {
    display: flex !important;
  }
  /* Sidebar already hidden via .sidebar { display: none; } above */

  /* Main content top spacing — since sidebar is gone, add top padding */
  .layout-sidebar .main-content {
    min-height: calc(100vh - 56px); /* account for mobile navbar height */
  }

  /* Reduce container padding inside main content on mobile */
  .layout-sidebar .main-content .container,
  .layout-sidebar .main-content .container-sm {
    padding-top: 20px !important;
    padding-bottom: 60px !important;
  }

  /* Page header on mobile inside dashboard */
  .layout-sidebar .page-header {
    padding: 16px 0 12px;
  }
  .layout-sidebar .page-header h1 {
    font-size: 20px;
  }

  /* stat cards on mobile — 2 columns for dashboard stat grids */
  .grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 13px;
  }
  .btn-lg {
    padding: 12px 20px;
    font-size: 13px;
  }
  .footer-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  .container,
  .container-sm {
    padding: 0 12px;
  }
  .page-header {
    padding: 16px 0 12px;
  }
  .page-header h1 {
    font-size: 20px;
  }
  .page-header p {
    font-size: 12px;
  }

  /* Modal: tighter on very small screens */
  .modal-box { padding: 22px 16px 28px; }
}

/* ─── PWA Install Banner ─── */
.pwa-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-mid));
  border-top: 1px solid rgba(63, 167, 214, 0.25);
  border-bottom: 1px solid rgba(63, 167, 214, 0.25);
}
.pwa-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pwa-banner-icon svg {
  width: 22px;
  height: 22px;
}
.pwa-banner-text {
  flex: 1;
}
.pwa-banner-title {
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}
.pwa-banner-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 1px;
}

@media (max-width: 768px) {
  .pwa-banner {
    padding: 12px 16px;
    gap: 10px;
  }
  .pwa-banner-title {
    font-size: 13px;
  }
}

/* ─── iOS Install Guide Modal ─── */
.ios-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.ios-modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 24px 24px 0 0;
  padding: 24px;
  animation: slideUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@media (min-width: 500px) {
  .ios-modal-backdrop {
    align-items: center;
  }
  .ios-modal {
    border-radius: 20px;
    max-width: 400px;
  }
}
@keyframes slideUpModal {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.ios-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.ios-modal-close {
  margin-left: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}
.ios-modal-close:hover {
  color: var(--text-primary);
  border-color: var(--primary);
}

.ios-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ios-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.ios-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent-dark));
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ios-step-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.ios-step-text strong {
  color: var(--text-primary);
}
