/* ═══════════════════════════════════════════════════════════
   نظام تقارير قسم الأشعة — السرية الطبية
   Main Stylesheet — Premium Medical Dark Theme
   ═══════════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties ──────────────────────────────── */
:root {
  /* Color Palette */
  --bg-primary: #060d19;
  --bg-secondary: #0c1829;
  --bg-tertiary: #111f38;
  --bg-card: rgba(17, 31, 56, 0.65);
  --bg-card-hover: rgba(22, 40, 72, 0.8);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-hover: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(0, 180, 216, 0.3);
  
  /* Accent Colors */
  --accent-primary: #00B4D8;
  --accent-secondary: #0077B6;
  --accent-light: #48CAE4;
  --accent-glow: rgba(0, 180, 216, 0.15);
  --accent-gradient: linear-gradient(135deg, #00B4D8, #0077B6);
  --accent-gradient-hover: linear-gradient(135deg, #48CAE4, #00B4D8);
  
  /* Text Colors */
  --text-primary: #E8EDF5;
  --text-secondary: #8899B0;
  --text-muted: #5A6B82;
  --text-accent: #48CAE4;
  
  /* Status Colors */
  --success: #00C897;
  --warning: #FFB74D;
  --error: #EF5350;
  --info: #29B6F6;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px var(--accent-glow);
  --shadow-glow-strong: 0 0 50px rgba(0, 180, 216, 0.25);
  
  /* Typography */
  --font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.85rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.15rem;
  --font-size-xl: 1.35rem;
  --font-size-2xl: 1.75rem;
  --font-size-3xl: 2.25rem;
  
  /* Spacing */
  --space-xs: 0.35rem;
  --space-sm: 0.625rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 50%;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
  
  /* Layout */
  --navbar-height: 64px;
  --toolbar-height: 56px;
  --max-width: 1400px;
}

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

html {
  direction: rtl;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse at 20% 50%, rgba(0, 119, 182, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0, 180, 216, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(72, 202, 228, 0.04) 0%, transparent 50%);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-light);
}

::selection {
  background: rgba(0, 180, 216, 0.3);
  color: var(--text-primary);
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ─── Navbar ─────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: var(--navbar-height);
  background: rgba(6, 13, 25, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.navbar-content {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

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

.navbar-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.navbar-titles {
  display: flex;
  flex-direction: column;
}

.navbar-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.navbar-subtitle {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  font-weight: 400;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ─── Main Content ───────────────────────────────────────── */
.main-content {
  margin-top: var(--navbar-height);
  min-height: calc(100vh - var(--navbar-height));
  position: relative;
}

.view {
  padding: var(--space-xl) var(--space-xl) var(--space-2xl);
  max-width: var(--max-width);
  margin: 0 auto;
  animation: fadeInView 0.5s ease;
}

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

/* ─── Loading Screen ─────────────────────────────────────── */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--navbar-height));
  gap: var(--space-xl);
}

.loading-spinner {
  position: relative;
  width: 60px;
  height: 60px;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border: 3px solid transparent;
  border-radius: var(--radius-full);
  animation: spinRing 1.5s linear infinite;
}

.spinner-ring:nth-child(1) {
  border-top-color: var(--accent-primary);
  animation-delay: 0s;
}

.spinner-ring:nth-child(2) {
  inset: 6px;
  border-right-color: var(--accent-secondary);
  animation-delay: 0.15s;
  animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
  inset: 12px;
  border-bottom-color: var(--accent-light);
  animation-delay: 0.3s;
}

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

.loading-text {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  letter-spacing: 0.5px;
}

/* ─── Hero Section ───────────────────────────────────────── */
.view-header {
  margin-bottom: var(--space-xl);
}

.hero-section {
  text-align: center;
  padding: var(--space-2xl) 0 var(--space-lg);
}

.hero-icon {
  margin-bottom: var(--space-md);
}

.hero-svg {
  width: 64px;
  height: 64px;
  animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { filter: drop-shadow(0 0 8px var(--accent-glow)); }
  50% { filter: drop-shadow(0 0 20px rgba(0, 180, 216, 0.4)); }
}

.view-title {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.view-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 400;
}

/* ─── Departments Grid ───────────────────────────────────── */
.departments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-xl);
  padding: var(--space-md) 0;
}

/* Department Card */
.department-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-xl);
  cursor: pointer;
  transition: all var(--transition-base);
  overflow: hidden;
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: cardFadeIn 0.6s ease both;
}

.department-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 180, 216, 0.05) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.department-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transition: transform var(--transition-base);
  transform-origin: right;
}

.department-card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow), var(--shadow-lg);
  background: var(--bg-card-hover);
}

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

.department-card:hover::after {
  transform: scaleX(1);
}

.department-card:hover .dept-icon {
  transform: scale(1.1);
  filter: drop-shadow(0 0 12px var(--accent-glow));
}

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

.department-card:nth-child(1) { animation-delay: 0.1s; }
.department-card:nth-child(2) { animation-delay: 0.2s; }
.department-card:nth-child(3) { animation-delay: 0.3s; }
.department-card:nth-child(4) { animation-delay: 0.4s; }
.department-card:nth-child(5) { animation-delay: 0.5s; }
.department-card:nth-child(6) { animation-delay: 0.6s; }

.dept-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(0, 180, 216, 0.12), rgba(0, 119, 182, 0.08));
  border: 1px solid rgba(0, 180, 216, 0.15);
  border-radius: var(--radius-lg);
  font-size: 2rem;
  transition: all var(--transition-base);
  position: relative;
  z-index: 1;
}

.dept-name {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  position: relative;
  z-index: 1;
}

.dept-count {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  background: var(--glass);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  position: relative;
  z-index: 1;
}

.dept-count .count-number {
  color: var(--accent-primary);
  font-weight: 700;
}

/* ─── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
  padding: var(--space-md) 0;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
}

.breadcrumb-item:hover {
  color: var(--accent-primary);
  background: var(--glass);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 600;
  cursor: default;
}

.breadcrumb-item.active:hover {
  background: transparent;
}

.breadcrumb-separator {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  user-select: none;
}

.breadcrumb-separator svg {
  width: 14px;
  height: 14px;
  transform: scaleX(-1); /* RTL flip */
}

/* ─── Search ─────────────────────────────────────────────── */
.search-container {
  margin-bottom: var(--space-lg);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.search-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.1), var(--shadow-glow);
}

.search-icon {
  width: 20px;
  height: 20px;
  margin-right: var(--space-md);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

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

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  padding: var(--space-md) var(--space-lg);
  padding-right: 0;
  direction: rtl;
}

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

.search-count {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  padding: 0 var(--space-md);
  white-space: nowrap;
}

/* ─── Templates Grid ─────────────────────────────────────── */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-lg);
}

/* Category/Folder Card */
.category-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: cardFadeIn 0.4s ease both;
  position: relative;
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.category-card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow), var(--shadow-md);
  background: var(--bg-card-hover);
}

.category-card:hover::before {
  transform: scaleX(1);
}

.category-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255, 183, 77, 0.12), rgba(255, 152, 0, 0.08));
  border: 1px solid rgba(255, 183, 77, 0.15);
  border-radius: var(--radius-sm);
  font-size: 1.35rem;
  transition: transform var(--transition-base);
}

.category-card:hover .category-icon {
  transform: scale(1.1);
}

.category-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.4;
}

.category-count {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* Template/File Card */
.template-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: cardFadeIn 0.4s ease both;
  position: relative;
  overflow: hidden;
}

.template-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.template-card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow), var(--shadow-md);
  background: var(--bg-card-hover);
}

.template-card:hover::before {
  transform: scaleX(1);
}

.template-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(0, 180, 216, 0.12), rgba(0, 119, 182, 0.08));
  border: 1px solid rgba(0, 180, 216, 0.15);
  border-radius: var(--radius-sm);
  font-size: 1.35rem;
  transition: transform var(--transition-base);
}

.template-card:hover .template-icon {
  transform: scale(1.1);
}

.template-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-ext {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  background: var(--glass);
  padding: 2px var(--space-sm);
  border-radius: var(--radius-sm);
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-2xl) 0;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state-text {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
}

/* ─── Editor Toolbar ─────────────────────────────────────── */
.editor-toolbar {
  position: sticky;
  top: var(--navbar-height);
  z-index: 100;
  background: rgba(12, 24, 41, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: var(--space-sm) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--toolbar-height);
}

.toolbar-right,
.toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--glass-border);
  margin: 0 var(--space-xs);
}

.toolbar-title {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 500;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background var(--transition-fast);
}

.btn:hover::after {
  background: rgba(255, 255, 255, 0.05);
}

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

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 12px rgba(0, 180, 216, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(0, 180, 216, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

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

.btn-nav-blank {
  background: linear-gradient(135deg, rgba(0, 180, 216, 0.1), rgba(0, 119, 182, 0.15));
  color: var(--accent-light);
  border: 1px solid rgba(0, 180, 216, 0.3);
  margin-left: var(--space-md);
}

.btn-nav-blank:hover {
  background: linear-gradient(135deg, rgba(0, 180, 216, 0.2), rgba(0, 119, 182, 0.25));
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(0, 180, 216, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-md);
}

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

.btn-ghost svg {
  transform: scaleX(-1); /* RTL arrow flip for back button */
}

/* ─── Editor Container ───────────────────────────────────── */
.editor-container {
  display: flex;
  height: calc(100vh - var(--navbar-height) - var(--toolbar-height));
  overflow: hidden;
}

.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg-secondary);
  border-left: 1px solid var(--glass-border);
}

.preview-panel {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-tertiary);
  position: relative;
}

/* Resize Handle */
.resize-handle {
  width: 6px;
  background: var(--bg-tertiary);
  border-right: 1px solid var(--glass-border);
  border-left: 1px solid var(--glass-border);
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.resize-handle:hover {
  background: rgba(0, 180, 216, 0.1);
}

.resize-dots {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.resize-dots span {
  width: 3px;
  height: 3px;
  background: var(--text-muted);
  border-radius: var(--radius-full);
}

/* ─── Patient Info Form ──────────────────────────────────── */
.patient-info-form {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.15);
}

.form-title {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.form-title::before {
  content: '';
  width: 3px;
  height: 16px;
  background: var(--accent-gradient);
  border-radius: 2px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-group label {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  font-weight: 500;
}

.form-input {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  direction: rtl;
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.1);
}

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

.form-input[type="date"] {
  cursor: pointer;
}

/* ─── Format Toolbar ─────────────────────────────────────── */
.format-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex-wrap: wrap;
}

.format-toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.format-toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--glass-border);
  margin: 0 var(--space-xs);
  flex-shrink: 0;
}

.format-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 700;
  padding: 0;
}

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

.format-btn:active {
  transform: scale(0.92);
}

.format-btn.active {
  background: rgba(0, 180, 216, 0.15);
  color: var(--accent-primary);
  border-color: rgba(0, 180, 216, 0.3);
  box-shadow: 0 0 8px rgba(0, 180, 216, 0.1);
}

.format-btn svg {
  flex-shrink: 0;
}

.format-btn-label {
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  margin-top: -2px;
}

/* Tooltip for format buttons */
.format-btn::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--glass-border);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 100;
}

.format-btn:hover::after {
  opacity: 1;
}

/* ─── Editor Textarea ────────────────────────────────────── */
.editor-text-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  min-height: 0;
}

.editor-textarea-wrapper {
  flex: 1;
  display: flex;
  min-height: 300px;
}

.editor-textarea {
  flex: 1;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: var(--space-lg);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.8;
  direction: ltr;
  text-align: left;
  resize: none;
  outline: none;
  transition: border-color var(--transition-fast);
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.editor-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.08);
}

/* Placeholder for contenteditable */
.editor-textarea:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
  font-style: italic;
}

/* Styled inline formatting inside the editor */
.editor-textarea b,
.editor-textarea strong {
  font-weight: 700;
  color: var(--accent-light);
}

.editor-textarea u {
  text-decoration-color: var(--accent-primary);
  text-underline-offset: 3px;
}

.editor-textarea i,
.editor-textarea em {
  color: var(--text-accent);
}

.editor-textarea h3 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--accent-primary);
  border-bottom: 1px solid rgba(0, 180, 216, 0.3);
  padding-bottom: 4px;
  margin: 8px 0 4px;
}

.editor-textarea ul,
.editor-textarea ol {
  margin: 4px 0 8px 20px;
  padding: 0;
}

.editor-textarea ul {
  list-style: disc;
}

.editor-textarea ol {
  list-style: decimal;
}

.editor-textarea li {
  margin-bottom: 4px;
  line-height: 1.8;
}

/* disabled state for contenteditable */
.editor-textarea[contenteditable="false"] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ─── Preview Panel ──────────────────────────────────────── */
.preview-label {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(17, 31, 56, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-align: center;
  border-bottom: 1px solid var(--glass-border);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.preview-paper {
  background: white;
  color: #1a1a1a;
  margin: var(--space-xl);
  padding: 0 40px 0 40px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
  min-height: 297mm;
  font-family: var(--font-family);
  direction: ltr;
  text-align: left;
  position: relative;
  font-size: 14px;
  line-height: 1.8;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* ─── Report Styles (Preview & Print) — Professional Design ─ */

/* === Top Banner === */
.report-top-banner {
  position: relative;
  height: 10px;
  margin: 0 -40px 20px -40px;
  background: linear-gradient(
    90deg,
    #6b0010 0%,
    #990010 25%,
    #b81a2e 50%,
    #990010 75%,
    #6b0010 100%
  );
  overflow: hidden;
  flex-shrink: 0;
}

.report-top-banner .banner-pattern {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 30px,
    rgba(255,255,255,0.08) 30px,
    rgba(255,255,255,0.08) 32px
  );
}

/* === Header === */
.report-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 10px 0 12px;
  text-align: center;
  flex-shrink: 0;
}

.report-header-side {
  flex: 1;
  min-width: 0;
}

.report-header-ar {
  text-align: right;
  direction: rtl;
}

.report-header-en {
  text-align: left;
  direction: ltr;
}

.header-org-name-ar {
  font-size: 19px;
  font-weight: 800;
  color: #0A1628;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.header-org-sub-ar {
  font-size: 11px;
  color: #555;
  font-weight: 500;
}

.header-org-name-en {
  font-size: 15px;
  font-weight: 700;
  color: #1a2a40;
  margin-bottom: 2px;
}

.header-org-sub-en {
  font-size: 10px;
  color: #666;
  font-weight: 500;
}

.report-logo-section {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.report-logo {
  width: 90px;
  height: 90px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* === Department Title === */
.report-dept-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 8px;
  flex-shrink: 0;
}

.dept-title-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #990010, transparent);
}

.dept-title-text {
  font-size: 15px;
  font-weight: 700;
  color: #990010;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 0 4px;
}

/* === Professional Divider === */
.report-divider-pro {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  flex-shrink: 0;
}

.report-divider-pro.small {
  margin: 6px 0;
}

.divider-wing {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, transparent, #990010 20%, #cc1a2e 50%, #990010 80%, transparent);
  border-radius: 1px;
}

.report-divider-pro.small .divider-wing {
  height: 1px;
  background: linear-gradient(90deg, transparent, #cc1a2e 30%, #cc1a2e 70%, transparent);
}

.divider-diamond {
  color: #990010;
  font-size: 8px;
  line-height: 1;
  flex-shrink: 0;
}

.report-divider-pro.small .divider-diamond {
  font-size: 6px;
  color: #cc1a2e;
}

/* Keep old divider class for backward compatibility */
.report-divider {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, #990010 15%, #cc1a2e 50%, #990010 85%, transparent);
  margin: 10px 0;
  border-radius: 1px;
}

/* === Patient Info Table === */
.report-patient-info {
  padding: 8px 0;
  flex-shrink: 0;
  width: 100%;
  display: flex;
  justify-content: center;
}

.patient-info-table {
  width: 88%;
  border-collapse: collapse;
  margin: 6px auto;
  font-size: 13px;
  table-layout: fixed;
  direction: ltr;
}

.patient-info-table td {
  border: 1px solid #d4d4d4;
  padding: 7px 8px;
  vertical-align: middle;
  text-align: center;
}

.patient-info-table .info-label {
  background: linear-gradient(135deg, #f8f0f0 0%, #f0e8e8 100%);
  width: 17%;
  white-space: nowrap;
  font-weight: 700;
  color: #6b0010;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-color: #c9a0a0;
  text-align: center;
}

.patient-info-table .info-value {
  color: #1a1a1a;
  font-weight: 600;
  text-align: center;
  width: 33%;
  font-size: 13px;
  word-break: break-word;
}

.report-info-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 13px;
}

.report-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.info-label {
  font-weight: 700;
  color: #333;
  white-space: nowrap;
  text-align: center;
}

.info-value {
  color: #1a1a1a;
  font-weight: 500;
  text-align: center;
}

/* === Report Body === */
.report-body {
  padding: 14px 6%;
  min-height: 200px;
  line-height: 2;
  font-size: 14px;
  color: #222;
  text-align: left;
  direction: ltr;
}

.report-body p {
  margin-bottom: 8px;
  text-align: left;
}

/* Report body headings */
.report-body .report-heading {
  font-weight: 700;
  margin: 16px 0 6px 0;
  color: #990010;
  font-size: 14.5px;
  border-bottom: 1.5px solid #990010;
  padding-bottom: 2px;
  display: inline-block;
  letter-spacing: 0.5px;
  text-align: left;
}

/* Numbered & bulleted lists in report */
.report-body ol,
.report-body ul {
  display: block;
  text-align: left;
  margin: 6px 0 10px 24px;
  padding: 0;
  list-style-position: outside;
}

.report-body ol li,
.report-body ul li {
  margin-bottom: 4px;
  line-height: 1.8;
}

/* Bold, underline, italic in report body */
.report-body strong,
.report-body b {
  font-weight: 700;
}

.report-body u {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.report-body em,
.report-body i {
  font-style: italic;
}

/* Spacer for empty lines between paragraphs */
.report-body .report-spacer {
  height: 12px;
}

.report-placeholder {
  color: #aaa;
  text-align: center;
  padding: 40px 0;
  font-style: italic;
}

/* === Professional Footer === */
.report-footer {
  margin-top: 20px;
  padding-top: 16px;
  padding-bottom: 0;
  flex-shrink: 0;
}

.report-signature {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 0 8px;
  gap: 20px;
}

.signature-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.signature-label {
  font-size: 11px;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.signature-value {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  min-width: 120px;
  text-align: center;
}

.signature-underline {
  display: block;
  width: 120px;
  height: 1px;
  background: #999;
  margin-top: 30px;
}

.signature-line {
  color: #bbb;
}

/* === Footer Contact Strip === */
.report-footer-strip {
  margin: 12px -40px 0 -40px;
  background: linear-gradient(
    90deg,
    #6b0010 0%,
    #990010 25%,
    #b81a2e 50%,
    #990010 75%,
    #6b0010 100%
  );
  padding: 6px 20px;
  position: relative;
}

.footer-strip-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-strip-item {
  font-size: 10px;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.3px;
  direction: ltr;
}

.footer-strip-sep {
  color: rgba(255,255,255,0.4);
  font-size: 10px;
}


/* === Print Layout Table (Screen defaults) === */
.report-print-layout-table {
  width: 100%;
  border-collapse: collapse;
  border: none;
  margin: 0;
  padding: 0;
}

.report-print-layout-table td {
  padding: 0;
  vertical-align: top;
}

.print-footer-space {
  height: 0; /* Hidden on screen by default, expanded in print.css */
}

/* ─── Print Repeating Footer (hidden on screen) ──────────── */
.print-repeating-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  /* Use clip-path to hide on screen while keeping the element
     fully rendered in the DOM — critical for reliable print rendering.
     height:0 / visibility:hidden can cause browsers to skip it in print. */
  clip-path: inset(100%);
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
  height: 1px;
  width: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
}

/* ─── Toast Notification ─────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-xl);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  white-space: nowrap;
}

.toast.success { border-color: rgba(0, 200, 151, 0.3); }
.toast.error { border-color: rgba(239, 83, 80, 0.3); }
.toast.info { border-color: rgba(0, 180, 216, 0.3); }

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

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

/* ─── Grid Stagger Animation ─────────────────────────────── */
.templates-grid > * {
  --stagger: 0;
  animation-delay: calc(var(--stagger) * 50ms);
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .editor-container {
    flex-direction: column;
    height: auto;
  }
  
  .editor-panel {
    border-left: none;
    border-bottom: 1px solid var(--glass-border);
  }
  
  .resize-handle {
    display: none;
  }
  
  .preview-panel {
    min-height: 600px;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --navbar-height: 56px;
    --font-size-2xl: 1.5rem;
  }
  
  .departments-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .templates-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-md);
  }
  
  .view {
    padding: var(--space-md);
  }
  
  .navbar-content {
    padding: 0 var(--space-md);
  }
  
  .navbar-subtitle {
    display: none;
  }
  
  .preview-paper {
    margin: var(--space-md);
    padding: 0 20px 0 20px;
  }

  .report-top-banner {
    margin: 0 -20px 15px -20px;
  }

  .report-footer-strip {
    margin: 12px -20px 0 -20px;
  }
  
  .report-header {
    flex-direction: column;
    text-align: center;
  }
  
  .report-header-en {
    display: none;
  }
  
  .report-info-grid {
    grid-template-columns: 1fr;
  }
  
  .toolbar-title {
    display: none;
  }
  
  .btn span {
    display: none;
  }
  
  .editor-toolbar {
    padding: var(--space-sm) var(--space-md);
  }
}

@media (max-width: 480px) {
  .templates-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .dept-icon {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }
  
  .department-card {
    padding: var(--space-lg);
  }
}

/* ─── Skeleton Loading ───────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--glass) 25%, var(--glass-hover) 50%, var(--glass) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-card {
  height: 180px;
  border-radius: var(--radius-lg);
}

.skeleton-small {
  height: 140px;
  border-radius: var(--radius-md);
}

/* ─── Upload Screen ──────────────────────────────────────── */
.upload-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--navbar-height) - 4rem);
  padding: var(--space-xl);
}

.upload-hero {
  text-align: center;
  margin-bottom: var(--space-2xl);
  animation: fadeInView 0.6s ease;
}

.upload-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  margin-bottom: var(--space-lg);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
  animation: pulseGlow 3s ease-in-out infinite;
}

.upload-title {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-xs);
}

.upload-sub {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.upload-box {
  background: var(--bg-card);
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-2xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  max-width: 500px;
  width: 100%;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeInView 0.8s ease;
}

.upload-box:hover,
.upload-box.drag-over {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-glow-strong);
  transform: translateY(-2px);
}

.upload-box.drag-over {
  border-style: solid;
  background: rgba(0, 180, 216, 0.08);
}

.upload-icon {
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
  transition: color var(--transition-base);
}

.upload-box:hover .upload-icon {
  color: var(--accent-primary);
}

.upload-text {
  font-size: var(--font-size-base);
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.upload-text strong {
  color: var(--accent-primary);
}

.upload-text-small {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.upload-btn {
  margin-top: var(--space-md);
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-base);
}

/* Progress Bar */
.upload-progress {
  max-width: 500px;
  width: 100%;
  margin-top: var(--space-xl);
  animation: fadeInView 0.3s ease;
}

.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 1.5s infinite;
}

.progress-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  text-align: center;
}

/* Upload Separator */
.upload-separator {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 500px;
  margin-top: var(--space-xl);
}

.separator-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
}

.separator-text {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 1px;
}

/* Blank Report Button */
.btn-blank-report {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: var(--space-md) var(--space-2xl);
  font-size: var(--font-size-base);
  font-weight: 600;
  font-family: var(--font-family);
  color: #fff;
  background: linear-gradient(135deg, #0077B6, #00B4D8);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 119, 182, 0.3);
  margin-top: var(--space-md);
}

.btn-blank-report:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 119, 182, 0.45);
  background: linear-gradient(135deg, #005f8f, #0097b8);
}

.btn-blank-report:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(0, 119, 182, 0.3);
}

.btn-blank-report svg {
  flex-shrink: 0;
}

/* Full-width form group */
.form-group.full-width {
  grid-column: 1 / -1;
}

/* Editor view should not have max-width or padding */
#editorView {
  max-width: 100%;
  padding: 0;
}

#editorView .editor-toolbar {
  max-width: 100%;
}

/* ─── Login / Register View ──────────────────────────────── */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--navbar-height) - 4rem);
  padding: var(--space-xl);
  gap: var(--space-xl);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  width: 100%;
  max-width: 420px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  animation: fadeInView 0.5s ease;
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: var(--space-md);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.login-title {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-xs);
}

.login-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.login-field label {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  font-weight: 600;
}

.login-btn {
  width: 100%;
  justify-content: center;
  padding: var(--space-md) var(--space-lg);
  font-size: var(--font-size-base);
  margin-top: var(--space-sm);
}

.login-error {
  color: var(--error);
  font-size: var(--font-size-sm);
  text-align: center;
  min-height: 20px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

/* ─── Navbar User Info ───────────────────────────────────── */
.nav-user-info {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  padding: var(--space-xs) var(--space-md);
  background: var(--glass);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.nav-user-info svg {
  color: var(--accent-primary);
}

/* ─── Accent Button ──────────────────────────────────────── */
.btn-accent {
  background: linear-gradient(135deg, #00C897, #00A67E);
  color: white;
  border: none;
  font-weight: 600;
}

.btn-accent:hover {
  background: linear-gradient(135deg, #00E0A8, #00C897);
  box-shadow: 0 0 20px rgba(0, 200, 151, 0.3);
  transform: translateY(-1px);
}

/* ─── Saved Reports Grid ─────────────────────────────────── */
.saved-reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-lg);
  padding: var(--space-md) 0;
}

.saved-report-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  animation: fadeInView 0.3s ease;
  position: relative;
  overflow: hidden;
}

.saved-report-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.saved-report-card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.saved-report-card:hover::before {
  opacity: 1;
}

.report-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
}

.report-card-patient {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--text-primary);
}

.report-card-date {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.report-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.report-card-tag {
  font-size: var(--font-size-xs);
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--glass);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}

.report-card-tag.exam {
  color: var(--accent-light);
  border-color: rgba(0, 180, 216, 0.2);
  background: rgba(0, 180, 216, 0.08);
}

.report-card-tag.dept {
  color: var(--success);
  border-color: rgba(0, 200, 151, 0.2);
  background: rgba(0, 200, 151, 0.08);
}

.report-card-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

.report-card-actions .btn {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-xs);
}

.saved-reports-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.saved-reports-empty .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.saved-reports-empty p {
  font-size: var(--font-size-base);
}

/* ─── Responsive for new views ───────────────────────────── */
@media (max-width: 480px) {
  .login-card {
    padding: var(--space-lg);
  }

  .saved-reports-grid {
    grid-template-columns: 1fr;
  }

  .nav-user-info span {
    display: none;
  }
}
