/* ── Remedium HMS — Design System ───────────────────────────────────── */

:root {
  /* Modern Clinical-Glass Palette */
  --primary-blue: #2563eb;
  --secondary-purple: #7b2ff7;
  --bg-clinical: #f1f5f9;
  --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #e8edf5 100%);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --shadow-elevated: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.08);
  --font-inter: 'Inter', system-ui, sans-serif;
  --radius-card: 16px;
  --radius-btn: 12px;
  --radius-input: 10px;
  --transition-base: 0.2s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --text-main: #1e293b;
  --text-muted: #4b5563;
  --text-heading: #0f172a;
  --card-bg: #ffffff;
  --card-border: rgba(0, 0, 0, 0.06);
  --table-header-bg: #f8fafc;
  --table-row-hover: rgba(0, 98, 255, 0.03);
  --medical-green: #20bc77;
  --primary-glow: rgba(37, 99, 235, 0.25);
  --badge-font-size: 0.72rem;
}

body { font-family: var(--font-inter); background: var(--bg-clinical); }

/* Improved Dropdowns & UI */
.navbar { background: rgba(255, 255, 255, 0.9) !important; backdrop-filter: blur(10px); }
.dropdown-menu { border-radius: 12px; border: 1px solid rgba(0,0,0,0.05); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }

/* Logo Styling */
.remedium-logo { display: flex; align-items: center; font-weight: 800; font-size: 1.4rem; color: var(--primary-blue); }
.logo-icon { width: 32px; height: 32px; background: linear-gradient(135deg, #2563eb, #3b82f6); border-radius: 8px; margin-right: 10px; display: flex; align-items: center; justify-content: center; color: white; }

/* ── Reset & Base ──────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background: var(--primary-blue);
  color: #fff;
}

/* Focus ring for accessibility */
*:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Animations ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  @keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  @keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.6; }
  }

  @keyframes shimmer {
    0%   { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
  }

  .animate-fade-in {
    animation: fadeIn 0.4s ease forwards;
  }

  .animate-fade-in-up {
    animation: fadeInUp 0.4s ease forwards;
  }

  .stagger-children > * {
    opacity: 0;
    animation: fadeInUp 0.35s ease forwards;
  }
  .stagger-children > *:nth-child(1) { animation-delay: 0.02s; }
  .stagger-children > *:nth-child(2) { animation-delay: 0.04s; }
  .stagger-children > *:nth-child(3) { animation-delay: 0.06s; }
  .stagger-children > *:nth-child(4) { animation-delay: 0.08s; }
  .stagger-children > *:nth-child(5) { animation-delay: 0.10s; }
  .stagger-children > *:nth-child(6) { animation-delay: 0.12s; }
  .stagger-children > *:nth-child(7) { animation-delay: 0.14s; }
  .stagger-children > *:nth-child(8) { animation-delay: 0.16s; }
}

/* ── Skeleton Loading ──────────────────────────────────────────────── */
.skeleton {
  background: #f0f0f0;
  border-radius: 6px;
  display: inline-block;
  line-height: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
  }
}

.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: 8px;
}

.skeleton-text--sm { width: 60%; }
.skeleton-text--md { width: 80%; }

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* ── Glassmorphism ─────────────────────────────────────────────────── */
.glass-effect {
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-elevated);
}

/* ── Navbar ─────────────────────────────────────────────────────────── */
.navbar {
  background: rgba(255, 255, 255, 0.6) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0.75rem 0;
  transition: box-shadow var(--transition-smooth);
}

.navbar.scrolled {
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.4rem;
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -1px;
  transition: opacity var(--transition-base);
}

.navbar-brand:hover { opacity: 0.85; }

.nav-link {
  font-weight: 500;
  color: var(--text-main) !important;
  padding: 0.5rem 1.2rem !important;
  border-radius: 8px;
  transition: all var(--transition-base);
}

.nav-link:hover {
  background: rgba(0, 98, 255, 0.08);
  color: var(--primary-blue) !important;
}

.nav-link.active {
  background: rgba(0, 98, 255, 0.1);
  color: var(--primary-blue) !important;
}

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: box-shadow var(--transition-smooth), transform var(--transition-smooth);
}

.card.glass-effect {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
}

.card-action {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  cursor: pointer;
}

.card-action:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover) !important;
}

.card-header {
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-weight: 600;
}

.card-header-clean {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
  font-size: 0.875rem;
  color: var(--text-heading);
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  border-radius: var(--radius-btn);
  font-weight: 600;
  padding: 0.6rem 1.5rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-purple));
  border: none;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-outline-primary {
  border-color: rgba(0, 98, 255, 0.3);
}

.btn-outline-primary:hover {
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-purple));
  border-color: transparent;
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
}

.btn-group .btn {
  padding: 0.4rem 0.75rem;
}

/* ── Dashboard Stat Cards ──────────────────────────────────────────── */
.stat-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 1.25rem 1.25rem 1rem;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  height: 100%;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.stat-card--blue::before  { background: #0062ff; }
.stat-card--teal::before  { background: #0891b2; }
.stat-card--green::before { background: #16a34a; }
.stat-card--amber::before { background: #d97706; }

.stat-card__icon {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
}

.stat-card--blue  .stat-card__icon { color: #0062ff; }
.stat-card--teal  .stat-card__icon { color: #0891b2; }
.stat-card--green .stat-card__icon { color: #16a34a; }
.stat-card--amber .stat-card__icon { color: #d97706; }

.stat-card__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.stat-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-card__sub {
  font-size: 0.72rem;
  color: #6b7280;
}

/* ── Dashboard Widgets ─────────────────────────────────────────────── */
.dashboard-widget {
  color: #fff !important;
  border: none;
}

.dashboard-widget .card-body { padding: 2rem; }

.dashboard-widget .icon {
  font-size: 3.5rem;
  opacity: 0.2;
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
}

.bg-medical-blue   { background: linear-gradient(135deg, #0062ff, #00b4db); }
.bg-medical-teal   { background: linear-gradient(135deg, #00d1b2, #009781); }
.bg-medical-purple { background: linear-gradient(135deg, #7b2ff7, #bc26ef); }
.bg-medical-orange { background: linear-gradient(135deg, #f7941d, #ff512f); }

/* ── Section Label ─────────────────────────────────────────────────── */
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 0.75rem;
}

/* ── Quick Actions ─────────────────────────────────────────────────── */
.quick-action {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1rem;
  text-align: center;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  box-shadow: var(--shadow-card);
}

.quick-action:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(0, 98, 255, 0.2);
}

.quick-action__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin: 0 auto 0.6rem;
}

.quick-action__title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-heading);
}

.quick-action__sub {
  font-size: 0.7rem;
  color: #6b7280;
}

/* ── Tables ────────────────────────────────────────────────────────── */
.table-responsive {
  border-radius: 15px;
  overflow: hidden;
}

.table {
  background: transparent;
  margin-bottom: 0;
}

.table thead th {
  background: var(--table-header-bg);
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 1rem 1.2rem;
  font-weight: 600;
}

.table tbody td {
  border-color: rgba(0, 0, 0, 0.04);
  padding: 1rem 1.2rem;
  color: var(--text-main);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--transition-base);
}

.table tbody tr:hover {
  background: var(--table-row-hover);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Striped variant */
.table-striped > tbody > tr:nth-of-type(odd) {
  background: rgba(0, 0, 0, 0.02);
}

/* ── Form Controls ─────────────────────────────────────────────────── */
.form-control {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-input);
  padding: 0.7rem 1rem;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  font-size: 0.9rem;
}

.form-control:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 98, 255, 0.12);
  background: #fff;
}

.form-control.is-valid {
  border-color: var(--medical-green);
  box-shadow: 0 0 0 3px rgba(32, 188, 119, 0.12);
}

.form-control.is-invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.12);
}

.form-select {
  background-color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-input);
  padding: 0.7rem 1rem;
}

.form-select:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 98, 255, 0.12);
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.3rem;
}

/* Input group enhancements */
.input-group-text {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

/* ── Avatar / Badge ────────────────────────────────────────────────── */
.avatar-circle {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-purple));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 4px 10px var(--primary-glow);
  flex-shrink: 0;
}

.badge {
  padding: 0.4rem 0.75rem;
  font-weight: 600;
  font-size: var(--badge-font-size);
}

/* ── Appointment Row ───────────────────────────────────────────────── */
.appt-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  transition: background var(--transition-base);
  color: inherit;
}

.appt-row:last-child { border-bottom: none; }

.appt-row:hover { background: var(--table-row-hover); }

.appt-row__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0062ff, #7b2ff7);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.appt-row__info {
  flex: 1;
  min-width: 0;
}

.appt-row__name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appt-row__meta {
  font-size: 0.7rem;
  color: #6b7280;
}

.appt-row__badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.appt-row__badge--scheduled  { background: #eff6ff; color: #1d4ed8; }
.appt-row__badge--completed  { background: #f0fdf4; color: #15803d; }
.appt-row__badge--cancelled  { background: #fef2f2; color: #b91c1c; }

/* ── Department Row ────────────────────────────────────────────────── */
.dept-row { margin-bottom: 0.9rem; }

.dept-row__top {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  color: #334155;
}

/* ── Patient Row ───────────────────────────────────────────────────── */
.patient-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 0;
  color: inherit;
  transition: opacity var(--transition-base);
}

.patient-row:hover { opacity: 0.75; }

.patient-row__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #4b5563;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.patient-row__name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-heading);
}

.patient-row__meta {
  font-size: 0.68rem;
  color: #6b7280;
}

/* ── Empty State ───────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #9ca3af;
}

.empty-state i {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.8rem;
  margin: 0;
}

/* ── Status Dot ────────────────────────────────────────────────────── */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

/* ── Progress Bar ──────────────────────────────────────────────────── */
.progress {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 20px;
}

.progress-bar {
  border-radius: 20px;
  transition: width 0.6s ease;
}

/* ── Nav Tabs ──────────────────────────────────────────────────────── */
.nav-tabs {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  gap: 0.25rem;
}

.nav-tabs .nav-link {
  border: none;
  color: var(--text-muted);
  padding: 0.6rem 1rem;
  border-radius: 8px 8px 0 0;
  font-weight: 500;
  font-size: 0.85rem;
  transition: all var(--transition-base);
  margin-bottom: -1px;
}

.nav-tabs .nav-link:hover {
  background: rgba(0, 98, 255, 0.05);
  color: var(--text-main);
  border: none;
}

.nav-tabs .nav-link.active {
  color: var(--primary-blue);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--primary-blue);
  font-weight: 600;
}

@media (prefers-reduced-motion: no-preference) {
  .tab-pane {
    animation: fadeIn 0.25s ease;
  }
}

/* ── Pagination ────────────────────────────────────────────────────── */
.pagination {
  gap: 0.2rem;
}

.page-link {
  border: none;
  border-radius: 8px !important;
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  transition: all var(--transition-base);
}

.page-link:hover {
  background: rgba(0, 98, 255, 0.08);
  color: var(--primary-blue);
}

.page-item.active .page-link {
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-purple));
  color: #fff;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.page-item.disabled .page-link {
  color: #9ca3af;
  background: transparent;
}

/* ── Modal ─────────────────────────────────────────────────────────── */
.modal-content {
  border: none;
  border-radius: var(--radius-card);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 1.25rem 1.5rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 1rem 1.5rem;
}

/* ── Toast ─────────────────────────────────────────────────────────── */
.toast {
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.toast-container {
  z-index: 9999;
}

/* ── Dropdown ──────────────────────────────────────────────────────── */
.dropdown-menu {
  border: none;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  padding: 0.5rem;
}

.dropdown-item {
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  transition: background var(--transition-base);
}

.dropdown-item:hover {
  background: rgba(0, 98, 255, 0.08);
}

.dropdown-item.active {
  background: rgba(0, 98, 255, 0.1);
  color: var(--primary-blue);
}

.dropdown-header {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
}

/* ── List Group ────────────────────────────────────────────────────── */
.list-group-item {
  transition: background var(--transition-base), padding-left var(--transition-base);
}

.list-group-item-action:hover {
  background: rgba(0, 98, 255, 0.04);
  padding-left: 1.35rem;
}

/* ── Login Page ────────────────────────────────────────────────────── */
.login-page {
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: fixed;
  width: 500px;
  height: 500px;
  background: var(--primary-blue);
  filter: blur(180px);
  border-radius: 50%;
  top: -100px;
  left: -100px;
  opacity: 0.08;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: fixed;
  width: 400px;
  height: 400px;
  background: var(--secondary-purple);
  filter: blur(180px);
  border-radius: 50%;
  bottom: -80px;
  right: -80px;
  opacity: 0.08;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .login-page::before {
    animation: floatBlob 10s ease-in-out infinite alternate;
  }

  .login-page::after {
    animation: floatBlob 12s ease-in-out infinite alternate-reverse;
  }
}

@keyframes floatBlob {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, -20px) scale(1.1); }
}

/* ── Scroll to Top ─────────────────────────────────────────────────── */
.scroll-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-purple));
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px var(--primary-glow);
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-smooth), transform var(--transition-smooth);
  z-index: 1000;
}

.scroll-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

/* ── Loading Overlay ───────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(0, 98, 255, 0.1);
  border-top-color: var(--primary-blue);
  border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
  .loading-spinner {
    animation: spin 0.8s linear infinite;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Breadcrumb custom ─────────────────────────────────────────────── */
.breadcrumb-custom {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.breadcrumb-custom a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-base);
}

.breadcrumb-custom a:hover {
  color: var(--primary-blue);
}

.breadcrumb-custom .separator {
  color: #9ca3af;
}

.breadcrumb-custom .current {
  color: var(--text-main);
  font-weight: 500;
}

/* ── Alert enhancements ────────────────────────────────────────────── */
.alert {
  border: none;
  border-radius: var(--radius-card);
  font-size: 0.88rem;
}

.alert-danger {
  background: #fef2f2;
  color: #b91c1c;
}

.alert-info {
  background: #eff6ff;
  color: #1d4ed8;
}

.alert-success {
  background: #f0fdf4;
  color: #15803d;
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
}

/* ── Helpers ───────────────────────────────────────────────────────── */
.text-gradient {
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 20px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .navbar { padding: 0.5rem 0; }
  .navbar-brand { font-size: 1.15rem; }
  .nav-link { padding: 0.5rem 0.8rem !important; font-size: 0.9rem; }
}

@media (max-width: 767.98px) {
  .table .d-mobile-none,
  .d-mobile-none { display: none !important; }

  .btn-group { flex-direction: column; }
  .btn-group .btn {
    border-radius: 8px !important;
    margin-bottom: 2px;
  }

  .card-body { padding: 1rem !important; }

  .navbar-brand { font-size: 1.1rem; }

  .mobile-full { width: 100%; }

  .table td,
  .table th {
    padding: 0.6rem 0.5rem;
    font-size: 0.82rem;
  }

  .col-lg-4 .card:last-child { display: none; }

  .stat-card { padding: 1rem; }
  .stat-card__value { font-size: 1.4rem; }

  .quick-action { padding: 0.75rem; }
  .quick-action__icon { width: 36px; height: 36px; font-size: 1rem; }
  .quick-action__title { font-size: 0.75rem; }

  .nav-tabs .nav-link {
    font-size: 0.78rem;
    padding: 0.5rem 0.75rem;
  }

  .scroll-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 38px;
    height: 38px;
  }

  .toast-container {
    padding: 0.75rem;
    max-width: 100%;
  }

  .card-header-clean {
    padding: 0.7rem 1rem;
    font-size: 0.82rem;
  }
}

/* ── June 2026 UX Enhancements ─────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  body.page-transitioning {
    filter: blur(10px) brightness(0.9);
    transform: scale(0.98);
    opacity: 0.8;
    transition: filter 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .animate-blurred-zoom-in {
    animation: blurredZoomIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }
}

@keyframes blurredZoomIn {
  from { filter: blur(12px); transform: scale(1.05); opacity: 0; }
  to   { filter: blur(0); transform: scale(1); opacity: 1; }
}

/* 2. Visual Feedback (Shake) */
@keyframes hapticShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-6px); }
}

@media (prefers-reduced-motion: no-preference) {
  .haptic-shake {
    animation: hapticShake 0.3s ease-in-out;
  }
}

/* 3. Global Search (Spotlight Style) */
#globalSearchModal .modal-content {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--shadow-elevated);
}

.search-input-group {
  padding: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.search-input-group input {
  background: transparent !important;
  border: none !important;
  font-size: 1.25rem;
  font-weight: 500;
  box-shadow: none !important;
}

.search-results-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  transition: var(--transition-base);
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
}

.search-result-item:hover, .search-result-item.selected {
  background: rgba(0, 98, 255, 0.08);
  color: var(--primary-blue);
}

.search-result-item i {
  font-size: 1.25rem;
  margin-right: 1rem;
  opacity: 0.7;
}

.search-shortcut-hint {
  font-size: 0.7rem;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
}

.search-category-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 1rem 1rem 0.5rem;
}

/* ── Dark Mode ──────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-clinical: #0f172a;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --glass-bg: rgba(30, 41, 59, 0.8);
  --glass-border: rgba(255, 255, 255, 0.08);
  --shadow-elevated: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.35);
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-heading: #f1f5f9;
  --card-bg: #1e293b;
  --card-border: rgba(255, 255, 255, 0.06);
  --table-header-bg: #1e293b;
  --table-row-hover: rgba(99, 102, 241, 0.1);
  --primary-glow: rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] body {
  background: var(--bg-gradient);
  color: var(--text-main);
}

[data-theme="dark"] .navbar {
  background: rgba(15, 23, 42, 0.9) !important;
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .dropdown-menu {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .dropdown-item {
  color: #e2e8f0;
}

[data-theme="dark"] .dropdown-item:hover {
  background: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .dropdown-header {
  color: #94a3b8;
}

[data-theme="dark"] .card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .card-header {
  background: #1e293b;
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .card-header-clean {
  background: #1e293b;
  color: #f1f5f9;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background: #1e293b;
}

[data-theme="dark"] .input-group-text {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.12);
  color: #94a3b8;
}

[data-theme="dark"] .table thead th {
  background: #1e293b;
  color: #94a3b8;
}

[data-theme="dark"] .table tbody td {
  border-color: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
}

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) {
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .stat-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .quick-action {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .modal-content {
  background: #1e293b;
}

[data-theme="dark"] .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .modal-footer {
  border-top-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .breadcrumb-custom {
  color: #94a3b8;
}

[data-theme="dark"] .breadcrumb-custom a {
  color: #94a3b8;
}

[data-theme="dark"] .loading-overlay {
  background: rgba(15, 23, 42, 0.85);
}

[data-theme="dark"] .toast {
  background: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .search-input-group {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .search-result-item {
  color: #e2e8f0;
}

[data-theme="dark"] .search-result-item:hover,
[data-theme="dark"] .search-result-item.selected {
  background: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .btn-outline-primary {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.4);
}

[data-theme="dark"] .btn-outline-secondary {
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.3);
}

[data-theme="dark"] .btn-outline-danger {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.4);
}

[data-theme="dark"] .alert-danger {
  background: rgba(127, 29, 29, 0.3);
  color: #fca5a5;
}

[data-theme="dark"] .alert-info {
  background: rgba(30, 58, 138, 0.3);
  color: #93c5fd;
}

[data-theme="dark"] .alert-success {
  background: rgba(22, 101, 52, 0.3);
  color: #86efac;
}

[data-theme="dark"] .alert-warning {
  background: rgba(120, 53, 15, 0.3);
  color: #fcd34d;
}

[data-theme="dark"] .empty-state {
  color: #64748b;
}

[data-theme="dark"] .page-link {
  color: #94a3b8;
}

[data-theme="dark"] .page-item.active .page-link {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
}

[data-theme="dark"] .list-group-item {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

[data-theme="dark"] .nav-tabs .nav-link {
  color: #94a3b8;
}

[data-theme="dark"] .nav-tabs .nav-link:hover {
  background: rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .nav-tabs .nav-link.active {
  color: #818cf8;
  border-bottom-color: #818cf8;
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #475569;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

[data-theme="dark"] .appt-row__avatar {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

[data-theme="dark"] .patient-row__avatar {
  background: #334155;
  color: #e2e8f0;
}

/* Dark mode toggle button */
.dark-mode-toggle {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-main);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: 1.1rem;
}

.dark-mode-toggle:hover {
  background: rgba(0, 98, 255, 0.08);
  color: var(--primary-blue);
}

/* ── WCAG Contrast Fixes ───────────────────────────────────────────── */
.text-muted {
  color: #6b7280 !important;
}

.form-label {
  color: #374151;
}

/* ── Table Inline Actions ───────────────────────────────────────────── */
.table-actions {
  position: relative;
  display: inline-block;
}

.table-actions .dropdown-toggle::after {
  display: none;
}

.table-actions .dropdown-menu {
  min-width: 160px;
  right: 0;
  left: auto;
}

.table-actions .btn-action {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-muted);
  transition: all var(--transition-base);
  cursor: pointer;
}

.table-actions .btn-action:hover {
  background: rgba(0, 98, 255, 0.08);
  color: var(--primary-blue);
  border-color: rgba(0, 98, 255, 0.2);
}

/* ── Skeleton Loading Cards ─────────────────────────────────────────── */
.skeleton-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 1.25rem;
}

.skeleton-card .skeleton-line {
  height: 12px;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.skeleton-card .skeleton-line:last-child {
  margin-bottom: 0;
}

.skeleton-card .skeleton-line.w-25 { width: 25%; }
.skeleton-card .skeleton-line.w-50 { width: 50%; }
.skeleton-card .skeleton-line.w-75 { width: 75%; }
.skeleton-card .skeleton-line.w-100 { width: 100%; }

/* ── Logout Confirmation Popover ────────────────────────────────────── */
.logout-confirm {
  position: relative;
}

.logout-confirm .logout-popover {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow-elevated);
  z-index: 1050;
  min-width: 220px;
}

.logout-confirm:hover .logout-popover,
.logout-confirm:focus-within .logout-popover {
  display: block;
}

/* ── Toast Dismiss All ──────────────────────────────────────────────── */
.toast-dismiss-all {
  position: fixed;
  bottom: 1.5rem;
  right: 4.5rem;
  z-index: 9999;
  display: none;
}

.toast-dismiss-all.visible {
  display: block;
}

/* ── Keyboard Navigation Highlight ──────────────────────────────────── */
.table tbody tr.kb-selected {
  background: rgba(0, 98, 255, 0.08) !important;
  outline: 2px solid var(--primary-blue);
  outline-offset: -2px;
}

/* ── Trend Indicator ────────────────────────────────────────────────── */
.stat-card__trend {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

.stat-card__trend--up {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.1);
}

.stat-card__trend--down {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

.stat-card__trend--neutral {
  color: #6b7280;
  background: rgba(107, 114, 128, 0.1);
}

/* ── Mobile Sidebar Navigation ──────────────────────────────────────── */
.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1040;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-sidebar-overlay.active {
  display: block;
  opacity: 1;
}

.mobile-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: var(--card-bg);
  border-right: 1px solid var(--card-border);
  z-index: 1050;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.mobile-sidebar.active {
  transform: translateX(0);
}

.mobile-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--card-border);
}

.mobile-sidebar-brand {
  font-weight: 700;
  font-size: 1.2rem;
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}

.mobile-sidebar-body {
  flex: 1;
  padding: 0.5rem;
  overflow-y: auto;
}

.mobile-sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-sidebar-nav li {
  margin-bottom: 0.15rem;
}

.mobile-nav-section {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  padding: 1rem 0.75rem 0.35rem;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition-base);
}

.mobile-nav-item:hover {
  background: rgba(0, 98, 255, 0.08);
  color: var(--primary-blue);
}

.mobile-nav-item.active {
  background: rgba(0, 98, 255, 0.1);
  color: var(--primary-blue);
  font-weight: 600;
}

.mobile-nav-item i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}

.mobile-sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--card-border);
}

/* Mobile sidebar toggle (hamburger) */
.mobile-sidebar-trigger {
  display: none;
}

@media (max-width: 991.98px) {
  .mobile-sidebar-trigger {
    display: inline-flex;
  }
}

[data-theme="dark"] .mobile-sidebar {
  background: #1e293b;
  border-right-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .mobile-sidebar-footer {
  border-top-color: rgba(255, 255, 255, 0.06);
}

/* ── Notification Panel ─────────────────────────────────────────────── */
.notification-panel {
  position: fixed;
  top: 60px;
  right: 20px;
  width: 360px;
  max-height: 480px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-elevated);
  z-index: 1050;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.notification-panel.active {
  display: flex;
}

.notification-panel__header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.9rem;
}

.notification-panel__body {
  flex: 1;
  overflow-y: auto;
  max-height: 340px;
}

.notification-panel__item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--card-border);
  transition: background var(--transition-base);
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
}

.notification-panel__item:hover {
  background: rgba(0, 98, 255, 0.04);
}

.notification-panel__item.unread {
  background: rgba(37, 99, 235, 0.04);
}

.notification-panel__item-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.notification-panel__item-content {
  flex: 1;
  min-width: 0;
}

.notification-panel__item-title {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.notification-panel__item-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.notification-panel__footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--card-border);
}

.notification-badge {
  font-size: 0.6rem;
  padding: 0.2em 0.45em;
}

[data-theme="dark"] .notification-panel {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .notification-panel__item:hover {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .notification-panel__item.unread {
  background: rgba(37, 99, 235, 0.08);
}

[data-theme="dark"] .notification-panel__header,
[data-theme="dark"] .notification-panel__footer {
  border-color: rgba(255, 255, 255, 0.06);
}
