/* ==========================================================================
   Clinical Precision Design System - Stylesheet
   Genomic Resistance Marker Profiler & Clinical Variant Analysis
   ========================================================================== */

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

:root {
  /* Surface Tokens */
  --surface: #f8f9ff;
  --surface-dim: #cbdbf5;
  --surface-bright: #f8f9ff;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #eff4ff;
  --surface-container: #e5eeff;
  --surface-container-high: #dce9ff;
  --surface-container-highest: #d3e4fe;
  
  /* Text / Contrast Tokens */
  --on-surface: #0b1c30;
  --on-surface-variant: #45474c;
  --inverse-surface: #213145;
  --inverse-on-surface: #eaf1ff;
  --outline: #75777d;
  --outline-variant: #c5c6cd;
  --surface-tint: #545f73;
  
  /* Primary & Accent Tokens */
  --primary: #091426;
  --on-primary: #ffffff;
  --primary-container: #1e293b;
  --on-primary-container: #8590a6;
  --inverse-primary: #bcc7de;
  
  --secondary: #0058be;
  --on-secondary: #ffffff;
  --secondary-container: #2170e4;
  --on-secondary-container: #fefcff;
  
  /* Clinical Pathogenicity Tokens */
  --pathogenic: #ba1a1a;
  --pathogenic-bg: #ffdad6;
  --pathogenic-text: #93000a;
  
  --likely-pathogenic: #d97706;
  --likely-pathogenic-bg: #fef3c7;
  --likely-pathogenic-text: #92400e;
  
  --vus: #64748b;
  --vus-bg: #f1f5f9;
  --vus-text: #334155;
  
  --benign: #16a34a;
  --benign-bg: #dcfce7;
  --benign-text: #15803d;
  
  --resistance: #8b5cf6;
  --resistance-bg: #f3e8ff;
  --resistance-text: #6b21a8;
  
  /* Layout Rhythm */
  --sidebar-width: 260px;
  --header-height: 56px;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--surface);
  color: var(--on-surface);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography Classes */
.font-mono, .code-data {
  font-family: 'JetBrains Mono', monospace !important;
}

.font-headline {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Material Symbols Adjustments */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  vertical-align: middle;
  line-height: 1;
}

.material-symbols-outlined.fill {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

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

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

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Glass & Container Cards */
.glass-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(11, 28, 48, 0.04), 0 1px 2px rgba(11, 28, 48, 0.02);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  box-shadow: 0 4px 12px rgba(11, 28, 48, 0.06);
}

.glass-card-interactive {
  cursor: pointer;
}

.glass-card-interactive:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

/* Status Indicators */
.variant-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.variant-dot.pathogenic { background-color: var(--pathogenic); box-shadow: 0 0 0 3px rgba(186, 26, 26, 0.15); }
.variant-dot.likely-pathogenic { background-color: var(--likely-pathogenic); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15); }
.variant-dot.vus { background-color: var(--vus); }
.variant-dot.benign { background-color: var(--benign); }
.variant-dot.resistance { background-color: var(--resistance); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2); }

/* Table Styling */
.precision-table {
  width: 100%;
  border-collapse: collapse;
}

.precision-table thead {
  position: sticky;
  top: 0;
  background: #f8f9ff;
  border-bottom: 1px solid #e2e8f0;
  z-index: 10;
}

.precision-table th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  text-align: left;
  white-space: nowrap;
}

.precision-table td {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.precision-table tbody tr {
  transition: background-color 0.15s ease;
}

.precision-table tbody tr:nth-child(even) {
  background-color: #fbfdff;
}

.precision-table tbody tr:hover {
  background-color: #f0f7ff !important;
}

.precision-table tbody tr.active-row {
  background-color: #e0edff !important;
  border-left: 3px solid var(--secondary);
}

/* Genomic Track Viewer Elements */
.genomic-ruler {
  background: repeating-linear-gradient(
    to right,
    #cbd5e1,
    #cbd5e1 1px,
    transparent 1px,
    transparent 20px
  );
  height: 12px;
  position: relative;
}

.genomic-exon {
  height: 24px;
  background: #1e293b;
  border-radius: 3px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  transition: all 0.15s ease;
  cursor: pointer;
}

.genomic-exon:hover {
  background: var(--secondary);
  transform: scaleY(1.1);
}

.genomic-intron {
  height: 2px;
  background: #94a3b8;
  position: relative;
}

.lollipop-pin {
  position: absolute;
  bottom: 28px;
  width: 2px;
  height: 36px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  z-index: 15;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.lollipop-pin:hover {
  z-index: 30;
  transform: translateX(-50%) scale(1.15);
}

.lollipop-head {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.lollipop-stem {
  width: 2px;
  flex: 1;
}

/* Sequence Alignment Box */
.sequence-viewer {
  background-color: #091426;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  overflow-x: auto;
  line-height: 1.8;
  letter-spacing: 0.12em;
}

.seq-base-a { color: #4ade80; font-weight: 600; }
.seq-base-t { color: #f87171; font-weight: 600; }
.seq-base-c { color: #60a5fa; font-weight: 600; }
.seq-base-g { color: #fbbf24; font-weight: 600; }
.seq-mutation-highlight {
  background: rgba(239, 68, 68, 0.35);
  border-bottom: 2px solid #ef4444;
  padding: 1px 3px;
  border-radius: 2px;
  font-weight: 700;
}

/* Biological Pathway Diagrams */
.pathway-canvas {
  background: radial-gradient(circle, #e2e8f0 1px, transparent 1px);
  background-size: 20px 20px;
  background-color: #ffffff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
}

.pathway-node {
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 12px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
  border: 1px solid #cbd5e1;
}

.pathway-node:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.pathway-node.status-mutated {
  background-color: #fef2f2;
  border-color: #f87171;
  color: #991b1b;
}

.pathway-node.status-intact {
  background-color: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

.pathway-node.status-inhibited {
  background-color: #f8fafc;
  border-color: #94a3b8;
  color: #475569;
  border-style: dashed;
}

.pathway-node.status-target {
  background-color: #eff6ff;
  border-color: #60a5fa;
  color: #1e40af;
}

/* Deep-dive Drawer / Modal Overlay */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 20, 38, 0.5);
  backdrop-filter: blur(4px);
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.variant-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 580px;
  background: #ffffff;
  box-shadow: -4px 0 24px rgba(9, 20, 38, 0.15);
  z-index: 51;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.variant-drawer.open {
  transform: translateX(0);
}

/* Modals */
.modal-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 16px;
}

.modal-container.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.96);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-container.active .modal-content {
  transform: scale(1);
}

/* Pulse / Beacon animations for critical pathogenic markers */
@keyframes beacon {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(0.95); opacity: 0; }
}

.pulse-beacon {
  position: relative;
}

.pulse-beacon::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--pathogenic);
  animation: beacon 2s infinite;
  z-index: 0;
}

/* Print Stylesheet for CDS Diagnostic Reports */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  
  nav, header, .no-print, button, .modal-container, .variant-drawer {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  
  .glass-card {
    border: 1px solid #000000 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
}
