/* ═══════════════════════════════════════════
   VARIABLES & RESET
   ═══════════════════════════════════════════ */
:root {
  --color-tnf:      #e53e3e;
  --color-il23:     #805ad5;
  --color-integrin: #3182ce;
  --color-s1p:      #38a169;
  --color-jak:      #dd6b20;
  --color-neutral:  #94a3b8;

  --bg-page:        #f1f5f9;
  --bg-card:        #ffffff;
  --border-light:   #e2e8f0;

  --font:           'Inter', system-ui, -apple-system, sans-serif;
  --radius-sm:      6px;
  --radius-md:      10px;
  --shadow-card:    0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-panel:   0 4px 16px rgba(0,0,0,0.09);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: #1e293b;
  line-height: 1.5;
  font-size: 14px;
}

/* ═══════════════════════════════════════════
   LAYOUT WRAPPER
   ═══════════════════════════════════════════ */
.app-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ═══════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════ */
.site-header {
  margin-bottom: 18px;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 14px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.header-text h1 {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.4px;
}

.header-subtitle {
  font-size: 12px;
  color: #64748b;
  margin-top: 3px;
}

.header-site-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid #0f172a;
  color: #0f172a;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font);
  text-align: center;
  text-decoration: none;
  line-height: 1.3;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.header-site-btn:hover {
  background: #0f172a;
  color: #ffffff;
}

.header-btns {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.header-pdf-btn {
  border-color: #2563eb;
  color: #2563eb;
  font-size: 10px;
}

.header-pdf-btn:hover {
  background: #2563eb;
  color: #ffffff;
}

/* ═══════════════════════════════════════════
   SEARCH BAR
   ═══════════════════════════════════════════ */
.search-bar {
  position: relative;
  margin-bottom: 10px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 11px 38px 11px 40px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-size: 14px;
  font-family: var(--font);
  color: #1e293b;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

.search-input:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96,165,250,0.15);
}

.search-input::placeholder { color: #94a3b8; }

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.search-clear:hover { color: #475569; }

.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
  list-style: none;
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
}

.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover, .search-result-item.active { background: #f1f5f9; }

.search-result-name {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.search-result-name mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.search-result-meta {
  font-size: 11px;
  color: #64748b;
}

/* ═══════════════════════════════════════════
   CONTROLS BAR
   ═══════════════════════════════════════════ */
.controls-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}

.select-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.select-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #64748b;
}

.select-control {
  padding: 7px 30px 7px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  font-size: 13px;
  font-family: var(--font);
  color: #1e293b;
  min-width: 190px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s;
}

.select-control:hover  { border-color: #94a3b8; }
.select-control:focus  { border-color: #60a5fa; outline: none; box-shadow: 0 0 0 3px rgba(96,165,250,0.15); }

.clear-btn {
  padding: 7px 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 13px;
  font-family: var(--font);
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.clear-btn:hover { background: #f1f5f9; color: #1e293b; border-color: #94a3b8; }

/* ═══════════════════════════════════════════
   DIAGRAM CONTAINER
   ═══════════════════════════════════════════ */
.diagram-container {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 12px 12px 6px;
  margin-bottom: 6px;
  overflow-x: auto;
}

#pathway-diagram {
  width: 100%;
  height: auto;
  display: block;
  min-width: 900px;
}

/* ─── Inhibition badge text ─── */
.db-name-t  { font-size: 9px;   font-weight: 700; font-family: var(--font); }
.db-class-t { font-size: 7.5px; fill: #94a3b8;   font-family: var(--font); }

/* ─── SVG text classes ─── */
.module-label  { font-size: 9.5px;  font-weight: 700; text-transform: uppercase; letter-spacing: 0.9px; }
.cell-label    { font-size: 10px;   font-weight: 600; }
.cell-sublabel { font-size: 7.5px; }
.node-label    { font-size: 10.5px; font-weight: 700; fill: #1e293b; }
.node-sublabel { font-size: 8px;    fill: #64748b; }
.small-label   { font-size: 9px;    fill: #94a3b8; }
.drug-ref-label{ font-size: 8.5px;  font-weight: 600; }

/* ═══════════════════════════════════════════
   PATHWAY NODE STATES
   ═══════════════════════════════════════════ */
.pathway-node {
  cursor: pointer;
  transition: opacity 0.22s ease;
}

.pathway-node circle,
.pathway-node ellipse {
  transition: stroke 0.22s ease, fill 0.22s ease;
}

.pathway-node.dimmed {
  opacity: 0.16;
}

.pathway-node.highlighted circle,
.pathway-node.highlighted ellipse {
  filter: url(#node-glow);
}

.pathway-arrow {
  /* stroke + arrowhead color both follow the CSS `color` property */
  stroke: currentColor;
  color: #94a3b8;
  fill: none;
  stroke-width: 1.8px;
  transition: color 0.22s ease, opacity 0.22s ease;
}

/* ── Flowing arrow animation on highlighted pathway ── */
@keyframes flow-arrow {
  from { stroke-dashoffset: 18; }
  to   { stroke-dashoffset: 0; }
}

.pathway-arrow.flowing {
  stroke-dasharray: 7 3;
  animation: flow-arrow 0.55s linear infinite;
}

/* Always-animated trafficking arrows (shown regardless of pathway selection) */
.arrow-always-flow {
  stroke-dasharray: 7 3;
  stroke-dashoffset: 0;
  animation: flow-arrow 0.55s linear infinite;
}

/* ═══════════════════════════════════════════
   LEGEND STRIP
   ═══════════════════════════════════════════ */
.legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 8px 4px 4px;
}

.legend-item {
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: default;
  letter-spacing: 0.2px;
}

.legend-item.tnf      { background: #fff5f5; color: var(--color-tnf);      border-color: var(--color-tnf); }
.legend-item.il23     { background: #f5f3ff; color: var(--color-il23);     border-color: var(--color-il23); }
.legend-item.integrin { background: #eff6ff; color: var(--color-integrin); border-color: var(--color-integrin); }
.legend-item.s1p      { background: #f0fdf4; color: var(--color-s1p);      border-color: var(--color-s1p); }
.legend-item.jak      { background: #fff7ed; color: var(--color-jak);      border-color: var(--color-jak); }

/* ═══════════════════════════════════════════
   CAPTION
   ═══════════════════════════════════════════ */
.diagram-caption {
  text-align: center;
  font-size: 12px;
  color: #64748b;
  font-style: italic;
  margin: 8px 0 18px;
}

/* ═══════════════════════════════════════════
   INFO PANEL
   ═══════════════════════════════════════════ */
.info-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
  padding: 22px 24px;
  margin-bottom: 16px;
  animation: panel-in 0.2s ease;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.info-placeholder {
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  padding: 22px;
  border: 1.5px dashed var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.info-header {
  padding-left: 14px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}

.info-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.info-drug-name {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.3px;
}

.info-class-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.info-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.info-meta-item {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 5px;
}

.meta-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.info-meta-sep { color: #cbd5e0; font-size: 12px; }

.ind-badges-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.ind-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 28px;
}

.info-item.full-width { grid-column: 1 / -1; }

.info-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94a3b8;
  margin-bottom: 3px;
}

.info-value {
  font-size: 13px;
  color: #1e293b;
  line-height: 1.5;
}

.info-refs {
  font-size: 12px;
  color: #475569;
  line-height: 1.7;
}

.info-refs div { margin-bottom: 1px; }

/* ═══════════════════════════════════════════
   INFO PANEL TABS
   ═══════════════════════════════════════════ */
.info-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-light);
}

.info-tab {
  padding: 5px 16px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.info-tab:hover { background: #f1f5f9; color: #1e293b; border-color: #94a3b8; }

.info-tab.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.info-tab-content { display: none; }
.info-tab-content.active { display: block; }

/* Swipe hint on mobile */
.swipe-hint {
  display: none;
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  margin-top: -6px;
  margin-bottom: 8px;
}

@media (max-width: 768px) {
  .swipe-hint { display: block; }

  .info-tabs-wrapper {
    overflow: hidden;
    position: relative;
  }

  .info-tabs-slides {
    display: flex;
    transition: transform 0.28s ease;
  }

  .info-tab-content {
    min-width: 100%;
    display: block;
    flex-shrink: 0;
  }
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--border-light);
  padding-top: 14px;
  margin-top: 8px;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  line-height: 1.7;
}

/* ═══════════════════════════════════════════
   RESPONSIVE  ≤ 768 px
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .app-wrapper   { padding: 14px 10px 32px; }
  .site-header h1 { font-size: 18px; }

  .controls-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .select-control { min-width: 100%; width: 100%; }
  .clear-btn      { width: 100%; text-align: center; }

  .info-grid { grid-template-columns: 1fr; }
  .info-item.full-width { grid-column: 1; }

  .info-drug-name { font-size: 17px; }
}

@media (max-width: 480px) {
  .diagram-container { padding: 8px 6px 4px; }
  .legend { gap: 6px; }
  .legend-item { font-size: 10px; padding: 2px 8px; }
}
