/* ============================================
   /research/ — Clinical Research Hub Styles
   Team 5 (UX) + Team 17 (Mobile) design system
   ============================================ */

/* ── Hero ────────────────────────────────────── */
.hero-research {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--secondary) 100%);
  color: #fff;
  padding: var(--space-xl) 0 var(--space-lg);
  text-align: center;
}
.hero-research h1 {
  color: #fff;
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: var(--space-sm);
}
.hero-research .hero-subtitle {
  color: rgba(255,255,255,0.9);
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 700px;
  margin: 0 auto;
}
.hero-research .trust-badge {
  display: inline-block;
  margin-bottom: var(--space-sm);
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
}

/* ── Stats Bar ───────────────────────────────── */
.research-stats-bar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: var(--space-md) 0;
}
.research-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  text-align: center;
}
.research-stat-number {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}
.research-stat-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* ── Study Cards ─────────────────────────────── */
.study-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.study-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.study-card-landmark {
  border-left: 3px solid var(--primary);
}
.study-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}
.study-card h3,
.study-card h4 {
  margin-bottom: var(--space-xs);
  font-size: 1.1rem;
  line-height: 1.4;
}
.study-plain-finding {
  color: var(--text);
  line-height: 1.7;
  margin-bottom: var(--space-sm);
}

/* ── Study Badges ────────────────────────────── */
.study-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.study-badge-landmark {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.study-badge-active {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}
.study-badge-completed {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}
.study-badge-ongoing {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.study-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Study Data Tables ───────────────────────── */
.study-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: var(--space-sm);
}
.study-data-table th {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 1rem 0.5rem 0;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  width: 130px;
  border-bottom: 1px solid var(--border);
}
.study-data-table td {
  padding: 0.5rem 0;
  color: var(--text-light);
  line-height: 1.6;
  border-bottom: 1px solid var(--border);
}
.study-data-table em {
  font-style: italic;
}

/* ── Source Links ─────────────────────────────── */
.study-source-links {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-xs);
}
.study-source-links a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--primary);
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}
.study-source-links a:hover {
  background: var(--primary);
  color: #fff;
}

/* ── Related Links ────────────────────────────── */
.study-related-links {
  margin-top: var(--space-xs);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.study-related-links a {
  color: var(--primary);
  text-decoration: none;
  margin-right: var(--space-sm);
}
.study-related-links a:hover {
  text-decoration: underline;
}

/* ── Research Timeline ───────────────────────── */
.research-timeline {
  position: relative;
  padding-left: 80px;
  margin: var(--space-lg) 0;
}
.research-timeline::before {
  content: '';
  position: absolute;
  left: 35px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-node {
  position: relative;
  margin-bottom: var(--space-lg);
}
.timeline-year {
  position: absolute;
  left: -80px;
  top: 0;
  width: 60px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
}
.timeline-connector {
  position: absolute;
  left: -45px;
  top: 8px;
  width: 12px;
  height: 12px;
  background: var(--primary);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--primary);
}

/* ── Active Trials Grid ──────────────────────── */
.active-trials-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin: var(--space-md) 0;
}
.trial-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-md);
  border-left: 3px solid #1e40af;
}
.trial-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}
.trial-treatment {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.trial-mechanism {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: var(--space-sm);
}

/* ── Category Tabs ───────────────────────────── */
.category-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: var(--space-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.25rem;
}
.category-tabs::-webkit-scrollbar {
  display: none;
}
.category-tab {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  font-family: inherit;
}
.category-tab:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}
.category-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.category-panel {
  display: none;
}
.category-panel.active {
  display: block;
}
.category-panel h3 {
  margin-bottom: var(--space-xs);
}
.category-panel > p {
  margin-bottom: var(--space-md);
  color: var(--text-light);
}

/* ── Section CTA Bridge ──────────────────────── */
.section-cta-bridge {
  text-align: center;
  padding: var(--space-md) 0;
  margin-top: var(--space-md);
  border-top: 1px solid var(--border);
}
.section-cta-bridge p {
  margin-bottom: var(--space-sm);
  color: var(--text-light);
}
.btn-primary-cta {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 0.85rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}
.btn-primary-cta:hover {
  background: #a12828;
  transform: translateY(-1px);
}

/* ── Info Boxes (Patient Guide) ──────────────── */
.info-box {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}
.info-box h3 {
  font-size: 1rem;
  margin-bottom: var(--space-sm);
}
.info-box p {
  margin-bottom: var(--space-sm);
}
.info-box ol {
  padding-left: 1.25rem;
}
.info-box ol li {
  margin-bottom: var(--space-xs);
  line-height: 1.6;
}

/* ── Research Guide Table ────────────────────── */
.research-guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.research-guide-table thead th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  background: var(--bg-alt);
  border-bottom: 2px solid var(--border);
  font-size: 0.85rem;
}
.research-guide-table tbody td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}
.research-guide-table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Research Definitions ────────────────────── */
.research-definitions dt {
  font-weight: 600;
  color: var(--text);
  margin-top: var(--space-sm);
  margin-bottom: 0.25rem;
}
.research-definitions dd {
  margin-left: 0;
  padding-left: 0;
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: var(--space-sm);
}

/* ── Section Alternating Backgrounds ─────────── */
.section-alt {
  background: var(--bg-alt);
}

/* ── Mobile Responsive ───────────────────────── */
@media (max-width: 768px) {
  .hero-research {
    padding: var(--space-lg) 0 var(--space-md);
  }
  .hero-research h1 {
    font-size: 1.75rem;
  }
  .hero-research .hero-subtitle {
    font-size: 1rem;
  }

  .research-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }
  .research-stat-number {
    font-size: 1.4rem;
  }

  /* Timeline: collapse to simple stack on mobile */
  .research-timeline {
    padding-left: 0;
  }
  .research-timeline::before {
    display: none;
  }
  .timeline-year {
    position: static;
    width: auto;
    display: inline-block;
    margin-bottom: var(--space-xs);
  }
  .timeline-connector {
    display: none;
  }

  .study-card {
    padding: var(--space-sm);
  }
  .study-data-table th {
    display: block;
    width: auto;
    padding-bottom: 0;
    border-bottom: none;
  }
  .study-data-table td {
    display: block;
    padding-top: 0;
    padding-left: 0;
  }

  .category-tabs {
    gap: 0.35rem;
  }
  .category-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .research-guide-table {
    font-size: 0.8rem;
  }
  .research-guide-table thead th,
  .research-guide-table tbody td {
    padding: 0.4rem 0.5rem;
  }

  .active-trials-grid {
    gap: var(--space-sm);
  }

  .info-box {
    padding: var(--space-sm);
  }
}

@media (max-width: 480px) {
  .research-stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .research-stat-number {
    font-size: 1.25rem;
  }
  .research-stat-label {
    font-size: 0.75rem;
  }

  .study-source-links {
    flex-direction: column;
  }
  .study-source-links a {
    text-align: center;
  }

  #related-resources > .container > div {
    grid-template-columns: 1fr !important;
  }
}
