/**
 * REVIVE Clinic Management System
 * Modern Design System Implementation
 * Version: 2.0.0
 */

/* ============================================
   CSS VARIABLES - DESIGN TOKENS
   ============================================ */

:root {
  /* ============================================
     MEDICAL/HEALTHCARE COLOR PALETTE
     Designed for trust, professionalism, and care
     ============================================ */

  /* Primary Colors - Medical Teal (Trust & Professionalism) */
  --primary-50:  #ECFEFF;
  --primary-100: #CFFAFE;
  --primary-200: #A5F3FC;
  --primary-300: #67E8F9;
  --primary-400: #22D3EE;
  --primary-500: #06B6D4;
  --primary-600: #0891B2;
  --primary-700: #0E7490;
  --primary-800: #155E75;
  --primary-900: #164E63;
  --primary-950: #083344;

  /* Secondary Colors - Calm Indigo (Professional & Soothing) */
  --secondary-50:  #EEF2FF;
  --secondary-100: #E0E7FF;
  --secondary-200: #C7D2FE;
  --secondary-300: #A5B4FC;
  --secondary-400: #818CF8;
  --secondary-500: #6366F1;
  --secondary-600: #4F46E5;
  --secondary-700: #4338CA;
  --secondary-800: #3730A3;
  --secondary-900: #312E81;

  /* Success Colors - Medical Green (Health & Vitality) */
  --success-50:  #ECFDF5;
  --success-100: #D1FAE5;
  --success-200: #A7F3D0;
  --success-300: #6EE7B7;
  --success-400: #34D399;
  --success-500: #10B981;
  --success-600: #059669;
  --success-700: #047857;
  --success-800: #065F46;
  --success-900: #064E3B;

  /* Warning Colors - Medical Amber (Caution & Attention) */
  --warning-50:  #FFFBEB;
  --warning-100: #FEF3C7;
  --warning-200: #FDE68A;
  --warning-300: #FCD34D;
  --warning-400: #FBBF24;
  --warning-500: #F59E0B;
  --warning-600: #D97706;
  --warning-700: #B45309;
  --warning-800: #92400E;
  --warning-900: #78350F;

  /* Danger Colors - Medical Rose (Urgent & Critical) */
  --danger-50:  #FFF1F2;
  --danger-100: #FFE4E6;
  --danger-200: #FECDD3;
  --danger-300: #FDA4AF;
  --danger-400: #FB7185;
  --danger-500: #F43F5E;
  --danger-600: #E11D48;
  --danger-700: #BE123C;
  --danger-800: #9F1239;
  --danger-900: #881337;

  /* Info Colors - Sky Blue (Information & Communication) */
  --info-50:  #F0F9FF;
  --info-100: #E0F2FE;
  --info-200: #BAE6FD;
  --info-300: #7DD3FC;
  --info-400: #38BDF8;
  --info-500: #0EA5E9;
  --info-600: #0284C7;
  --info-700: #0369A1;
  --info-800: #075985;
  --info-900: #0C4A6E;

  /* Accent Colors - Medical Coral (Warmth & Care) */
  --accent-50:  #FFF5F7;
  --accent-100: #FFE4E9;
  --accent-200: #FFCCD6;
  --accent-300: #FFA3B3;
  --accent-400: #FF7A90;
  --accent-500: #FF5470;
  --accent-600: #F43F5E;
  --accent-700: #E11D48;
  --accent-800: #BE123C;
  --accent-900: #9F1239;

  /* Neutral Grays - Professional & Clean */
  --gray-50:  #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;
  --gray-950: #020617;

  /* Teal Variants (Alternative Medical Color) */
  --teal-50:  #F0FDFA;
  --teal-100: #CCFBF1;
  --teal-200: #99F6E4;
  --teal-300: #5EEAD4;
  --teal-400: #2DD4BF;
  --teal-500: #14B8A6;
  --teal-600: #0D9488;
  --teal-700: #0F766E;
  --teal-800: #115E59;
  --teal-900: #134E4A;

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-headings: 'Plus Jakarta Sans', 'Inter', sans-serif;
  --font-arabic: 'Noto Sans Arabic', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Font Sizes */
  --text-xs:   0.75rem;   /* 12px */
  --text-sm:   0.875rem;  /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg:   1.125rem;  /* 18px */
  --text-xl:   1.25rem;   /* 20px */
  --text-2xl:  1.5rem;    /* 24px */
  --text-3xl:  1.875rem;  /* 30px */
  --text-4xl:  2.25rem;   /* 36px */
  --text-5xl:  3rem;      /* 48px */

  /* Line Heights */
  --leading-tight:  1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;

  /* Font Weights */
  --font-normal:   400;
  --font-medium:   500;
  --font-semibold: 600;
  --font-bold:     700;
  --font-black:    800;

  /* Spacing Scale */
  --spacing-0:  0;
  --spacing-1:  0.25rem;  /* 4px */
  --spacing-2:  0.5rem;   /* 8px */
  --spacing-3:  0.75rem;  /* 12px */
  --spacing-4:  1rem;     /* 16px */
  --spacing-5:  1.25rem;  /* 20px */
  --spacing-6:  1.5rem;   /* 24px */
  --spacing-8:  2rem;     /* 32px */
  --spacing-10: 2.5rem;   /* 40px */
  --spacing-12: 3rem;     /* 48px */
  --spacing-16: 4rem;     /* 64px */
  --spacing-20: 5rem;     /* 80px */
  --spacing-24: 6rem;     /* 96px */

  /* Border Radius */
  --radius-sm:   0.25rem;  /* 4px */
  --radius-base: 0.375rem; /* 6px */
  --radius-md:   0.5rem;   /* 8px */
  --radius-lg:   0.75rem;  /* 12px */
  --radius-xl:   1rem;     /* 16px */
  --radius-2xl:  1.5rem;   /* 24px */
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs:  0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm:  0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md:  0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:  0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl:  0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

  /* Colored Shadows - Medical Theme */
  --shadow-primary: 0 4px 14px 0 rgba(8, 145, 178, 0.25);    /* Medical Teal */
  --shadow-secondary: 0 4px 14px 0 rgba(99, 102, 241, 0.25); /* Calm Indigo */
  --shadow-success: 0 4px 14px 0 rgba(16, 185, 129, 0.25);   /* Medical Green */
  --shadow-warning: 0 4px 14px 0 rgba(245, 158, 11, 0.25);   /* Medical Amber */
  --shadow-danger:  0 4px 14px 0 rgba(244, 63, 94, 0.25);    /* Medical Rose */
  --shadow-info:    0 4px 14px 0 rgba(14, 165, 233, 0.25);   /* Sky Blue */
  --shadow-accent:  0 4px 14px 0 rgba(244, 63, 94, 0.25);    /* Medical Coral */

  /* Layout - Scaled down for better fit */
  --sidebar-width: 240px; /* Reduced from 280px */
  --sidebar-collapsed: 70px; /* Reduced from 80px */
  --topbar-height: 56px; /* Reduced from 64px */

  /* Transitions */
  --duration-fast: 150ms;
  --duration-base: 200ms;
  --duration-slow: 300ms;
  --duration-slower: 500ms;

  --ease-in:     cubic-bezier(0.4, 0, 1, 1);
  --ease-out:    cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

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

html {
  font-size: 11px; /* Scaled down from 16px to fit better (approximately 67% of original) */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Mobile devices - slightly smaller for better fit */
@media (max-width: 768px) {
  html {
    font-size: 10px; /* Even smaller on mobile for optimal viewing */
  }
}

/* Tablets - medium size */
@media (min-width: 769px) and (max-width: 1279px) {
  html {
    font-size: 10.5px;
  }
}

/* Laptops and smaller desktops */
@media (min-width: 1280px) and (max-width: 1919px) {
  html {
    font-size: 11px;
  }
}

/* Large screens - slightly larger base size */
@media (min-width: 1920px) {
  html {
    font-size: 12px;
  }
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--gray-600);
  background-color: var(--gray-50);
}

/* Lucide Icons - Global Styles */
i[data-lucide],
svg.lucide,
.lucide {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* Default size for inline icons */
i[data-lucide]:not([style*="width"]),
svg.lucide:not([style*="width"]),
.lucide:not([style*="width"]) {
  width: 1em;
  height: 1em;
}

/* Ensure Lucide icons are visible with proper colors */
.lucide {
  color: inherit;
  stroke: currentColor !important;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-headings);
  font-weight: var(--font-semibold);
  color: var(--gray-900);
  line-height: var(--leading-tight);
  margin-bottom: var(--spacing-4);
}

h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--text-3xl);
  color: var(--gray-800);
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
}

p {
  margin-bottom: var(--spacing-4);
}

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: color var(--duration-base) var(--ease-out);
}

a:hover {
  color: var(--primary-700);
}

/* Focus styles for accessibility */
*:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================
   LAYOUT COMPONENTS
   ============================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--gray-900) 0%, #0f1419 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  transition: transform var(--duration-slow) var(--ease-in-out);
}

.sidebar-header {
  padding: var(--spacing-6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  color: white;
  text-decoration: none;
  transition: opacity var(--duration-base) var(--ease-out);
}

.sidebar-logo:hover {
  opacity: 0.9;
}

.sidebar-logo-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-700) 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  position: relative;
}

.sidebar-logo-icon::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 14px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.sidebar-logo:hover .sidebar-logo-icon {
  transform: scale(1.05) rotate(-2deg);
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.5), 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Ensure Lucide SVG icons display properly inside sidebar-logo-icon */
.sidebar-logo-icon svg,
.sidebar-logo-icon .lucide,
.sidebar-logo-icon i[data-lucide] {
  width: 28px !important;
  height: 28px !important;
  color: white !important;
  stroke: white !important;
  stroke-width: 2;
}

.sidebar-logo h1 {
  font-size: 1.375rem;
  color: white;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: var(--spacing-4) 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Custom scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
}

.nav-section {
  margin-bottom: var(--spacing-6);
}

.nav-section-title {
  padding: var(--spacing-3) var(--spacing-6);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: var(--spacing-2);
  margin-top: var(--spacing-4);
  position: relative;
}

.nav-section-title::before {
  content: '';
  position: absolute;
  left: var(--spacing-6);
  bottom: 0;
  width: 30px;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-500), transparent);
  border-radius: 2px;
}

.nav-section:first-child .nav-section-title {
  margin-top: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: 0.875rem var(--spacing-6);
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 0.25rem var(--spacing-3);
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.9375rem;
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--primary-500);
  transform: scaleY(0);
  transition: transform 0.2s ease;
  border-radius: 0 2px 2px 0;
}

.nav-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

.nav-item:hover::before {
  transform: scaleY(0.6);
}

.nav-item.active {
  color: white;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(79, 70, 229, 0.3) 100%);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.nav-item.active::before {
  transform: scaleY(1);
}

.nav-item-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.nav-item:hover .nav-item-icon {
  transform: scale(1.1);
}

.nav-item.active .nav-item-icon {
  filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.4));
}

/* Disabled nav item (premium features) */
.nav-item.disabled {
  opacity: 0.6;
  cursor: pointer;
}

.nav-item.disabled:hover {
  background: var(--gray-100);
}

.nav-item.disabled .nav-item-icon {
  color: var(--gray-400);
}

/* Ensure Lucide SVG icons display properly inside nav-item-icon */
.nav-item-icon svg,
.nav-item-icon .lucide,
.nav-item-icon i[data-lucide] {
  width: 20px !important;
  height: 20px !important;
  stroke: currentColor !important;
  stroke-width: 2 !important;
}

.nav-badge {
  margin-left: auto;
  padding: 0.125rem 0.5rem;
  background: var(--danger-500);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
  line-height: 1;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: var(--spacing-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: 0.75rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-menu:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 0.9375rem;
  background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 100%);
  box-shadow: 0 4px 8px rgba(20, 184, 166, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.15);
  transition: transform 0.2s ease;
}

.user-menu:hover .user-avatar {
  transform: scale(1.05);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  color: white;
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.125rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.user-role {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
  text-transform: capitalize;
  font-weight: 500;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--gray-50);
}

/* Clinic Header */
.clinic-header {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  color: white;
  padding: var(--spacing-5) var(--spacing-8);
  box-shadow: var(--shadow-md);
}

.clinic-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-6);
  flex-wrap: wrap;
}

.clinic-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-4);
}

.clinic-logo {
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  backdrop-filter: blur(10px);
}

.clinic-details h2 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: white;
  margin: 0;
  letter-spacing: -0.01em;
}

.clinic-tagline {
  font-size: var(--text-sm);
  opacity: 0.9;
  margin: var(--spacing-1) 0 0 0;
}

.clinic-contact {
  display: flex;
  align-items: center;
  gap: var(--spacing-6);
  flex-wrap: wrap;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.95);
}

.contact-item svg,
.contact-item .lucide,
.contact-item i[data-lucide] {
  width: 16px !important;
  height: 16px !important;
  opacity: 0.9;
  stroke: currentColor !important;
  stroke-width: 2;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-4) var(--spacing-8);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-height);
  box-shadow: var(--shadow-xs);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-4);
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--gray-900);
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

/* Search Box */
.search-box {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-2) var(--spacing-4);
  background: var(--gray-100);
  border-radius: var(--radius-full);
  width: 300px;
  transition: all var(--duration-base) var(--ease-out);
}

.search-box:focus-within {
  background: white;
  box-shadow: var(--shadow-md);
  width: 350px;
}

.search-box svg {
  width: 18px;
  height: 18px;
  color: var(--gray-400);
  flex-shrink: 0;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: var(--text-sm);
  width: 100%;
  color: var(--gray-900);
}

.search-box input::placeholder {
  color: var(--gray-400);
}

/* Notification Button */
.notification-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--gray-600);
  cursor: pointer;
  background: none;
  border: none;
  transition: all var(--duration-base) var(--ease-out);
}

.notification-btn:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: var(--font-semibold);
  color: white;
  background: var(--danger-500);
  border-radius: var(--radius-full);
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* Notification Dropdown */
.notification-wrapper {
  position: relative;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.notification-dropdown.show {
  display: flex;
}

.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-4);
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.notification-dropdown-header h4 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--gray-900);
  margin: 0;
}

.notification-dropdown-body {
  flex: 1;
  overflow-y: auto;
  max-height: 360px;
}

.notification-dropdown-footer {
  padding: var(--spacing-3);
  border-top: 1px solid var(--gray-200);
  text-align: center;
  background: var(--gray-50);
}

.notification-empty {
  color: var(--gray-500);
  font-size: var(--text-sm);
}

/* Individual Notification Item */
.notification-item {
  display: flex;
  gap: var(--spacing-3);
  padding: var(--spacing-4);
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}

.notification-item:hover {
  background: var(--gray-50);
}

.notification-item.unread {
  background: var(--primary-50);
}

.notification-item.unread:hover {
  background: var(--primary-100);
}

.notification-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-item-icon.subscription {
  background: var(--warning-100);
  color: var(--warning-600);
}

.notification-item-icon.alert {
  background: var(--danger-100);
  color: var(--danger-600);
}

.notification-item-icon.reminder {
  background: var(--primary-100);
  color: var(--primary-600);
}

.notification-item-icon.system {
  background: var(--gray-100);
  color: var(--gray-600);
}

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

.notification-item-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--gray-900);
  margin-bottom: var(--spacing-1);
  line-height: 1.3;
}

.notification-item-message {
  font-size: var(--text-xs);
  color: var(--gray-600);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notification-item-time {
  font-size: 10px;
  color: var(--gray-400);
  margin-top: var(--spacing-1);
}

.notification-item-actions {
  display: flex;
  align-items: flex-start;
}

.notification-dismiss {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  opacity: 0;
  transition: all var(--duration-fast) var(--ease-out);
}

.notification-item:hover .notification-dismiss {
  opacity: 1;
}

.notification-dismiss:hover {
  background: var(--gray-200);
  color: var(--gray-600);
}

/* RTL Support for Notifications */
[dir="rtl"] .notification-dropdown {
  right: auto;
  left: 0;
}

[dir="rtl"] .notification-item {
  flex-direction: row-reverse;
}

[dir="rtl"] .notification-item-content {
  text-align: right;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2);
  padding: 0.625rem 1.5rem;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  font-family: var(--font-primary);
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button Variants */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

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

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border-color: var(--gray-300);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-success {
  background: var(--success-600);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.btn-success:hover {
  background: var(--success-700);
  box-shadow: var(--shadow-success);
}

.btn-danger {
  background: var(--danger-600);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
  background: var(--danger-700);
  box-shadow: var(--shadow-danger);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.btn-outline {
  background: transparent;
  color: var(--primary-600);
  border-color: var(--primary-600);
}

.btn-outline:hover {
  background: var(--primary-50);
}

/* Button Sizes */
.btn-xs {
  padding: 0.375rem 0.75rem;
  font-size: var(--text-xs);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
}

.btn-md {
  padding: 0.625rem 1.5rem;
  font-size: var(--text-sm);
}

.btn-lg {
  padding: 0.75rem 2rem;
  font-size: var(--text-base);
}

.btn-xl {
  padding: 1rem 2.5rem;
  font-size: var(--text-lg);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
}

.btn-icon-lg {
  width: 48px;
  height: 48px;
}

/* Loading State */
.btn-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.6s linear infinite;
  color: white;
}

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

/* ============================================
   FORMS
   ============================================ */

.form-group {
  margin-bottom: var(--spacing-5);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-2);
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  color: var(--gray-700);
}

.form-label.required::after {
  content: '*';
  color: var(--danger-500);
  margin-left: var(--spacing-1);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--gray-900);
  background-color: white;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  transition: all var(--duration-base) var(--ease-out);
  font-family: var(--font-primary);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--gray-400);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--gray-400);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background-color: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
}

.form-textarea,
textarea.form-input {
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* Range slider */
.form-range {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary-600);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
  transition: all 0.15s ease;
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(99, 102, 241, 0.5);
}

.form-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary-600);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

/* Mini stat cards for details view */
.stat-mini {
  background: var(--gray-50);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  text-align: center;
}

/* Input with icon */
.input-group {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
}

.input-with-icon {
  padding-left: 2.5rem;
}

.input-icon-right {
  left: auto;
  right: 0.75rem;
}

.input-with-icon-right {
  padding-right: 2.5rem;
}

/* Form validation states */
.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
  border-color: var(--danger-500);
}

.form-input.is-invalid:focus,
.form-select.is-invalid:focus,
.form-textarea.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input.is-valid,
.form-select.is-valid,
.form-textarea.is-valid {
  border-color: var(--success-500);
}

.form-input.is-valid:focus,
.form-select.is-valid:focus,
.form-textarea.is-valid:focus {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.form-error {
  margin-top: var(--spacing-1);
  font-size: var(--text-xs);
  color: var(--danger-600);
}

.form-help,
.form-hint {
  margin-top: var(--spacing-1);
  font-size: var(--text-xs);
  color: var(--gray-500);
  display: block;
}

/* Form layouts */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-4);
}

.form-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* Checkbox & Radio */
.form-checkbox,
.form-radio {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  cursor: pointer;
  user-select: none;
}

.form-checkbox input[type="checkbox"],
.form-radio input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-600);
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  overflow: hidden;
  transition: all var(--duration-base) var(--ease-out);
}

.card-hover:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gray-200);
  transform: translateY(-2px);
}

.card-header {
  padding: var(--spacing-5) var(--spacing-6);
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--gray-900);
  margin: 0;
}

.card-body {
  padding: var(--spacing-6);
}

.card-footer {
  padding: var(--spacing-4) var(--spacing-6);
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Stat Card */
.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--spacing-6);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-4);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
  overflow: hidden;
}

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

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

.stat-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-size: 1.5rem;
  flex-shrink: 0;
}

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

.stat-label {
  font-size: var(--text-sm);
  color: var(--gray-500);
  margin-bottom: var(--spacing-1);
  font-weight: var(--font-medium);
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: var(--spacing-2);
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-base);
}

.stat-change.positive {
  color: var(--success-700);
  background: var(--success-50);
}

.stat-change.negative {
  color: var(--danger-700);
  background: var(--danger-50);
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
}

.table thead {
  background: var(--gray-50);
}

.table th {
  padding: var(--spacing-3) var(--spacing-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.table td {
  padding: var(--spacing-4);
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.table tbody tr {
  transition: background-color var(--duration-fast) var(--ease-out);
}

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

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

/* Striped table */
.table-striped tbody tr:nth-child(even) {
  background: var(--gray-50);
}

.table-striped tbody tr:hover {
  background: var(--gray-100);
}

/* ============================================
   BADGES & PILLS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  padding: 0.25rem 0.625rem;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  line-height: 1;
}

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Badge variants */
.badge-primary {
  background: var(--primary-100);
  color: var(--primary-700);
}

.badge-success {
  background: var(--success-50);
  color: var(--success-700);
}

.badge-warning {
  background: var(--warning-50);
  color: var(--warning-700);
}

.badge-danger {
  background: var(--danger-50);
  color: var(--danger-700);
}

.badge-gray {
  background: var(--gray-100);
  color: var(--gray-700);
}

.badge-info {
  background: #e0f2fe;
  color: #0369a1;
}

/* Status badges - semantic naming */
.status-active,
.status-completed,
.status-paid {
  background: var(--success-50);
  color: var(--success-700);
}

.status-pending,
.status-scheduled {
  background: var(--warning-50);
  color: var(--warning-700);
}

.status-cancelled,
.status-failed,
.status-overdue {
  background: var(--danger-50);
  color: var(--danger-700);
}

.status-draft,
.status-inactive {
  background: var(--gray-100);
  color: var(--gray-700);
}

/* ============================================
   MODALS
   ============================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--spacing-4);
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-base) var(--ease-out);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: var(--radius-xl);
  max-width: 42rem;
  width: 100%;
  max-height: 90vh;
  box-shadow: var(--shadow-2xl);
  transform: scale(0.95) translateY(20px);
  transition: transform var(--duration-slow) var(--ease-out);
  overflow: hidden;
}

.modal-backdrop.active .modal {
  transform: scale(1) translateY(0);
}

.modal-sm {
  max-width: 28rem;
}

.modal-lg {
  max-width: 56rem;
}

.modal-xl {
  max-width: 72rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-6);
  border-bottom: 1px solid var(--gray-200);
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--gray-900);
  margin: 0;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--gray-500);
  background: none;
  border: none;
  transition: all var(--duration-base) var(--ease-out);
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.modal-body {
  padding: var(--spacing-6);
  overflow-y: auto;
  max-height: calc(90vh - 65px);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--spacing-3);
  padding: var(--spacing-5) var(--spacing-6);
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  position: sticky;
  bottom: 0;
  margin: 0 calc(-1 * var(--spacing-6));
  z-index: 10;
}

/* Modal Stacking Support */
.modal-backdrop.stacked {
  z-index: 1100;
  background: rgba(17, 24, 39, 0.85);
}

.modal-backdrop.stacked .modal {
  z-index: 1101;
}

/* Patient Detail List Items */
.patient-list-item {
  padding: 0.75rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color var(--duration-fast) ease;
  position: relative;
}

.patient-list-item:hover {
  background-color: var(--gray-50);
}

.patient-list-item:last-child {
  border-bottom: none;
}

.patient-list-item-content {
  flex: 1;
  min-width: 0;
}

.patient-list-item-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity var(--duration-fast) ease;
  margin-left: 0.5rem;
}

.patient-list-item:hover .patient-list-item-actions {
  opacity: 1;
}

.patient-list-item-status {
  margin-right: 0.5rem;
}

/* Patient Header Card */
.patient-header-card {
  display: flex;
  gap: 1.5rem;
  align-items: start;
  padding: 2rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
  border: 2px solid var(--primary-100);
  border-radius: 16px;
  margin-bottom: 2rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
  transition: all 0.3s ease;
}

.patient-header-card:hover {
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
  transform: translateY(-2px);
}

.patient-info-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.875rem;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.patient-info-badge:hover {
  border-color: var(--primary-200);
  background: var(--primary-50);
  color: var(--primary-700);
}

/* Empty State */
.empty-state-inline {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--gray-500);
}

.empty-state-inline-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.empty-state-inline-text {
  font-size: var(--text-sm);
  color: var(--gray-600);
  margin-bottom: 0.25rem;
}

.empty-state-inline-hint {
  font-size: var(--text-xs);
  color: var(--gray-500);
}

/* ============================================
   SESSION CONTROLS
   ============================================ */

/* Session Counter Container */
.session-counter {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-2) var(--spacing-3);
  background: var(--gray-50);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  min-width: 200px;
}

/* Session Progress Bar */
.session-progress {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-1);
}

.session-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--gray-600);
  font-weight: 500;
}

.session-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.session-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
  border-radius: var(--radius-full);
  transition: width var(--duration-normal) var(--ease-out);
}

/* Session Control Buttons */
.session-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
}

.session-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-1) var(--spacing-2);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: white;
  color: var(--gray-700);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  white-space: nowrap;
}

.session-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.session-btn:active {
  transform: scale(0.95);
}

.session-btn-plus {
  border-color: var(--success-300);
  color: var(--success-700);
  background: var(--success-50);
}

.session-btn-plus:hover {
  background: var(--success-100);
  border-color: var(--success-400);
}

.session-btn-minus {
  border-color: var(--danger-300);
  color: var(--danger-700);
  background: var(--danger-50);
  min-width: 32px;
}

.session-btn-minus:hover {
  background: var(--danger-100);
  border-color: var(--danger-400);
}

.session-btn-details {
  border-color: var(--primary-300);
  color: var(--primary-700);
  background: var(--primary-50);
  gap: var(--spacing-1);
}

.session-btn-details:hover {
  background: var(--primary-100);
  border-color: var(--primary-400);
}

/* Last Session Indicator */
.last-session {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-1) var(--spacing-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
}

.last-session-icon {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
}

.last-session.fresh {
  background: var(--success-50);
  color: var(--success-700);
}

.last-session.fresh .last-session-icon {
  background: var(--success-500);
}

.last-session.warning {
  background: var(--warning-50);
  color: var(--warning-700);
}

.last-session.warning .last-session-icon {
  background: var(--warning-500);
}

.last-session.overdue {
  background: var(--danger-50);
  color: var(--danger-700);
}

.last-session.overdue .last-session-icon {
  background: var(--danger-500);
}

/* ============================================
   PILL SELECTOR
   ============================================ */

.pill-selector {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-2);
  padding: var(--spacing-2) 0;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-2) var(--spacing-4);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-full);
  background: white;
  color: var(--gray-700);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  user-select: none;
  min-width: 70px;
}

.pill-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
  transform: translateY(-1px);
}

.pill-btn:active {
  transform: translateY(0);
}

.pill-btn.active {
  background: var(--primary-500);
  border-color: var(--primary-500);
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.pill-btn.active:hover {
  background: var(--primary-600);
  border-color: var(--primary-600);
}

/* Blood Group Pills - Special Styling */
.pill-selector.blood-group .pill-btn {
  min-width: 60px;
  font-weight: 600;
}

.pill-selector.blood-group .pill-btn.active {
  background: var(--danger-500);
  border-color: var(--danger-500);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.pill-selector.blood-group .pill-btn.active:hover {
  background: var(--danger-600);
  border-color: var(--danger-600);
}

/* Gender Pills - Special Styling */
.pill-selector.gender .pill-btn {
  min-width: 90px;
}

/* ============================================
   PAIN LEVEL SLIDER
   ============================================ */

.pain-level-container {
  padding: var(--spacing-4) 0;
}

.pain-level-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-2);
}

.pain-level-label span {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-700);
}

.pain-level-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: var(--spacing-1) var(--spacing-2);
  background: var(--primary-50);
  color: var(--primary-700);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
}

.pain-level-slider {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-full);
  background: linear-gradient(
    to right,
    var(--success-200) 0%,
    var(--warning-200) 50%,
    var(--danger-200) 100%
  );
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.pain-level-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: white;
  border: 3px solid var(--primary-500);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: all var(--duration-fast) ease;
}

.pain-level-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  border-color: var(--primary-600);
}

.pain-level-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: white;
  border: 3px solid var(--primary-500);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: all var(--duration-fast) ease;
}

.pain-level-slider::-moz-range-thumb:hover {
  transform: scale(1.1);
  border-color: var(--primary-600);
}

.pain-level-scale {
  display: flex;
  justify-content: space-between;
  margin-top: var(--spacing-2);
  font-size: var(--text-xs);
  color: var(--gray-500);
  padding: 0 var(--spacing-1);
}

/* ============================================
   ENHANCED FORM CARDS
   ============================================ */

.form-card-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-5);
}

.form-card {
  background: white;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: var(--spacing-5);
  transition: all var(--duration-normal) var(--ease-out);
}

.form-card:hover {
  border-color: var(--gray-300);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.form-card-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  margin-bottom: var(--spacing-4);
  padding-bottom: var(--spacing-3);
  border-bottom: 2px solid var(--gray-100);
}

.form-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  font-size: 1.25rem;
  background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
  color: var(--primary-600);
  transition: all var(--duration-normal) ease;
}

.form-card:hover .form-card-icon {
  transform: scale(1.1) rotate(5deg);
}

/* Ensure Lucide SVG icons display properly inside form-card-icon */
.form-card-icon svg,
.form-card-icon .lucide,
.form-card-icon i[data-lucide] {
  width: 20px !important;
  height: 20px !important;
  color: var(--primary-600);
  stroke: var(--primary-600) !important;
  stroke-width: 2 !important;
}

.form-card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

/* Input with Icon Prefix */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: var(--spacing-3);
  font-size: 1.125rem;
  pointer-events: none;
  z-index: 1;
  opacity: 0.6;
  transition: all var(--duration-normal) ease;
}

.input-with-icon .form-input,
.input-with-icon .form-select {
  padding-left: 2.75rem;
}

.input-with-icon:focus-within .input-icon {
  opacity: 1;
  transform: scale(1.1);
}

/* Enhanced Form Inputs with Animation */
.form-input,
.form-select,
.form-textarea {
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary-400);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

/* Form Group with Enhanced Spacing */
.form-card .form-group {
  margin-bottom: var(--spacing-4);
}

.form-card .form-group:last-child {
  margin-bottom: 0;
}

/* Form Label Enhancement */
.form-card .form-label {
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: var(--spacing-2);
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
}

/* Pill Selector Container */
.form-group .pill-selector {
  padding: var(--spacing-3) 0;
}

.form-group .pill-selector .pill-btn {
  transition: all var(--duration-normal) var(--ease-out);
}

/* Form Hint Text */
.form-hint {
  display: block;
  margin-top: var(--spacing-2);
  font-size: var(--text-xs);
  color: var(--gray-500);
  font-style: italic;
}

/* Animation for form appearance */
@keyframes slideUpFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-card {
  animation: slideUpFadeIn var(--duration-normal) var(--ease-out);
}

.form-card:nth-child(1) {
  animation-delay: 0ms;
}

.form-card:nth-child(2) {
  animation-delay: 100ms;
}

.form-card:nth-child(3) {
  animation-delay: 200ms;
}

/* ============================================
   ALERTS & TOASTS
   ============================================ */

.alert {
  padding: var(--spacing-4) var(--spacing-5);
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-4);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-3);
  border: 1.5px solid;
  font-size: var(--text-sm);
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.alert-content {
  flex: 1;
}

.alert-success {
  background: var(--success-50);
  color: var(--success-700);
  border-color: var(--success-100);
}

.alert-warning {
  background: var(--warning-50);
  color: var(--warning-700);
  border-color: var(--warning-100);
}

.alert-danger {
  background: var(--danger-50);
  color: var(--danger-700);
  border-color: var(--danger-100);
}

.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border-color: #dbeafe;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: var(--spacing-6);
  right: var(--spacing-6);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-3);
  z-index: 2000;
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-3);
  padding: var(--spacing-4) var(--spacing-5);
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border-left: 4px solid;
  animation: slideIn var(--duration-slow) var(--ease-out);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-success {
  border-left-color: var(--success-500);
}

.toast-error {
  border-left-color: var(--danger-500);
}

.toast-warning {
  border-left-color: var(--warning-500);
}

.toast-info {
  border-left-color: var(--info-500);
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: var(--font-semibold);
  color: var(--gray-900);
  margin-bottom: var(--spacing-1);
}

.toast-message {
  font-size: var(--text-sm);
  color: var(--gray-600);
}

/* ============================================
   LOADING & SPINNERS
   ============================================ */

.loading-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-12);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary-600);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner-lg {
  width: 60px;
  height: 60px;
  border-width: 4px;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-200) 0%,
    var(--gray-100) 50%,
    var(--gray-200) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 1rem;
  margin-bottom: var(--spacing-2);
}

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

.skeleton-button {
  height: 40px;
  width: 100px;
}

/* ============================================
   AVATARS
   ============================================ */

.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-semibold);
  color: white;
  font-size: var(--text-sm);
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  text-transform: uppercase;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: var(--text-xs);
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: var(--text-base);
}

.avatar-xl {
  width: 64px;
  height: 64px;
  font-size: var(--text-xl);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* Avatar Group */
.avatar-group {
  display: flex;
  align-items: center;
}

.avatar-group .avatar {
  margin-left: -12px;
  border: 2px solid white;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
  text-align: center;
  padding: var(--spacing-16) var(--spacing-8);
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--spacing-6);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  font-size: 2.5rem;
}

.empty-state-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--gray-900);
  margin-bottom: var(--spacing-2);
}

.empty-state-description {
  color: var(--gray-500);
  margin-bottom: var(--spacing-6);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================
   TABS
   ============================================ */

.tabs {
  display: flex;
  gap: var(--spacing-2);
  padding: var(--spacing-2);
  background: var(--gray-100);
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-6);
  overflow-x: auto;
}

.tab {
  padding: var(--spacing-2) var(--spacing-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--gray-600);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: none;
  border: none;
  transition: all var(--duration-base) var(--ease-out);
  white-space: nowrap;
  flex-shrink: 0;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--gray-900);
}

.tab.active {
  background: white;
  color: var(--primary-600);
  box-shadow: var(--shadow-sm);
}

.tab-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--gray-200);
  color: var(--gray-700);
  border-radius: 12px;
  line-height: 1;
}

.tab.active .tab-badge {
  background: var(--primary-100);
  color: var(--primary-700);
}

.tab-content {
  position: relative;
}

.tab-pane {
  display: none;
  animation: fadeIn var(--duration-slow) var(--ease-out);
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

/* Flexbox */
.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

/* Gap */
.gap-1 { gap: var(--spacing-1); }
.gap-2 { gap: var(--spacing-2); }
.gap-3 { gap: var(--spacing-3); }
.gap-4 { gap: var(--spacing-4); }
.gap-5 { gap: var(--spacing-5); }
.gap-6 { gap: var(--spacing-6); }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Text Transform */
.text-uppercase { text-transform: uppercase; }
.text-lowercase { text-transform: lowercase; }
.text-capitalize { text-transform: capitalize; }

/* Font Weight */
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

/* Text Colors */
.text-primary { color: var(--primary-600); }
.text-success { color: var(--success-600); }
.text-danger { color: var(--danger-600); }
.text-warning { color: var(--warning-600); }
.text-muted { color: var(--gray-500); }
.text-dark { color: var(--gray-900); }

/* Background Colors */
.bg-primary { background-color: var(--primary-600); }
.bg-success { background-color: var(--success-600); }
.bg-danger { background-color: var(--danger-600); }
.bg-warning { background-color: var(--warning-600); }
.bg-gray { background-color: var(--gray-100); }
.bg-white { background-color: white; }

/* Margin */
.m-0 { margin: 0; }
.mt-2 { margin-top: var(--spacing-2); }
.mt-4 { margin-top: var(--spacing-4); }
.mt-6 { margin-top: var(--spacing-6); }
.mb-2 { margin-bottom: var(--spacing-2); }
.mb-4 { margin-bottom: var(--spacing-4); }
.mb-6 { margin-bottom: var(--spacing-6); }
.ml-2 { margin-left: var(--spacing-2); }
.ml-4 { margin-left: var(--spacing-4); }
.mr-2 { margin-right: var(--spacing-2); }
.mr-4 { margin-right: var(--spacing-4); }

/* Padding */
.p-0 { padding: 0; }
.p-4 { padding: var(--spacing-4); }
.p-6 { padding: var(--spacing-6); }
.pt-4 { padding-top: var(--spacing-4); }
.pb-4 { padding-bottom: var(--spacing-4); }
.pl-4 { padding-left: var(--spacing-4); }
.pr-4 { padding-right: var(--spacing-4); }

/* Border */
.border { border: 1px solid var(--gray-200); }
.border-0 { border: none; }
.border-top { border-top: 1px solid var(--gray-200); }
.border-bottom { border-bottom: 1px solid var(--gray-200); }

/* Border Radius */
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* Shadow */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-none { box-shadow: none; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

@media (max-width: 768px) {
  /* Hide on mobile */
  .mobile-hide {
    display: none !important;
  }

  /* Show only on mobile */
  .mobile-only {
    display: block !important;
  }

  /* Sidebar adjustments */
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  /* Stack form rows */
  .form-row {
    grid-template-columns: 1fr;
  }

  /* Full width search */
  .search-box {
    width: 100%;
  }

  .search-box:focus-within {
    width: 100%;
  }

  /* Toast container */
  .toast-container {
    bottom: var(--spacing-4);
    right: var(--spacing-4);
    left: var(--spacing-4);
    max-width: none;
  }
}

@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Skip to main content link */
.skip-to-main {
  position: absolute;
  top: -100px;
  left: 0;
  padding: var(--spacing-4);
  background: var(--primary-600);
  color: white;
  z-index: 9999;
  transition: top var(--duration-base) var(--ease-out);
}

.skip-to-main:focus {
  top: 0;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  /* Hide non-essential elements */
  .sidebar,
  .topbar,
  .no-print {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
  }

  /* Optimize for print */
  body {
    background: white;
  }

  .card,
  .modal {
    box-shadow: none;
    border: 1px solid var(--gray-300);
  }

  /* Page breaks */
  .page-break {
    page-break-after: always;
  }

  .avoid-break {
    page-break-inside: avoid;
  }
}

/* ============================================
   ADDITIONAL CLASSES FOR APP.JS COMPATIBILITY
   ============================================ */

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--spacing-4);
  margin-bottom: var(--spacing-6);
  flex-wrap: wrap;
}

.filter-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: all 0.2s;
}

.filter-select:hover {
  border-color: var(--gray-400);
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-100);
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.data-table thead {
  background-color: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
}

.data-table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--gray-700);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--gray-200);
  transition: background-color 0.15s;
}

.data-table tbody tr:hover {
  background-color: var(--gray-50);
}

.data-table tbody td {
  padding: 1rem;
  color: var(--gray-900);
}

/* Utility Classes */
.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.text-sm {
  font-size: var(--text-sm);
}

.text-muted {
  color: var(--gray-600);
}

.font-semibold {
  font-weight: 600;
}

.w-full {
  width: 100%;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gray-600);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  margin: 0.5rem 0 0 0;
  font-size: var(--text-lg);
  color: var(--gray-700);
}

.empty-state p {
  margin: 0.5rem 0 0 0;
  font-size: var(--text-sm);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Reduced from 250px */
  gap: var(--spacing-6);
  margin-bottom: var(--spacing-8);
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); /* Reduced from 240px */
  gap: var(--spacing-6);
  margin-bottom: var(--spacing-8);
}

.summary-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--spacing-6);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-4);
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

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

.summary-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-size: 1.5rem;
  flex-shrink: 0;
}

.summary-card-content {
  flex: 1;
}

.summary-card-label {
  font-size: var(--text-sm);
  color: var(--gray-500);
  margin-bottom: 0.25rem;
  font-weight: var(--font-medium);
}

.summary-card-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--gray-900);
}

/* Loading Spinner */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================
   DYNAMIC ITEM LIST COMPONENT
   ============================================ */

.item-list-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-3);
}

.item-list-items {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
}

.item-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background-color: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.item-list-item:hover {
  background-color: var(--gray-100);
  border-color: var(--gray-300);
}

.item-list-item-text {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--gray-900);
}

.item-list-item-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.25rem;
  line-height: 1;
}

.item-list-item-remove:hover {
  background-color: var(--danger-50);
  color: var(--danger-600);
}

.item-list-add {
  display: flex;
  gap: var(--spacing-2);
  align-items: flex-start;
}

.item-list-add > div {
  flex: 1;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
}

.autocomplete-item {
  padding: 0.625rem 1rem;
  font-size: var(--text-sm);
  color: var(--gray-900);
  cursor: pointer;
  transition: background-color 0.15s;
}

.autocomplete-item:hover {
  background-color: var(--primary-50);
}

.autocomplete-item:not(:last-child) {
  border-bottom: 1px solid var(--gray-100);
}

/* ============================================
   SEARCHABLE SELECT COMPONENT
   ============================================ */

.searchable-select {
  position: relative;
  width: 100%;
}

.searchable-select-input {
  width: 100%;
  padding: 0.625rem 2.5rem 0.625rem 1rem;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--gray-900);
  background-color: white;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.searchable-select-input:hover {
  border-color: var(--gray-400);
}

.searchable-select-input:focus,
.searchable-select-input:focus-within {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.searchable-select-arrow {
  position: absolute;
  right: 1rem;
  font-size: 0.625rem;
  color: var(--gray-500);
  pointer-events: none;
}

.searchable-select-dropdown {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow: hidden;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.searchable-select-search {
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: var(--text-sm);
  border: none;
  border-bottom: 1px solid var(--gray-200);
  outline: none;
  flex-shrink: 0;
}

.searchable-select-search:focus {
  border-bottom-color: var(--primary-500);
}

.searchable-select-options {
  overflow-y: auto;
  max-height: 260px;
}

.searchable-select-option {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s;
  border-bottom: 1px solid var(--gray-100);
}

.searchable-select-option:last-child {
  border-bottom: none;
}

.searchable-select-option:hover {
  background-color: var(--primary-50);
}

.searchable-select-option-main {
  font-size: var(--text-sm);
  color: var(--gray-900);
  margin-bottom: 0.125rem;
}

.searchable-select-option-sub {
  font-size: var(--text-xs);
  color: var(--gray-600);
}

.searchable-select-empty {
  padding: 1rem;
  text-align: center;
  color: var(--gray-500);
  font-size: var(--text-sm);
  cursor: default;
}

.searchable-select-empty:hover {
  background-color: transparent;
}

/* Subscription Status Banners */
.subscription-banner {
  margin: 1rem 1.5rem 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.subscription-banner .banner-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
}

.subscription-banner .banner-icon {
  flex-shrink: 0;
}

.subscription-banner .banner-icon i {
  width: 24px;
  height: 24px;
}

.subscription-banner .banner-message {
  flex: 1;
  font-size: var(--text-base);
  font-weight: 500;
}

.subscription-banner .banner-btn {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  outline: none;
}

.subscription-banner .banner-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Warning level (4-6 days) - Yellow */
.subscription-banner-warning {
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border: 1px solid #F59E0B;
  color: #92400E;
}

.subscription-banner-warning .banner-icon {
  color: #F59E0B;
}

.subscription-banner-warning .banner-btn {
  background: #F59E0B;
  color: white;
}

.subscription-banner-warning .banner-btn:hover {
  background: #D97706;
}

/* Urgent level (2-3 days) - Orange */
.subscription-banner-urgent {
  background: linear-gradient(135deg, #FED7AA 0%, #FDBA74 100%);
  border: 1px solid #EA580C;
  color: #7C2D12;
}

.subscription-banner-urgent .banner-icon {
  color: #EA580C;
}

.subscription-banner-urgent .banner-btn {
  background: #EA580C;
  color: white;
}

.subscription-banner-urgent .banner-btn:hover {
  background: #C2410C;
}

/* Critical level (0-1 days) - Red */
.subscription-banner-critical {
  background: linear-gradient(135deg, #FECACA 0%, #FCA5A5 100%);
  border: 1px solid #DC2626;
  color: #7F1D1D;
}

.subscription-banner-critical .banner-icon {
  color: #DC2626;
}

.subscription-banner-critical .banner-btn-urgent {
  background: #DC2626;
  color: white;
}

.subscription-banner-critical .banner-btn-urgent:hover {
  background: #B91C1C;
}

/* Read-only mode (grace period) - Dark Red */
.subscription-banner-readonly {
  background: linear-gradient(135deg, #FCA5A5 0%, #F87171 100%);
  border: 2px solid #DC2626;
  color: #7F1D1D;
}

.subscription-banner-readonly .banner-icon {
  color: #991B1B;
}

.subscription-banner-readonly .banner-btn-urgent {
  background: #991B1B;
  color: white;
}

.subscription-banner-readonly .banner-btn-urgent:hover {
  background: #7F1D1D;
}

/* Lockout mode - Black/Red */
.subscription-banner-lockout {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  border: 2px solid #7F1D1D;
  color: white;
}

.subscription-banner-lockout .banner-icon {
  color: white;
}

.subscription-banner-lockout .banner-message {
  color: white;
}

.subscription-banner-lockout .banner-btn-urgent {
  background: white;
  color: #DC2626;
  font-weight: 700;
}

.subscription-banner-lockout .banner-btn-urgent:hover {
  background: #F9FAFB;
  color: #991B1B;
}

/* Responsive */
@media (max-width: 768px) {
  .subscription-banner .banner-content {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
  }

  .subscription-banner .banner-btn {
    width: 100%;
  }
}

/* Settings Tabs */
.settings-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--gray-200);
  padding: 0 0.5rem;
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  background: transparent;
  color: var(--gray-600);
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  position: relative;
}

.settings-tab:hover {
  color: var(--primary-600);
  background: var(--gray-50);
}

.settings-tab.active {
  color: var(--primary-600);
  border-bottom-color: var(--primary-600);
  background: transparent;
}

.settings-tab-content {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .settings-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .settings-tab {
    padding: 0.75rem 1rem;
    font-size: var(--text-sm);
  }
}

/* ============================================
   PHASE 1: UI/UX IMPROVEMENTS
   Skeleton Loaders, Empty States, Micro-animations
   ============================================ */

/* ----------------------------------------
   1. SKELETON LOADERS
   Shimmer effect for loading states
   ---------------------------------------- */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-200) 0%,
    var(--gray-100) 40%,
    var(--gray-100) 60%,
    var(--gray-200) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Skeleton variants */
.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-sm);
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-title {
  height: 1.5rem;
  width: 50%;
  margin-bottom: 1rem;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.skeleton-avatar-sm {
  width: 32px;
  height: 32px;
}

.skeleton-avatar-lg {
  width: 64px;
  height: 64px;
}

.skeleton-button {
  height: 40px;
  width: 120px;
  border-radius: var(--radius-md);
}

.skeleton-card {
  padding: var(--spacing-6);
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}

.skeleton-image {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-md);
}

/* Skeleton table row */
.skeleton-table-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-4);
  padding: var(--spacing-4);
  border-bottom: 1px solid var(--gray-100);
}

.skeleton-table-row .skeleton-cell {
  height: 1rem;
  flex: 1;
}

.skeleton-table-row .skeleton-cell:first-child {
  max-width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  flex: none;
}

/* Skeleton stat card */
.skeleton-stat-card {
  padding: var(--spacing-6);
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}

.skeleton-stat-card .skeleton-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-4);
}

.skeleton-stat-card .skeleton-stat-value {
  height: 2rem;
  width: 60%;
  margin-bottom: var(--spacing-2);
}

.skeleton-stat-card .skeleton-stat-label {
  height: 1rem;
  width: 80%;
}

/* Loading container */
.loading-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
}

/* Pulse animation alternative */
.skeleton-pulse {
  animation: skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes skeleton-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ----------------------------------------
   2. EMPTY STATES
   Beautiful empty state components
   ---------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--spacing-12) var(--spacing-6);
  min-height: 300px;
}

.empty-state-icon {
  width: 120px;
  height: 120px;
  margin-bottom: var(--spacing-6);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
  border-radius: var(--radius-full);
  position: relative;
}

.empty-state-icon::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: var(--radius-full);
  border: 2px dashed var(--primary-200);
  animation: empty-state-rotate 20s linear infinite;
}

@keyframes empty-state-rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.empty-state-icon svg,
.empty-state-icon i {
  width: 48px;
  height: 48px;
  color: var(--primary-500);
}

.empty-state-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--gray-900);
  margin-bottom: var(--spacing-2);
}

.empty-state-description {
  font-size: var(--text-base);
  color: var(--gray-500);
  max-width: 400px;
  margin-bottom: var(--spacing-6);
  line-height: var(--leading-relaxed);
}

.empty-state-action {
  display: flex;
  gap: var(--spacing-3);
  flex-wrap: wrap;
  justify-content: center;
}

/* Empty state variants */
.empty-state-sm {
  padding: var(--spacing-8) var(--spacing-4);
  min-height: 200px;
}

.empty-state-sm .empty-state-icon {
  width: 80px;
  height: 80px;
}

.empty-state-sm .empty-state-icon svg,
.empty-state-sm .empty-state-icon i {
  width: 32px;
  height: 32px;
}

.empty-state-sm .empty-state-title {
  font-size: var(--text-lg);
}

.empty-state-sm .empty-state-description {
  font-size: var(--text-sm);
}

/* Inline empty state for tables */
.empty-state-inline {
  padding: var(--spacing-8);
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--gray-200);
}

.empty-state-inline .empty-state-icon {
  width: 64px;
  height: 64px;
  margin-bottom: var(--spacing-4);
}

.empty-state-inline .empty-state-icon::before {
  display: none;
}

.empty-state-inline .empty-state-icon svg,
.empty-state-inline .empty-state-icon i {
  width: 28px;
  height: 28px;
}

/* Color variants for empty states */
.empty-state-success .empty-state-icon {
  background: linear-gradient(135deg, var(--success-50) 0%, var(--success-100) 100%);
}

.empty-state-success .empty-state-icon::before {
  border-color: var(--success-200);
}

.empty-state-success .empty-state-icon svg {
  color: var(--success-500);
}

.empty-state-warning .empty-state-icon {
  background: linear-gradient(135deg, var(--warning-50) 0%, var(--warning-100) 100%);
}

.empty-state-warning .empty-state-icon::before {
  border-color: var(--warning-200);
}

.empty-state-warning .empty-state-icon svg {
  color: var(--warning-500);
}

.empty-state-danger .empty-state-icon {
  background: linear-gradient(135deg, var(--danger-50) 0%, var(--danger-100) 100%);
}

.empty-state-danger .empty-state-icon::before {
  border-color: var(--danger-200);
}

.empty-state-danger .empty-state-icon svg {
  color: var(--danger-500);
}

/* ----------------------------------------
   3. BUTTON MICRO-ANIMATIONS
   Enhanced button interactions
   ---------------------------------------- */

/* Improved button base transitions */
.btn {
  transition:
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
  transform: translateY(0);
  position: relative;
  overflow: hidden;
}

/* Press effect */
.btn:active:not(:disabled) {
  transform: translateY(1px);
}

/* Primary button glow on hover */
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.35);
}

.btn-primary:active:not(:disabled) {
  box-shadow: 0 2px 6px rgba(6, 182, 212, 0.25);
}

/* Success button glow */
.btn-success:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

/* Danger button glow */
.btn-danger:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.35);
}

/* Warning button glow */
.btn-warning:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

/* Ripple effect for buttons */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 50%;
  left: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 60%);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
}

.btn-ripple:active::after {
  transform: translate(-50%, -50%) scale(2);
  opacity: 1;
  transition: transform 0.4s ease-out, opacity 0.4s ease-out;
}

/* Icon spin on hover for specific buttons */
.btn-icon-spin:hover svg,
.btn-icon-spin:hover i {
  animation: icon-spin 0.5s ease-in-out;
}

@keyframes icon-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Icon bounce on hover */
.btn-icon-bounce:hover svg,
.btn-icon-bounce:hover i {
  animation: icon-bounce 0.4s ease-in-out;
}

@keyframes icon-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

/* Loading state for buttons */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin-left: -9px;
  margin-top: -9px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-right-color: transparent;
  animation: btn-spinner 0.6s linear infinite;
}

.btn-primary.btn-loading::after {
  border-color: white;
  border-right-color: transparent;
}

@keyframes btn-spinner {
  to {
    transform: rotate(360deg);
  }
}

/* Scale animation on hover for icon buttons */
.btn-icon:hover:not(:disabled) {
  transform: scale(1.05);
}

.btn-icon:active:not(:disabled) {
  transform: scale(0.95);
}

/* ----------------------------------------
   4. MOBILE TOUCH TARGETS
   Minimum 44px touch targets for mobile
   ---------------------------------------- */

@media (max-width: 768px) {
  /* Ensure minimum touch target size */
  .btn,
  .nav-item,
  .btn-icon,
  button,
  a.clickable,
  .clickable {
    min-height: 44px;
    min-width: 44px;
  }

  /* Adjust button padding for touch */
  .btn {
    padding: 0.75rem 1.25rem;
  }

  .btn-sm {
    min-height: 40px;
    padding: 0.625rem 1rem;
  }

  .btn-lg {
    min-height: 52px;
    padding: 1rem 1.75rem;
  }

  /* Navigation items */
  .nav-item {
    padding: 0.875rem 1rem;
  }

  /* Table action buttons */
  .table-actions .btn-icon,
  .actions .btn-icon {
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem;
  }

  /* Form inputs touch targets */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="date"],
  input[type="time"],
  input[type="search"],
  select,
  textarea {
    min-height: 48px;
    font-size: 16px; /* Prevents iOS zoom */
  }

  /* Checkbox and radio touch areas */
  input[type="checkbox"],
  input[type="radio"] {
    min-width: 24px;
    min-height: 24px;
  }

  /* Dropdown and select items */
  .dropdown-item,
  .select-option {
    min-height: 44px;
    padding: 0.75rem 1rem;
  }

  /* Cards and list items */
  .card-clickable,
  .list-item-clickable {
    min-height: 48px;
  }

  /* Tab buttons */
  .tab-btn,
  .settings-tab {
    min-height: 44px;
    padding: 0.75rem 1rem;
  }

  /* Notification and badge buttons */
  .notification-btn,
  #langToggle,
  #logoutBtn {
    min-width: 44px;
    min-height: 44px;
  }

  /* Search input */
  .search-box input {
    min-height: 44px;
  }

  /* Modal close button */
  .modal-close {
    min-width: 44px;
    min-height: 44px;
  }

  /* Pagination */
  .pagination-btn {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ----------------------------------------
   5. ADDITIONAL MICRO-INTERACTIONS
   Subtle animations for enhanced UX
   ---------------------------------------- */

/* Card hover lift effect */
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}

/* Smooth content fade in */
.fade-in {
  animation: content-fade-in 0.3s ease-out;
}

@keyframes content-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Staggered animation for list items */
.stagger-item {
  opacity: 0;
  animation: stagger-fade-in 0.4s ease-out forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.4s; }
.stagger-item:nth-child(9) { animation-delay: 0.45s; }
.stagger-item:nth-child(10) { animation-delay: 0.5s; }

@keyframes stagger-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Success checkmark animation */
.success-checkmark {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--success-100);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: success-pop 0.4s ease-out;
}

.success-checkmark svg {
  color: var(--success-600);
  animation: checkmark-draw 0.3s ease-out 0.2s both;
}

@keyframes success-pop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes checkmark-draw {
  from {
    stroke-dashoffset: 100;
    opacity: 0;
  }
  to {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

/* Tooltip animation */
.tooltip {
  animation: tooltip-fade-in 0.2s ease-out;
}

@keyframes tooltip-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Badge pulse for notifications */
.badge-pulse {
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Progress bar animation */
.progress-animated .progress-bar {
  animation: progress-grow 1s ease-out;
}

@keyframes progress-grow {
  from {
    width: 0;
  }
}

/* Shake animation for errors */
.shake {
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  20%, 60% {
    transform: translateX(-5px);
  }
  40%, 80% {
    transform: translateX(5px);
  }
}

/* ============================================
   PHASE 2: MOBILE FIRST IMPROVEMENTS
   Bottom Navigation, Swipe, Pull-to-Refresh
   ============================================ */

/* ----------------------------------------
   1. MOBILE BOTTOM NAVIGATION
   iOS/Android style bottom tab bar
   ---------------------------------------- */

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: white;
  border-top: 1px solid var(--gray-200);
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }

  /* Adjust main content to account for bottom nav */
  .main-content {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0));
  }

  /* Hide sidebar on mobile by default */
  .sidebar {
    transform: translateX(-100%);
  }

  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Sidebar overlay */
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-base) var(--ease-out);
    backdrop-filter: blur(2px);
  }

  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  height: 100%;
  text-decoration: none;
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item svg,
.mobile-nav-item i {
  width: 22px;
  height: 22px;
  transition: transform var(--duration-fast) var(--ease-out);
}

.mobile-nav-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-nav-item:active {
  background: var(--gray-100);
}

.mobile-nav-item:active svg,
.mobile-nav-item:active i {
  transform: scale(0.9);
}

.mobile-nav-item.active {
  color: var(--primary-600);
}

.mobile-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 3px;
  background: var(--primary-500);
  border-radius: 0 0 3px 3px;
}

.mobile-nav-item.active svg,
.mobile-nav-item.active i {
  color: var(--primary-600);
}

/* More button specific styling */
.mobile-nav-more {
  color: var(--gray-500);
}

/* Notification badge on mobile nav */
.mobile-nav-item .nav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 16px);
  min-width: 18px;
  height: 18px;
  background: var(--danger-500);
  color: white;
  font-size: 10px;
  font-weight: 600;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ----------------------------------------
   2. PULL TO REFRESH
   ---------------------------------------- */

.pull-to-refresh {
  position: relative;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.pull-to-refresh-indicator {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  background: white;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--duration-base) var(--ease-out);
  z-index: 10;
}

.pull-to-refresh-indicator svg {
  width: 18px;
  height: 18px;
  color: var(--primary-500);
  transition: transform var(--duration-base) var(--ease-out);
}

.pull-to-refresh.pulling .pull-to-refresh-indicator {
  transform: translateX(-50%) translateY(60px);
}

.pull-to-refresh.refreshing .pull-to-refresh-indicator {
  transform: translateX(-50%) translateY(60px);
}

.pull-to-refresh.refreshing .pull-to-refresh-indicator svg {
  animation: ptr-spin 0.8s linear infinite;
}

@keyframes ptr-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ----------------------------------------
   3. MOBILE-OPTIMIZED FORMS
   ---------------------------------------- */

@media (max-width: 768px) {
  /* Full-width form groups on mobile */
  .form-row {
    flex-direction: column;
    gap: var(--spacing-4);
  }

  .form-row > .form-group {
    width: 100%;
  }

  /* Larger form inputs on mobile */
  .form-control,
  .form-select,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="date"],
  input[type="time"],
  select,
  textarea {
    font-size: 16px !important; /* Prevents iOS zoom */
    padding: 14px 16px;
    min-height: 52px;
  }

  /* Better spacing for form labels */
  .form-label {
    font-size: var(--text-sm);
    margin-bottom: var(--spacing-2);
  }

  /* Stack form buttons on mobile */
  .form-actions,
  .modal-footer {
    flex-direction: column-reverse;
    gap: var(--spacing-3);
  }

  .form-actions .btn,
  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }

  /* Better checkbox/radio layout */
  .form-check {
    padding: var(--spacing-3) 0;
  }

  .form-check-input {
    width: 24px;
    height: 24px;
  }
}

/* ----------------------------------------
   4. MOBILE MODAL IMPROVEMENTS
   ---------------------------------------- */

@media (max-width: 768px) {
  /* Full-screen modals on mobile */
  .modal {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .modal-backdrop {
    padding: 0;
  }

  .modal-backdrop.active .modal {
    transform: translateY(0);
  }

  /* Slide up animation for mobile modals */
  .modal {
    transform: translateY(100%);
    transition: transform var(--duration-slow) var(--ease-out);
  }

  .modal-header {
    padding: var(--spacing-4);
    flex-shrink: 0;
    background: white;
    z-index: 10;
    border-bottom: 1px solid var(--gray-200);
  }

  .modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: var(--spacing-4);
    padding-bottom: calc(var(--spacing-4) + env(safe-area-inset-bottom, 0));
  }

  .modal-footer {
    flex-shrink: 0;
    background: white;
    padding: var(--spacing-4);
    padding-bottom: calc(var(--spacing-4) + env(safe-area-inset-bottom, 0));
    border-top: 1px solid var(--gray-200);
  }

  /* Sheet-style modal option */
  .modal-sheet {
    height: auto;
    max-height: 90vh;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    margin-top: auto;
  }

  .modal-sheet .modal-header::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
    margin: 0 auto var(--spacing-4);
  }
}

/* ----------------------------------------
   5. MOBILE TABLE IMPROVEMENTS
   ---------------------------------------- */

@media (max-width: 768px) {
  /* Card-style table rows on mobile */
  .table-mobile-cards {
    display: block;
  }

  .table-mobile-cards thead {
    display: none;
  }

  .table-mobile-cards tbody {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
  }

  .table-mobile-cards tr {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--spacing-4);
    box-shadow: var(--shadow-sm);
  }

  .table-mobile-cards td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-2) 0;
    border: none;
  }

  .table-mobile-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--gray-600);
    font-size: var(--text-sm);
  }

  .table-mobile-cards td:last-child {
    border-top: 1px solid var(--gray-100);
    margin-top: var(--spacing-2);
    padding-top: var(--spacing-3);
  }
}

/* ----------------------------------------
   6. MOBILE HEADER IMPROVEMENTS
   ---------------------------------------- */

@media (max-width: 768px) {
  .topbar {
    padding: var(--spacing-3) var(--spacing-4);
    position: sticky;
    top: 0;
    z-index: 50;
    background: white;
  }

  .page-title {
    font-size: var(--text-lg);
  }

  /* Hide search on mobile header */
  .topbar .search-box {
    display: none;
  }

  /* Show mobile menu button */
  #menuToggle {
    display: flex !important;
  }

  /* Clinic header hidden on mobile */
  .clinic-header {
    display: none;
  }
}

/* ----------------------------------------
   8. TOUCH FEEDBACK IMPROVEMENTS
   ---------------------------------------- */

.touch-ripple {
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.touch-ripple::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.1) 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition: transform 0.3s, opacity 0.5s;
}

.touch-ripple:active::after {
  transform: scale(0, 0);
  opacity: 0.3;
  transition: 0s;
}

.list-item-touch {
  transition: background-color var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.list-item-touch:active {
  background-color: var(--gray-100);
}

/* ----------------------------------------
   9. SAFE AREA INSETS
   For notched phones (iPhone X+)
   ---------------------------------------- */

@supports (padding: max(0px)) {
  .mobile-bottom-nav {
    padding-bottom: max(0px, env(safe-area-inset-bottom));
    height: calc(64px + max(0px, env(safe-area-inset-bottom)));
  }

  @media (max-width: 768px) {
    .main-content {
      padding-left: max(var(--spacing-4), env(safe-area-inset-left));
      padding-right: max(var(--spacing-4), env(safe-area-inset-right));
    }
  }
}

/* ----------------------------------------
   10. LANDSCAPE MOBILE ADJUSTMENTS
   ---------------------------------------- */

@media (max-width: 768px) and (orientation: landscape) {
  .mobile-bottom-nav {
    height: 52px;
  }

  .mobile-nav-item {
    flex-direction: row;
    gap: 8px;
  }

  .mobile-nav-item svg {
    width: 18px;
    height: 18px;
  }

  .mobile-nav-item span {
    font-size: 12px;
  }
}
