/* ============================================
   CLINIC MANAGEMENT SYSTEM — DESIGN SYSTEM
   ============================================ */

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

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Background & Surface */
  --bg-primary: #0a0f1e;
  --bg-secondary: #111827;
  --bg-surface: rgba(17, 24, 39, 0.6);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-active: rgba(255, 255, 255, 0.15);

  /* Primary — Professional Blue */
  --primary: #2563eb;
  --primary-light: #60a5fa;
  --primary-dark: #1d4ed8;
  --primary-bg: rgba(37, 99, 235, 0.1);
  --primary-bg-hover: rgba(37, 99, 235, 0.18);
  --primary-border: rgba(37, 99, 235, 0.3);

  /* Secondary — Cyan */
  --secondary: #06b6d4;
  --secondary-light: #22d3ee;
  --secondary-bg: rgba(6, 182, 212, 0.1);
  --secondary-border: rgba(6, 182, 212, 0.3);

  /* Accent — Amber */
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.1);
  --amber-border: rgba(245, 158, 11, 0.3);

  /* Danger — Rose */
  --rose: #f43f5e;
  --rose-bg: rgba(244, 63, 94, 0.1);
  --rose-border: rgba(244, 63, 94, 0.3);

  /* Purple */
  --purple: #a855f7;
  --purple-bg: rgba(168, 85, 247, 0.1);
  --purple-border: rgba(168, 85, 247, 0.3);

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  /* Misc */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(37, 99, 235, 0.15);
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --sidebar-width: 260px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient background gradient */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 20% 50%, rgba(37, 99, 235, 0.07) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(6, 182, 212, 0.05) 0%, transparent 50%),
              radial-gradient(ellipse at 60% 80%, rgba(99, 102, 241, 0.04) 0%, transparent 50%);
  z-index: 0;
  pointer-events: none;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-glass-active); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.relative { position: relative; }

/* ---------- LOGIN / ROLE SELECT ---------- */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  padding: 2rem;
}

.login-container {
  text-align: center;
  max-width: 900px;
  width: 100%;
  animation: fadeInUp 0.6s var(--transition-slow);
}

.login-logo {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 20px rgba(37, 99, 235, 0.4));
}

.login-title {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.login-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* ---------- Clinic Type Selector ---------- */
.clinic-type-selector {
  margin-bottom: 2.5rem;
}

.clinic-type-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.clinic-type-grid {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.clinic-type-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.3rem;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
}

.clinic-type-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-active);
}

.clinic-type-card.selected {
  background: var(--primary-bg);
  border-color: var(--primary);
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.2);
}

.clinic-type-icon {
  font-size: 1.2rem;
}

.clinic-type-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.clinic-type-card.selected .clinic-type-name {
  color: var(--primary-light);
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.role-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2.2rem 1.5rem;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.role-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.role-card[data-role="client"]::before  { background: var(--secondary); }
.role-card[data-role="nurse"]::before   { background: var(--primary); }
.role-card[data-role="doctor"]::before  { background: var(--purple); }
.role-card[data-role="pharmacy"]::before { background: var(--amber); }

.role-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-active);
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.role-card:hover::before { opacity: 1; }

.role-card .role-icon {
  font-size: 2.8rem;
  margin-bottom: 1rem;
  display: block;
}

.role-card .role-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.role-card .role-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---------- APP LAYOUT ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-glass);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.sidebar-brand-icon {
  font-size: 1.8rem;
  filter: drop-shadow(0 0 10px rgba(37, 99, 235, 0.3));
}

.sidebar-brand-text {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.sidebar-brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
  font-weight: 400;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.4rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 2px;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--primary-bg);
  color: var(--primary-light);
  font-weight: 600;
}

.nav-item .nav-icon {
  font-size: 1.15rem;
  width: 1.4rem;
  text-align: center;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--rose);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  min-width: 1.2rem;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border-glass);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sidebar-user:hover { background: var(--bg-glass-hover); }

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-avatar.nurse   { background: var(--primary-bg); color: var(--primary-light); border: 1px solid var(--primary-border); }
.sidebar-user-avatar.client  { background: var(--secondary-bg); color: var(--secondary-light); border: 1px solid var(--secondary-border); }
.sidebar-user-avatar.doctor  { background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-border); }
.sidebar-user-avatar.pharmacy { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }

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

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-logout:hover { color: var(--rose); background: var(--rose-bg); }

/* ---------- MAIN CONTENT ---------- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 2rem;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.top-bar-title {
  font-size: 1.35rem;
  font-weight: 700;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  transition: border-color var(--transition-fast);
}

.search-box:focus-within { border-color: var(--primary-border); }

.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  width: 200px;
}

.search-box input::placeholder { color: var(--text-muted); }

.top-bar-date {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.page-content {
  flex: 1;
  padding: 2rem;
  animation: fadeIn 0.3s ease;
}

/* ---------- STAT CARDS / KPIs ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

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

.stat-card .stat-icon {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-card .stat-change {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.stat-change.positive { background: var(--primary-bg); color: var(--primary-light); }
.stat-change.negative { background: var(--rose-bg); color: var(--rose); }

/* ---------- TABLES ---------- */
.data-table-wrapper {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-glass);
}

.table-title {
  font-size: 1rem;
  font-weight: 700;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 0.85rem 1.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-glass);
  white-space: nowrap;
}

.data-table td {
  padding: 1rem 1.5rem;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.data-table tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-glass-hover);
}

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

.patient-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.patient-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary-bg);
  border: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-light);
  flex-shrink: 0;
}

.patient-name {
  font-weight: 600;
  font-size: 0.88rem;
}

.patient-id {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ---------- BADGES / STATUS ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-confirmed { background: var(--primary-bg); color: var(--primary-light); border: 1px solid var(--primary-border); }
.badge-pending   { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.badge-cancelled { background: var(--rose-bg); color: var(--rose); border: 1px solid var(--rose-border); }
.badge-completed { background: var(--secondary-bg); color: var(--secondary-light); border: 1px solid var(--secondary-border); }
.badge-checked-in { background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-border); }
.badge-dispensed { background: var(--primary-bg); color: var(--primary-light); border: 1px solid var(--primary-border); }
.badge-in-progress { background: var(--secondary-bg); color: var(--secondary-light); border: 1px solid var(--secondary-border); }
.badge-paid      { background: var(--primary-bg); color: var(--primary-light); border: 1px solid var(--primary-border); }
.badge-unpaid    { background: var(--rose-bg); color: var(--rose); border: 1px solid var(--rose-border); }
.badge-insurance { background: var(--secondary-bg); color: var(--secondary-light); border: 1px solid var(--secondary-border); }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border-color: var(--border-glass-active);
}

.btn-secondary:hover {
  background: var(--bg-glass-hover);
  border-color: var(--text-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0.5rem 0.8rem;
}

.btn-ghost:hover { color: var(--text-primary); background: var(--bg-glass); }

.btn-danger {
  background: var(--rose-bg);
  color: var(--rose);
  border-color: var(--rose-border);
}

.btn-danger:hover {
  background: var(--rose);
  color: white;
}

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

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

/* ---------- CARDS ---------- */
.card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--border-glass-active);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
}

/* ---------- FORMS ---------- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary-border);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2.2rem;
}

.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ---------- MODAL ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass-active);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s var(--transition-slow);
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close:hover { color: var(--text-primary); background: var(--bg-glass); }

.modal-body { padding: 1.5rem; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-glass);
}

/* ---------- TOAST ---------- */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass-active);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 500;
  animation: slideInRight 0.35s var(--transition-slow);
  min-width: 280px;
}

.toast.success { border-left: 3px solid var(--primary); }
.toast.error   { border-left: 3px solid var(--rose); }
.toast.warning { border-left: 3px solid var(--amber); }
.toast.info    { border-left: 3px solid var(--secondary); }

.toast-exit {
  animation: slideOutRight 0.3s ease forwards;
}

/* ---------- APPOINTMENT SLOTS (Client Booking) ---------- */
.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}

.slot-btn {
  padding: 0.85rem;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  color: var(--text-primary);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.slot-btn:hover {
  border-color: var(--primary-border);
  background: var(--primary-bg);
}

.slot-btn.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.slot-btn.unavailable {
  opacity: 0.3;
  pointer-events: none;
}

.slot-time {
  font-weight: 700;
  font-size: 0.95rem;
}

.slot-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* ---------- PRESCRIPTION CARD ---------- */
.rx-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-fast);
}

.rx-card:hover { border-color: var(--border-glass-active); }

.rx-info { flex: 1; }

.rx-drug {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.rx-details {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.rx-patient {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ---------- INVENTORY ITEM ---------- */
.inventory-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: all var(--transition-fast);
}

.inventory-card:hover { border-color: var(--border-glass-active); }

.inventory-name {
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.5rem;
}

.inventory-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.inventory-bar {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.inventory-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

.inventory-bar-fill.high { background: var(--primary); }
.inventory-bar-fill.medium { background: var(--amber); }
.inventory-bar-fill.low { background: var(--rose); }

/* ---------- SECTION GRID ---------- */
.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

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

.section-full { grid-column: 1 / -1; }

/* ---------- PAYMENT FORM ---------- */
.payment-methods {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.payment-method {
  flex: 1;
  padding: 1rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  color: var(--text-primary);
}

.payment-method:hover { border-color: var(--border-glass-active); }

.payment-method.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.payment-method .pm-icon { font-size: 1.5rem; margin-bottom: 0.3rem; }
.payment-method .pm-label { font-size: 0.78rem; font-weight: 600; }

/* ---------- QUEUE CARDS (Doctor) ---------- */
.queue-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.queue-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.queue-card:hover {
  border-color: var(--border-glass-active);
  background: var(--bg-glass-hover);
}

.queue-number {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.88rem;
  background: var(--primary-bg);
  color: var(--primary-light);
  border: 1px solid var(--primary-border);
  flex-shrink: 0;
}

.queue-info { flex: 1; }

.queue-name {
  font-weight: 700;
  font-size: 0.92rem;
}

.queue-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.queue-actions {
  display: flex;
  gap: 0.5rem;
}

/* ---------- DOCTOR CONSULTATION VIEW ---------- */
.consult-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.consult-layout .card { height: fit-content; }

.patient-vitals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.vital-item {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
}

.vital-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-light);
}

.vital-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ---------- MEDICATION ITEM (Prescription builder) ---------- */
.med-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.med-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
}

.med-item-info { flex: 1; }

.med-item-name {
  font-weight: 700;
  font-size: 0.88rem;
}

.med-item-dosage {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.med-remove {
  background: none;
  border: none;
  color: var(--rose);
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.med-remove:hover { opacity: 1; }

/* ---------- EMPTY STATE ---------- */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

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

.empty-state .empty-text {
  font-size: 0.92rem;
  font-weight: 500;
}

.empty-state .empty-sub {
  font-size: 0.78rem;
  margin-top: 0.3rem;
}

/* ---------- TAB PILLS ---------- */
.tab-pills {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  padding: 0.25rem;
  width: fit-content;
}

.tab-pill {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: none;
  border: none;
  font-family: inherit;
}

.tab-pill:hover { color: var(--text-primary); }

.tab-pill.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* ---------- PROGRESS STEPS ---------- */
.booking-steps {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 2rem;
}

.booking-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--bg-glass);
  border: 2px solid var(--border-glass);
  color: var(--text-muted);
  transition: all var(--transition-base);
}

.booking-step.active .step-circle,
.booking-step.completed .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.booking-step.completed .step-circle {
  background: var(--primary-dark);
}

.step-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.booking-step.active .step-label { color: var(--text-primary); }
.booking-step.completed .step-label { color: var(--primary-light); }

.step-connector {
  width: 50px;
  height: 2px;
  background: var(--border-glass);
  margin: 0 0.5rem;
  align-self: center;
}

.booking-step.completed + .step-connector,
.step-connector.completed {
  background: var(--primary);
}

/* ---------- TODAY SCHEDULE (Sidebar list) ---------- */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
}

.schedule-time {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary-light);
  min-width: 52px;
}

.schedule-patient {
  font-size: 0.85rem;
  font-weight: 600;
}

.schedule-type {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ---------- AMOUNT DISPLAY ---------- */
.amount-display {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  padding: 1.5rem;
  background: var(--primary-bg);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  color: var(--primary-light);
  margin-bottom: 1.5rem;
}

.amount-display .currency { font-size: 1rem; opacity: 0.7; }

/* ---------- FILTER BAR ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  font-family: inherit;
}

.filter-chip:hover { border-color: var(--border-glass-active); color: var(--text-primary); }

.filter-chip.active {
  background: var(--primary-bg);
  border-color: var(--primary-border);
  color: var(--primary-light);
}

/* ---------- ANIMATIONS ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(80px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(80px); }
}

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

.animate-in {
  animation: fadeInUp 0.4s var(--transition-slow) both;
}

.animate-in:nth-child(2) { animation-delay: 0.05s; }
.animate-in:nth-child(3) { animation-delay: 0.1s; }
.animate-in:nth-child(4) { animation-delay: 0.15s; }
.animate-in:nth-child(5) { animation-delay: 0.2s; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1024px) {
  .section-grid { grid-template-columns: 1fr; }
  .consult-layout { grid-template-columns: 1fr; }
  .section-grid.cols-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

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

  .top-bar { padding: 1rem; }

  .page-content { padding: 1rem; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .form-row { grid-template-columns: 1fr; }

  .role-grid { grid-template-columns: repeat(2, 1fr); }

  .section-grid.cols-3 { grid-template-columns: 1fr; }

  .payment-methods { flex-direction: column; }

  .patient-vitals { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .role-grid { grid-template-columns: 1fr; }
  .slots-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==================== AI CHATBOT WIDGET ==================== */

.chatbot-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4), 0 0 40px rgba(37, 99, 235, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: all var(--transition-base);
  animation: chatbotPulse 2s infinite;
}

@keyframes chatbotPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4); }
  50% { box-shadow: 0 4px 30px rgba(37, 99, 235, 0.6), 0 0 60px rgba(37, 99, 235, 0.2); }
}

.chatbot-fab:hover {
  transform: scale(1.1);
}

.chatbot-fab-icon {
  font-size: 1.6rem;
}

.chatbot-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--rose);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1001;
  animation: chatbotSlideUp 0.3s ease;
}

@keyframes chatbotSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chatbot-window {
  width: 400px;
  height: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 40px rgba(37, 99, 235, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.chatbot-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chatbot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.chatbot-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: #fff;
}

.chatbot-status {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
}

.chatbot-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: rgba(255,255,255,0.8);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.chatbot-close:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-msg {
  display: flex;
  gap: 0.5rem;
  max-width: 88%;
  animation: chatMsgIn 0.3s ease;
}

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

.chat-msg.bot {
  align-self: flex-start;
}

.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-bg);
  border: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.chat-msg.user .chat-msg-avatar {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-active);
}

.chat-msg-bubble {
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  line-height: 1.55;
}

.chat-msg.bot .chat-msg-bubble {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  border-top-left-radius: 4px;
}

.chat-msg.user .chat-msg-bubble {
  background: var(--primary);
  color: #fff;
  border-top-right-radius: 4px;
}

.chat-typing {
  display: flex;
  gap: 4px;
  padding: 0.2rem 0;
}

.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: chatTyping 1.2s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatTyping {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.chatbot-quick {
  padding: 0 1rem 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chatbot-quick-btn {
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--primary-light);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.chatbot-quick-btn:hover {
  background: var(--primary-bg);
  border-color: var(--primary-border);
}

.chatbot-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-glass);
  background: var(--bg-glass);
}

.chatbot-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  padding: 0.55rem 1rem;
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
  transition: border-color var(--transition-base);
}

.chatbot-input:focus {
  border-color: var(--primary);
}

.chatbot-input::placeholder {
  color: var(--text-muted);
}

.chatbot-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.chatbot-send:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

/* ==================== PASSWORD PROTECTION GATE ==================== */
.site-gate {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 99999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: gateIn 0.5s ease;
}
@keyframes gateIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.gate-card {
  text-align: center;
  padding: 3rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
  max-width: 400px;
  width: 90%;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5);
}
.gate-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.gate-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}
.gate-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.gate-input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.gate-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.gate-input:focus {
  border-color: var(--primary);
}
.gate-input::placeholder {
  color: var(--text-muted);
}
.gate-btn {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--primary);
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.gate-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}
.gate-error {
  color: #ff6b6b;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.gate-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

/* ==================== LANGUAGE SELECTOR ==================== */
.lang-selector {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
}
.lang-btn {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.lang-btn:hover {
  border-color: var(--primary);
  color: var(--text-primary);
}
.lang-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.gate-lang {
  margin-top: 1.25rem;
}
.login-lang {
  margin-bottom: 1rem;
}
