﻿/* ==========================================================================
   MicroQuantum Clinical Design System (v2.7.0)
   Ultra-Comfortable Midnight Dark Mode • Surgical Light Mode
   Hidden Scrollbars • Pure Vector SVG Icons • Smooth 14px Rounded Corners
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  
  /* Modern Clinical Theme - Light Mode */
  --bg-main: #f4f7fb;
  --bg-card: #ffffff;
  --bg-sidebar: #060a12;
  --sidebar-text: #94a3b8;
  --sidebar-hover: #111827;
  --sidebar-active: #0ea5e9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --primary-light: #e0f2fe;
  
  --teal: #0d9488;
  --teal-light: #ccfbf1;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --indigo: #6366f1;
  --indigo-light: #e0e7ff;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  
  --border: #e2e8f0;
  --border-focus: #0ea5e9;
  
  --radius-sm: 6px;
  --radius-md: 9px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  
  --sidebar-width: 260px;
  --header-height: 64px;
  --mobile-nav-height: 64px;
}

/* Midnight Ergonomic Dark Mode */
[data-theme="dark"] {
  --bg-main: #0b0f19;
  --bg-card: #141d2d;
  --bg-sidebar: #080c14;
  --sidebar-text: #94a3b8;
  --sidebar-hover: #1b263b;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-light: rgba(56, 189, 248, 0.12);
  
  --teal: #2dd4bf;
  --teal-light: rgba(45, 212, 191, 0.12);
  --success: #34d399;
  --success-light: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --warning-light: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-light: rgba(248, 113, 113, 0.12);
  --indigo: #818cf8;
  --indigo-light: rgba(129, 140, 248, 0.12);
  
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: #38bdf8;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Top Progress Bar */
#topProgressBar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--primary));
  width: 0%;
  z-index: 9999;
  transition: width 0.3s ease, opacity 0.3s ease;
}

.icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  transition: transform 0.15s ease, stroke 0.15s ease;
}

a { color: var(--primary); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--primary-hover); }

/* Layout Structure */
.app-container { display: flex; min-height: 100vh; width: 100%; }

/* Sidebar (Hidden Scrollbars, Clean Transparent Logo) */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  
  /* Completely Hide Scrollbar while allowing smooth mouse wheel / touch scroll */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.app-sidebar::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.sidebar-header {
  height: 72px;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-clinic-logo {
  max-height: 42px;
  max-width: 130px;
  width: auto;
  height: auto;
  object-fit: contain;
  background: transparent;
  border: none;
  box-shadow: none;
  flex-shrink: 0;
}

.sidebar-clinic-placeholder {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--teal), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-clinic-info { line-height: 1.2; overflow: hidden; }
.sidebar-clinic-name { font-size: 0.925rem; font-weight: 700; color: #ffffff; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.sidebar-clinic-sub { font-size: 0.72rem; color: #94a3b8; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

.sidebar-nav { padding: 1rem 0.75rem; flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }

.nav-section-title {
  font-size: 0.675rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  font-weight: 700;
  padding: 0.75rem 0.75rem 0.35rem 0.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  color: var(--sidebar-text);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-item:hover { background-color: var(--sidebar-hover); color: #ffffff; }
.nav-item:hover .icon { transform: translateX(2px); }

.nav-item.active {
  background-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-user { display: flex; align-items: center; gap: 0.75rem; overflow: hidden; }
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background-color: var(--teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.user-info { line-height: 1.2; overflow: hidden; }
.user-name { font-size: 0.85rem; font-weight: 600; color: #ffffff; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.user-role { font-size: 0.72rem; color: #94a3b8; text-transform: capitalize; }
.sidebar-brand-bottom { font-size: 0.685rem; color: #475569; text-align: center; }

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header */
.app-header {
  height: var(--header-height);
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-left { display: flex; align-items: center; gap: 1rem; }
.menu-toggle-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 0.4rem;
  cursor: pointer;
  border-radius: var(--radius-md);
}

.header-search { position: relative; width: 280px; }
.header-search input {
  width: 100%;
  padding: 0.45rem 0.85rem 0.45rem 2.2rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background-color: var(--bg-main);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.15s ease;
}
.header-search input:focus {
  border-color: var(--primary);
  background-color: var(--bg-card);
  box-shadow: 0 0 0 3px var(--primary-light);
  width: 320px;
}
.header-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

.header-right { display: flex; align-items: center; gap: 0.85rem; }

.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.theme-toggle-btn:hover { background-color: var(--bg-main); color: var(--text-main); }

/* Page Content */
.page-content { padding: 1.75rem; flex: 1; animation: fadeIn 0.2s ease-out; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-title { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-main); }
.page-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.15rem; }
.page-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.card-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--text-main); }
.card-body { padding: 1.5rem; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-content { display: flex; flex-direction: column; }
.stat-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.35rem; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text-main); letter-spacing: -0.03em; line-height: 1.1; }
.stat-meta { font-size: 0.75rem; margin-top: 0.35rem; color: var(--text-muted); }
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue { background-color: var(--primary-light); color: var(--primary); }
.stat-icon.teal { background-color: var(--teal-light); color: var(--teal); }
.stat-icon.green { background-color: var(--success-light); color: var(--success); }
.stat-icon.amber { background-color: var(--warning-light); color: var(--warning); }
.stat-icon.rose { background-color: var(--danger-light); color: var(--danger); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.25;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background-color: var(--primary); color: #ffffff; box-shadow: 0 2px 4px rgba(14, 165, 233, 0.25); }
.btn-primary:hover { background-color: var(--primary-hover); color: #ffffff; }

.btn-success { background-color: var(--success); color: #ffffff; }
.btn-success:hover { background-color: #059669; color: #ffffff; }

.btn-outline { background-color: var(--bg-card); border-color: var(--border); color: var(--text-main); }
.btn-outline:hover { background-color: var(--bg-main); border-color: #cbd5e1; color: var(--text-main); }

.btn-ghost { background-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background-color: rgba(0, 0, 0, 0.05); color: var(--text-main); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.785rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.95rem; border-radius: var(--radius-lg); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.65rem; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 600; line-height: 1; }
.badge-blue { background-color: var(--primary-light); color: var(--primary); }
.badge-emerald { background-color: var(--success-light); color: var(--success); }
.badge-amber { background-color: var(--warning-light); color: var(--warning); }
.badge-rose { background-color: var(--danger-light); color: var(--danger); }
.badge-teal { background-color: var(--teal-light); color: var(--teal); }
.badge-indigo { background-color: var(--indigo-light); color: var(--indigo); }
.badge-purple { background-color: var(--purple-light); color: var(--purple); }
.badge-slate { background-color: rgba(100, 116, 139, 0.12); color: #94a3b8; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-main); margin-bottom: 0.4rem; }
.form-label .required { color: var(--danger); }
.form-control, .form-select, textarea {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-size: 0.875rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  color: var(--text-main);
  outline: none;
  transition: all 0.15s ease;
}
.form-control:focus, .form-select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }

/* Tables */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.875rem; }
.table th {
  background-color: var(--bg-main);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-main);
}
.table tbody tr:hover { background-color: rgba(255, 255, 255, 0.02); }

/* Tabs */
.tabs-nav { display: flex; gap: 0.5rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; }
.tab-btn {
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.2s ease-in-out; }

/* Animated Toast Alerts */
.toast-container { position: fixed; top: 1.25rem; right: 1.25rem; z-index: 1000; display: flex; flex-direction: column; gap: 0.5rem; max-width: 380px; }
.alert {
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1rem;
  animation: slideInRight 0.25s ease-out;
}
.alert-success { background-color: var(--success-light); border: 1px solid var(--success); color: var(--success); }
.alert-error { background-color: var(--danger-light); border: 1px solid var(--danger); color: var(--danger); }
.alert-warning { background-color: var(--warning-light); border: 1px solid var(--warning); color: var(--warning); }
.alert-info { background-color: var(--primary-light); border: 1px solid var(--primary); color: var(--primary); }

/* Progress Gauge Bar */
.progress-bar-container { background: var(--border); border-radius: var(--radius-full); height: 8px; overflow: hidden; width: 100%; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--teal), var(--primary)); border-radius: var(--radius-full); transition: width 0.4s ease; }

/* Timeline */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before { content: ""; position: absolute; top: 0; bottom: 0; left: 6px; width: 2px; background-color: var(--border); }
.timeline-item { position: relative; margin-bottom: 1.5rem; }
.timeline-dot { position: absolute; left: -1.5rem; top: 4px; width: 14px; height: 14px; border-radius: var(--radius-full); background-color: var(--primary); border: 3px solid var(--bg-card); box-shadow: 0 0 0 1px var(--border); }

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background-color: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 45;
  justify-content: space-around;
  align-items: center;
  padding: 0 0.5rem;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.04);
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.685rem;
  font-weight: 600;
  gap: 0.25rem;
  flex: 1;
  height: 100%;
}
.mobile-nav-item.active { color: var(--primary); }

/* Auth Page Layouts */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, #0f172a 0%, #060a12 100%);
  padding: 1.5rem;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* Responsive */
@media (max-width: 768px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; padding-bottom: calc(var(--mobile-nav-height) + 1rem); }
  .menu-toggle-btn { display: block; }
  .header-search { display: none; }
  .mobile-bottom-nav { display: flex; }
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .page-content { padding: 1rem; }
}
