/* ============================================================
   MedAnalyze AI — Premium Glassmorphism Dashboard
   Production CSS with 3D effects, animations, dark mode
   ============================================================ */

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

:root {
  /* Clean Light Theme Colors */
  --bg-deep: #f8fafc;
  /* Very light cool gray/blue */
  --bg-mid: #f1f5f9;
  /* Slightly darker gray for depth */
  --bg-surface: #ffffff;
  /* Pure white for cards */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(148, 163, 184, 0.2);
  --glass-hover: rgba(255, 255, 255, 0.9);

  /* Modern Teals, Blues, and Accents */
  --accent-violet: #4f46e5;
  --accent-cyan: #0ea5e9;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #ef4444;

  /* Fresh Gradients */
  --grad-primary: linear-gradient(135deg, #0ea5e9, #6366f1);
  --grad-success: linear-gradient(135deg, #10b981, #0ea5e9);
  --grad-danger: linear-gradient(135deg, #ef4444, #f59e0b);

  /* Readable Text Colors for Light Theme */
  --text-primary: #0f172a;
  /* Slate 900 for high contrast headers */
  --text-secondary: #334155;
  /* Slate 700 for body text */
  --text-muted: #64748b;
  /* Slate 500 for secondary info */

  /* Layout */
  --sidebar-w: 260px;
  --header-h: 72px;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Shadows for Light Theme (Softer, dropping downwards with crisp neon ring) */
  --shadow-glass: 0 4px 20px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --shadow-neon-cyan: 0 0 0 2px rgba(14, 165, 233, 1), 0 6px 20px rgba(14, 165, 233, 0.35);
  --shadow-neon-violet: 0 0 0 2px rgba(79, 70, 229, 1), 0 6px 20px rgba(79, 70, 229, 0.35);
  --shadow-neon-emerald: 0 0 0 2px rgba(16, 185, 129, 1), 0 6px 20px rgba(16, 185, 129, 0.35);
  --shadow-card: 0 12px 28px rgba(15, 23, 42, 0.1);

  /* Smooth Transitions */
  --transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.2s ease;
}

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

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

/* ── Animated Background Orbs ────────────────────────────────── */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: orb-drift 20s ease-in-out infinite;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #6366f1, transparent);
  top: -200px;
  left: -200px;
  animation-duration: 25s;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #06b6d4, transparent);
  bottom: -150px;
  right: -150px;
  animation-duration: 20s;
  animation-delay: -8s;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #f59e0b, transparent);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 30s;
  animation-delay: -15s;
  opacity: 0.08;
}

@keyframes orb-drift {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  25% {
    transform: translate(60px, -40px) scale(1.1);
  }

  50% {
    transform: translate(30px, 60px) scale(0.9);
  }

  75% {
    transform: translate(-40px, 20px) scale(1.05);
  }
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: rgba(255, 255, 255, 0.85);
  /* Light blur background */
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.logo-icon svg {
  width: 100%;
  height: 100%;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-name {
  font-size: 1.125rem;
  font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.logo-tag {
  font-size: 0.68rem;
  color: var(--accent-cyan);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  width: 100%;
  text-align: left;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
  transform: translateX(4px);
  /* Smooth interaction */
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(99, 102, 241, 0.05));
  color: var(--accent-violet);
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-amber);
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.healthy {
  background: var(--accent-emerald);
}

.status-dot.unhealthy {
  background: var(--accent-rose);
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.6;
    transform: scale(0.85);
  }
}

.linkedin-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #0a66c2;
  color: #ffffff;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.linkedin-btn svg {
  width: 16px;
  height: 16px;
}

.linkedin-btn:hover {
  background: #004182;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(10, 102, 194, 0.3);
}

.disclaimer-mini {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── Hamburger (mobile) ───────────────────────────────────────── */
.hamburger {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

/* ── Main Content ─────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  position: relative;
  z-index: 1;
  padding: 1.5rem 2rem 3rem;
}

/* ── Page Header ──────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--glass-border);
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#pageSubtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.disclaimer-badge {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.4rem 0.875rem;
  border-radius: 100px;
  white-space: nowrap;
}

.disclaimer-badge svg {
  width: 14px;
  height: 14px;
}

/* ── Section Visibility ───────────────────────────────────────── */
.section {
  display: none;
  animation: fade-up 0.4s ease forwards;
}

.section.active {
  display: block;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Glass Card ───────────────────────────────────────────────── */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-glass);
  transition: all var(--transition);
}

.glass-card:hover {
  border-color: rgba(14, 165, 233, 0.8);
  /* Teal border on hover */
  transform: translateY(-2px);
  /* Lift up effect */
  box-shadow: var(--shadow-card), var(--shadow-neon-cyan);
}

/* ── 3D Tilt Card Effect ──────────────────────────────────────── */
.tilt-card {
  transform-style: preserve-3d;
  transform: perspective(800px) rotateX(0deg) rotateY(0deg);
  transition: transform 0.1s ease, box-shadow var(--transition);
  will-change: transform;
}

.tilt-card:hover {
  box-shadow: var(--shadow-card), var(--shadow-neon-cyan);
}

/* ── Upload Section ───────────────────────────────────────────── */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.upload-card {
  padding: 0;
  overflow: hidden;
}

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 2rem;
  border-radius: var(--radius-lg);
  border: 2px dashed rgba(148, 163, 184, 0.4);
  /* Softer dashed line */
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all var(--transition);
}

.upload-zone:hover {
  border-color: var(--accent-cyan);
  background: rgba(14, 165, 233, 0.05);
  /* Soft teal fill */
  transform: translateY(-2px);
  box-shadow: inset 0 0 20px rgba(14, 165, 233, 0.1), var(--shadow-neon-cyan);
}

.upload-zone.dragging {
  border-color: var(--accent-violet);
  background: rgba(79, 70, 229, 0.1);
  transform: scale(1.02);
  box-shadow: inset 0 0 30px rgba(79, 70, 229, 0.2), var(--shadow-neon-violet);
}

.upload-icon-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.upload-icon-ring {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px dashed rgba(99, 102, 241, 0.3);
  animation: ring-spin 12s linear infinite;
}

.upload-icon {
  width: 72px;
  height: 72px;
  position: relative;
  z-index: 1;
}

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

.upload-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.upload-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.upload-sub code {
  background: rgba(255, 255, 255, 0.07);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.375rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: var(--shadow-neon-violet);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--grad-success);
  color: #fff;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  filter: brightness(1.1);
  box-shadow: var(--shadow-neon-emerald);
  transform: translateY(-1px);
}

.btn-export {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
  padding: 0.8rem 2rem;
}

.btn-export:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

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

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-sm {
  padding: 0.4rem 0.875rem;
  font-size: 0.8rem;
}

/* ── File Preview ─────────────────────────────────────────────── */
.file-preview {
  padding: 1.5rem 2rem;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  margin-bottom: 1rem;
}

.file-icon {
  font-size: 2rem;
}

.file-details {
  flex: 1;
  min-width: 0;
}

.file-name {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.file-remove {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--accent-rose);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: 0.8rem;
  transition: var(--transition-fast);
}

.file-remove:hover {
  background: rgba(244, 63, 94, 0.2);
}

/* ── Info Cards ───────────────────────────────────────────────── */
.info-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.info-card {
  padding: 1.25rem;
  cursor: default;
}

.info-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.875rem;
  color: var(--accent);
}

.info-card-icon svg {
  width: 22px;
  height: 22px;
}

.info-card h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.info-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Progress ─────────────────────────────────────────────────── */
.progress-card {
  padding: 1.5rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}

.progress-label {
  font-size: 0.875rem;
  font-weight: 600;
}

.progress-percent {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  color: var(--accent-cyan);
}

.progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--grad-primary);
  border-radius: 100px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.6);
}

.progress-steps {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.step {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  border: 1px solid var(--glass-border);
  transition: var(--transition);
}

.step.active {
  color: var(--text-primary);
  border-color: var(--accent-violet);
  background: rgba(99, 102, 241, 0.1);
}

.step.done {
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.3);
}

/* ── Disclaimer Banner ────────────────────────────────────────── */
.disclaimer-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  color: #fbbf24;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.disclaimer-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Stats Row ────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  padding: 1.25rem;
  border-radius: var(--radius-md);
  animation: fade-up 0.4s ease both;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Risk Flags ───────────────────────────────────────────────── */
.risk-container {
  margin-bottom: 1.5rem;
}

.risk-card {
  padding: 1.25rem;
  border-color: rgba(244, 63, 94, 0.25);
}

.risk-title {
  color: var(--accent-rose) !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 1rem !important;
}

.risk-title svg {
  width: 18px;
  height: 18px;
}

.risk-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.risk-flag {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fb7185;
  padding: 0.3rem 0.875rem;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 500;
  animation: fade-up 0.3s ease both;
}

/* ── Entity Grid ──────────────────────────────────────────────── */
.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.entity-card {
  padding: 1.25rem;
}

.entity-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}

.entity-icon {
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
}

.entity-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.entity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.entity-tag {
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.2);
  color: var(--accent-violet);
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.entity-tag:hover {
  background: rgba(14, 165, 233, 0.2);
  transform: translateY(-1px);
  /* Make tags interactive */
}

.entity-empty {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
}

.entity-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Summary Grid ─────────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  padding: 1.5rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.summary-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.75;
}

.summary-friendly .card-title {
  color: var(--accent-emerald);
}

.summary-professional .card-title {
  color: var(--accent-cyan);
}

/* ── Export Row ───────────────────────────────────────────────── */
.export-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: flex-start;
  padding-top: 0.5rem;
}

/* ── Results Empty ────────────────────────────────────────────── */
.results-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 450px;
  text-align: center;
  gap: 1rem;
}

.empty-icon {
  font-size: 5rem;
  line-height: 1;
  filter: grayscale(0.5);
}

.results-empty h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.results-empty p {
  color: var(--text-muted);
  max-width: 360px;
}

/* ── Confidence Meter ─────────────────────────────────────────── */
.confidence-bar-wrap {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.confidence-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--grad-success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.confidence-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--accent-emerald);
  min-width: 40px;
}

/* ── History Table ────────────────────────────────────────────── */
.history-card {
  padding: 1.5rem;
}

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

.history-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

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

.history-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  vertical-align: middle;
}

.history-table tbody tr {
  transition: all var(--transition-fast);
  cursor: pointer;
}

.history-table tbody tr:hover {
  background: var(--glass-hover);
  transform: scale(1.01);
  /* Interactive row hover */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-sm);
}

.table-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem !important;
  font-weight: 500;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-completed {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.badge-processing {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

.badge-failed {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

/* ── Pagination ───────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.page-btn {
  padding: 0.4rem 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  transition: var(--transition-fast);
}

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

.page-btn.active {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
}

/* ── API Docs ─────────────────────────────────────────────────── */
.docs-card {
  padding: 2rem;
}

.docs-intro {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.docs-link {
  color: var(--accent-violet);
  text-decoration: none;
  font-weight: 500;
}

.docs-link:hover {
  text-decoration: underline;
}

.endpoints {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.endpoint {
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.endpoint-header code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.method {
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.05em;
}

.method.post {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.method.get {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.endpoint p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.code-block {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 0.875rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #94a3b8;
  overflow-x: auto;
  white-space: pre;
}

/* ── Toast Notifications ──────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  font-size: 0.85rem;
  font-weight: 500;
  max-width: 360px;
  animation: toast-in 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.toast-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.toast-error {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

.toast-info {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
}

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

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .upload-grid {
    grid-template-columns: 1fr;
  }

  .info-cards {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }

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

  .main-content {
    margin-left: 0;
    padding: 4.5rem 1rem 2rem;
  }

  .hamburger {
    display: flex;
  }

  .page-header {
    flex-direction: column;
    gap: 0.75rem;
  }

  .info-cards {
    grid-template-columns: 1fr 1fr;
  }

  .entity-grid {
    grid-template-columns: 1fr;
  }

  .export-row {
    flex-wrap: wrap;
  }

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

@media (max-width: 480px) {
  .info-cards {
    grid-template-columns: 1fr;
  }

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

/* ── Gradient animation on headings ──────────────────────────── */
@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

.page-header h1 {
  background: linear-gradient(270deg, #6366f1, #06b6d4, #10b981, #6366f1);
  background-size: 400% 400%;
  animation: gradient-shift 6s ease infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── Loading Spinner ──────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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