/* ── Design tokens ───────────────────────────────────────────────── */
:root {
  --bg: #ffffff;
  --bg-subtle: #f8fafb;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #555b6e;
  --text-muted: #8a8fa0;
  --border: #e5e8ee;
  --border-light: #f0f2f5;
  --brand: #0d9488;
  --brand-dark: #0f766e;
  --brand-light: #ccfbf1;
  --brand-bg: #f0fdfa;
  --accent-blue: #3b82f6;
  --accent-amber: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 20px rgba(0,0,0,.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top navigation bar ──────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; height: 56px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700; font-size: 17px; color: var(--text);
  text-decoration: none; white-space: nowrap;
}
.brand-accent { color: var(--brand); }

.topnav {
  display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto;
}
.topnav a {
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  padding: 6px 10px; border-radius: 6px; text-decoration: none;
  transition: background .15s, color .15s;
}
.topnav a:hover { background: var(--bg-subtle); color: var(--text); }

.btn-journey {
  display: inline-flex; align-items: center;
  padding: 8px 16px; border-radius: var(--radius-sm);
  background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
  transition: background .15s;
}
.btn-journey:hover { background: var(--brand-dark); text-decoration: none; }

/* ── Hero / landing ──────────────────────────────────────────────── */
.hero {
  max-width: 740px; margin: 0 auto;
  padding: 100px 24px 60px; text-align: center;
}
.hero-title {
  font-size: 38px; font-weight: 700; line-height: 1.25;
  color: var(--text); letter-spacing: -.02em;
}
.hero-sub {
  margin-top: 14px; font-size: 17px; color: var(--text-secondary);
}

.hero-examples {
  margin-top: 24px; display: flex; flex-wrap: wrap;
  justify-content: center; gap: 8px; align-items: center;
}
.hero-examples > span { font-size: 13px; color: var(--text-muted); }

.example-chip {
  font-family: var(--font); font-size: 13px; font-weight: 500;
  padding: 7px 14px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--bg-subtle);
  color: var(--text-secondary); cursor: pointer;
  transition: all .15s;
}
.example-chip:hover {
  border-color: var(--brand); color: var(--brand); background: var(--brand-bg);
}

/* ── Search bar (shared) ─────────────────────────────────────────── */
.search-wrapper {
  position: relative; display: flex; align-items: center;
  max-width: 680px; margin: 28px auto 0;
  border: 2px solid var(--border);
  border-radius: 28px; background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s;
}
.search-wrapper:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}

.search-icon {
  position: absolute; left: 16px; width: 20px; height: 20px;
  color: var(--text-muted); pointer-events: none;
}

.search-wrapper input {
  flex: 1; border: none; outline: none; background: transparent;
  padding: 14px 16px 14px 44px; font-size: 16px; font-family: var(--font);
  color: var(--text); min-width: 0;
}
.search-wrapper input::placeholder { color: var(--text-muted); }

.search-wrapper button {
  margin: 4px; padding: 10px 24px; border: none; border-radius: 22px;
  background: var(--brand); color: #fff; font-size: 15px; font-weight: 600;
  font-family: var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
.search-wrapper button:hover { background: var(--brand-dark); }

/* Compact search bar at top after results */
.compact-search {
  max-width: 880px; margin: 0 auto; padding: 16px 24px 0;
}
.compact-search .search-wrapper { margin-top: 0; }

/* ── Loading state ───────────────────────────────────────────────── */
.loading-section {
  max-width: 700px; margin: 0 auto; padding: 40px 24px;
}
.loading-container { display: flex; flex-direction: column; gap: 20px; }

.loading-text {
  display: flex; align-items: center; gap: 12px;
  font-size: 15px; color: var(--text-secondary);
}

.loading-dot-pulse {
  display: flex; gap: 4px;
}
.loading-dot-pulse::before,
.loading-dot-pulse::after,
.loading-dot-pulse {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand);
}
.loading-dot-pulse { animation: dotPulse .8s ease-in-out infinite; }
.loading-dot-pulse::before { animation: dotPulse .8s ease-in-out infinite .15s; }
.loading-dot-pulse::after { animation: dotPulse .8s ease-in-out infinite .3s; }

@keyframes dotPulse {
  0%, 100% { opacity: .3; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1); }
}

.loading-bars { display: flex; flex-direction: column; gap: 12px; }
.loading-bar {
  height: 14px; border-radius: 7px;
  background: linear-gradient(90deg, var(--border-light) 25%, #e8eaef 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
.loading-bar.short { height: 10px; }

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

.loading-shimmer {
  height: 6px; border-radius: 3px; overflow: hidden;
  background: var(--border-light);
}
.loading-shimmer::after {
  content: ''; display: block; height: 100%; width: 40%;
  background: var(--brand-light);
  animation: shimmerSlide 1.2s ease-in-out infinite;
}
@keyframes shimmerSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ── Results grid ────────────────────────────────────────────────── */
.results-container {
  max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px;
}
.results-grid {
  display: grid;
  grid-template-columns: 240px 1fr 260px;
  gap: 24px; align-items: start;
}

/* ── Rails ────────────────────────────────────────────────────────── */
.rail {
  position: sticky; top: 76px;
}
.rail-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted);
  margin-bottom: 14px;
}
.rail-icon { width: 16px; height: 16px; }

/* Sources rail */
.sources-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.sources-list li { font-size: 13px; }
.source-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  text-decoration: none; color: var(--text);
  transition: all .15s;
}
.source-chip:hover {
  border-color: var(--brand); background: var(--brand-bg);
  text-decoration: none;
}
.source-chip .source-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.source-dot.medigence { background: var(--brand); }
.source-dot.external { background: var(--accent-blue); }

.source-chip .source-label {
  font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.source-note { font-size: 12px; color: var(--text-muted); margin-top: 10px; }

/* Quick links rail */
.quick-links-list { display: flex; flex-direction: column; gap: 10px; }
.quick-link-card {
  display: block; border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
  text-decoration: none; background: var(--surface);
  transition: all .15s;
}
.quick-link-card:hover {
  border-color: var(--brand); box-shadow: var(--shadow-md);
  text-decoration: none;
}
.quick-link-thumb {
  width: 100%; height: 100px; object-fit: cover;
  background: var(--bg-subtle);
}
.quick-link-info { padding: 10px 12px; }
.quick-link-info .ql-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.quick-link-info .ql-sub {
  font-size: 12px; color: var(--text-muted); margin-top: 2px;
}

/* ── Answer panel ────────────────────────────────────────────────── */
.answer-panel { min-width: 0; }

.answer-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px;
  background: var(--brand-bg); border: 1px solid var(--brand-light);
  font-size: 13px; font-weight: 600; color: var(--brand-dark);
  margin-bottom: 16px;
}
.badge-icon { width: 16px; height: 16px; }
.confidence-badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px; margin-left: 4px;
}
.conf-high { background: #dcfce7; color: #166534; }
.conf-medium { background: #fef3c7; color: #92400e; }
.conf-low { background: #fee2e2; color: #991b1b; }

/* Summary */
.answer-summary {
  font-size: 17px; line-height: 1.7; color: var(--text);
  margin-bottom: 24px;
}
.answer-summary strong { font-weight: 700; }

/* Detailed sections */
.answer-details { margin-bottom: 24px; }
.detail-section { margin-bottom: 20px; }
.detail-section h4 {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 2px solid var(--brand-light);
}
.detail-section .detail-content {
  font-size: 15px; line-height: 1.7; color: var(--text);
}
.detail-section .detail-content strong { font-weight: 700; }

/* ── Comparison table ────────────────────────────────────────────── */
.compare-section { margin-bottom: 28px; }
.compare-section h3 {
  font-size: 16px; font-weight: 700; margin-bottom: 12px;
}
.compare-table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); }
.compare-table { width: 100%; border-collapse: collapse; }
.compare-table th {
  padding: 12px 16px; font-size: 13px; font-weight: 700;
  text-align: left; background: var(--bg-subtle);
  border-bottom: 2px solid var(--border); color: var(--text);
}
.compare-table th:first-child { color: var(--text-muted); font-weight: 600; }
.compare-table td {
  padding: 11px 16px; font-size: 14px; border-bottom: 1px solid var(--border-light);
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table td:first-child { font-weight: 600; color: var(--text-secondary); }

/* ── Key considerations ──────────────────────────────────────────── */
.considerations-section { margin-bottom: 28px; }
.considerations-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.considerations-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.consideration-card {
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
}
.consideration-card .kc-title {
  font-size: 13px; font-weight: 700; color: var(--brand-dark);
  margin-bottom: 4px;
}
.consideration-card .kc-detail {
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
}

/* ── Cards (hospitals & packages) ────────────────────────────────── */
.cards-section { margin-bottom: 28px; }
.cards-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.cards-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.result-card {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); overflow: hidden;
  transition: box-shadow .15s, border-color .15s;
}
.result-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }

.card-image {
  width: 100%; height: 120px; object-fit: cover; background: var(--bg-subtle);
  display: block;
}
.card-body { padding: 14px 16px; }
.card-body .card-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 4px;
}
.card-body .card-location {
  font-size: 13px; color: var(--text-muted); margin-bottom: 8px;
}
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.card-tag {
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: 6px; background: var(--bg-subtle); color: var(--text-secondary);
}
.card-tag.price { background: var(--brand-bg); color: var(--brand-dark); }
.card-tag.rating { background: #fef3c7; color: #92400e; }

.card-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600; color: var(--brand);
}
.card-link:hover { text-decoration: underline; }

/* ── Citations ───────────────────────────────────────────────────── */
.citations-section { margin-bottom: 24px; }
.citations-section h3 { font-size: 14px; font-weight: 700; margin-bottom: 8px; color: var(--text-muted); }
.citations-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.citations-list li {
  font-size: 13px; color: var(--text-secondary); padding: 6px 10px;
  border-left: 3px solid var(--brand-light); background: var(--brand-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── Next actions ────────────────────────────────────────────────── */
.next-actions { margin-bottom: 28px; }
.next-actions h3 { font-size: 14px; font-weight: 700; margin-bottom: 8px; color: var(--text-muted); }
.next-actions ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.next-actions li {
  font-size: 14px; color: var(--text-secondary);
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--bg-subtle); border: 1px solid var(--border-light);
}
.next-actions li::before {
  content: '→ '; color: var(--brand); font-weight: 700;
}

/* ── Salus CTA ───────────────────────────────────────────────────── */
.salus-cta { margin-top: 12px; }
.salus-cta-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 20px 24px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand-bg), #e0f7f5);
  border: 1px solid var(--brand-light);
}
.salus-cta-inner strong { font-size: 15px; color: var(--text); }
.salus-cta-inner p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.salus-cta-inner button {
  padding: 12px 28px; border: none; border-radius: var(--radius-sm);
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 700;
  font-family: var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
.salus-cta-inner button:hover { background: var(--brand-dark); }

/* ── Disclaimer ──────────────────────────────────────────────────── */
.disclaimer {
  max-width: 880px; margin: 0 auto; padding: 20px 24px 40px;
  text-align: center;
}
.disclaimer p { font-size: 12px; color: var(--text-muted); }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
  .rail { position: static; }
  .sources-rail { order: 3; }
  .answer-panel { order: 1; }
  .links-rail { order: 2; }
  .quick-links-list {
    flex-direction: row; flex-wrap: wrap;
  }
  .quick-link-card { flex: 1; min-width: 180px; max-width: 240px; }
}

@media (max-width: 640px) {
  .topnav { display: none; }
  .hero { padding: 60px 16px 40px; }
  .hero-title { font-size: 26px; }
  .hero-examples { display: none; }
  .results-container { padding: 12px 12px 40px; }
  .cards-row { grid-template-columns: 1fr; }
  .salus-cta-inner { flex-direction: column; text-align: center; }
  .compare-table th, .compare-table td { padding: 8px 10px; font-size: 13px; }
}
