/* Medicine AI — light clinical palette & layout */

:root {
  /* Surfaces — clean paper & soft slate */
  --bg-base: #f1f5f9;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #ffffff;
  --bg-chat: #f8fafc;
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(13, 148, 136, 0.35);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* Medicine category hues — slightly deeper for contrast on light UI */
  --hue-uses: #059669;
  --hue-dosage: #0284c7;
  --hue-timing: #7c3aed;
  --hue-effects: #ea580c;
  --hue-severity: #dc2626;
  --hue-advantage: #0d9488;
  --hue-safety: #0369a1;
  --hue-interaction: #4338ca;

  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-dim: rgba(13, 148, 136, 0.12);
  --accent-glow: rgba(13, 148, 136, 0.18);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 4px 24px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --font-sans: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -15%, rgba(13, 148, 136, 0.14), transparent 52%),
    radial-gradient(ellipse 70% 50% at 100% 40%, rgba(14, 165, 233, 0.08), transparent 48%),
    radial-gradient(ellipse 55% 45% at 0% 85%, rgba(124, 58, 237, 0.05), transparent 42%);
  background-attachment: fixed;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

/* Layout shell */
.app-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

/* Header */
.site-header {
  text-align: center;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.lang-switcher__label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.lang-switcher__select {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  min-width: 10rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  text-align: left;
}

.site-header .brand {
  justify-content: center;
  flex-wrap: wrap;
}

.brand-centered {
  justify-content: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, #14b8a6 0%, var(--accent) 100%);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  box-shadow: 0 6px 20px var(--accent-glow);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.tagline {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 42ch;
  margin-left: auto;
  margin-right: auto;
}

/* Main tabs (home) */
.tabs {
  margin-bottom: 0.25rem;
}

.tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.35rem;
  margin-bottom: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.tabs-tab {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tabs-tab:hover {
  color: var(--text-primary);
  background: rgba(15, 23, 42, 0.04);
}

.tabs-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tabs-tab[aria-selected="true"] {
  color: var(--text-primary);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--border-subtle);
}

.tabs-panels .tab-panel[hidden] {
  display: none;
}

/* Category legend — medicine color key */
.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-swatch.uses { background: var(--hue-uses); }
.legend-swatch.dosage { background: var(--hue-dosage); }
.legend-swatch.timing { background: var(--hue-timing); }
.legend-swatch.effects { background: var(--hue-effects); }
.legend-swatch.severity { background: var(--hue-severity); }
.legend-swatch.advantage { background: var(--hue-advantage); }
.legend-swatch.safety { background: var(--hue-safety); }
.legend-swatch.interaction { background: var(--hue-interaction); }
.legend-swatch.questions { background: #0891b2; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.25rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.card:hover {
  border-color: rgba(15, 23, 42, 0.12);
  background: var(--bg-card-hover);
}

.card-title {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title::before {
  content: "";
  width: 4px;
  height: 1rem;
  border-radius: 2px;
  background: var(--accent);
}

.card-hint {
  margin: -0.35rem 0 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.legend--in-card {
  margin-top: 0;
  margin-bottom: 1rem;
  justify-content: flex-start;
}

.legend--disease {
  background: rgba(14, 165, 233, 0.04);
  border-color: rgba(14, 165, 233, 0.12);
}

.legend--interaction {
  background: rgba(67, 56, 202, 0.06);
  border-color: rgba(67, 56, 202, 0.14);
}

/* Search form */
.search-form {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.search-form input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-form input[type="text"]::placeholder {
  color: var(--text-muted);
}

.search-form input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.35rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(180deg, #14b8a6 0%, var(--accent) 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #2dd4bf 0%, #14b8a6 100%);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border-strong);
}

.btn-ghost:hover {
  background: var(--accent-dim);
}

/* Chat */
.chat-card .card-title::before {
  background: linear-gradient(180deg, #38bdf8, #0ea5e9);
}

.interaction-card .card-title::before {
  background: linear-gradient(180deg, #818cf8, var(--hue-interaction));
}

.interaction-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.interaction-output {
  min-height: 160px;
  max-height: 380px;
}

.interaction-output:empty {
  display: none;
}

.interaction-output:not(:empty) {
  display: block;
}

.interaction-input-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.interaction-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.interaction-textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 5.5rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.interaction-textarea:focus {
  border-color: var(--hue-interaction);
  box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.12);
}

.interaction-input-block .btn-primary {
  align-self: flex-start;
  background: linear-gradient(180deg, #6366f1 0%, var(--hue-interaction) 100%);
  box-shadow: 0 4px 14px rgba(67, 56, 202, 0.22);
}

.interaction-input-block .btn-primary:hover {
  background: linear-gradient(180deg, #818cf8 0%, #4f46e5 100%);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 280px;
}

.chat-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.btn-chat-secondary {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.chat-output {
  flex: 1;
  min-height: 200px;
  max-height: 420px;
  overflow-y: auto;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-chat);
  border: 1px solid var(--border-subtle);
  scroll-behavior: smooth;
}

.chat-output::-webkit-scrollbar {
  width: 8px;
}

.chat-output::-webkit-scrollbar-track {
  background: transparent;
}

.chat-output::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.35);
  border-radius: 4px;
}

.chat-row {
  margin-bottom: 0.75rem;
  animation: fadeIn 0.25s ease;
}

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

.msg {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  max-width: 92%;
  font-size: 0.95rem;
  line-height: 1.55;
}

.msg-user {
  margin-left: auto;
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  text-align: left;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.28);
}

.msg-bot {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  max-width: 100%;
  padding: 0;
  overflow: hidden;
}

.msg-bot-inner {
  padding: 0.75rem 0.85rem;
}

.msg-bot.loading {
  color: var(--text-muted);
  font-style: italic;
  padding: 0.75rem 1rem;
}

.msg-bot.loading .loading-status-text {
  font-style: normal;
  color: var(--text-secondary);
  display: block;
  line-height: 1.45;
  min-height: 2.75em;
}

/* Color-coded assistant sections (match legend) */
.chat-section {
  margin-bottom: 0.55rem;
  padding: 0.65rem 0.75rem 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-left: 4px solid var(--section-accent, #94a3b8);
  background: var(--section-bg, rgba(248, 250, 252, 0.95));
}

.chat-section:last-child {
  margin-bottom: 0;
}

.chat-section-title {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--section-accent, #64748b);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.chat-section-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--section-accent);
  flex-shrink: 0;
}

.chat-section-body {
  font-size: 0.9rem;
  line-height: 1.58;
  color: var(--text-secondary);
}

.chat-section-body p {
  margin: 0 0 0.45rem;
}

.chat-section-body p:last-child {
  margin-bottom: 0;
}

.chat-section-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Markdown tables — drug interactions (6-col: Drug, Interacts With, Type, Effect, Severity, Advice) */
.table-wrap {
  margin: 0.5rem 0 0;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(37, 99, 235, 0.25);
  background: #ffffff;
}

.interaction-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.4;
  table-layout: auto;
}

.interaction-table thead th {
  text-align: center;
  padding: 0.65rem 0.5rem;
  background: #2563eb;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  border: 1px solid #1d4ed8;
}

.interaction-table tbody tr {
  background: #ffffff;
}

.interaction-table th[scope="row"],
.interaction-table td {
  padding: 0.55rem 0.5rem;
  border: 1px solid #e2e8f0;
  vertical-align: middle;
  text-align: center;
  color: #334155;
}

.interaction-table th[scope="row"] {
  font-weight: 600;
  color: #0f172a;
}

.interaction-table tbody tr:last-child th,
.interaction-table tbody tr:last-child td {
  border-bottom: 1px solid #e2e8f0;
}

/* Severity column — color by level (keyword match in cell text) */
.interaction-table__cell--severity {
  font-weight: 600;
}

.interaction-table__cell--severity-high {
  background: #fef2f2 !important;
  color: #991b1b;
  border-color: #fecaca !important;
}

.interaction-table__cell--severity-high strong {
  color: #7f1d1d;
  font-weight: 700;
}

.interaction-table__cell--severity-moderate {
  background: #fffbeb !important;
  color: #b45309;
  border-color: #fde68a !important;
}

.interaction-table__cell--severity-moderate strong {
  color: #92400e;
  font-weight: 700;
}

.interaction-table__cell--severity-low {
  background: #f0fdf4 !important;
  color: #166534;
  border-color: #bbf7d0 !important;
}

.interaction-table__cell--severity-low strong {
  color: #14532d;
  font-weight: 700;
}

.interaction-table__cell--severity-unknown {
  background: #f8fafc !important;
  color: #475569;
  border-color: #e2e8f0 !important;
}

.interaction-table__cell--severity-unknown strong {
  color: #334155;
  font-weight: 700;
}

.interaction-table__cell--effect {
  text-align: center;
}

.interaction-table__cell--advice {
  font-weight: 600;
  color: #0f172a;
}

.chat-section--uses {
  --section-accent: var(--hue-uses);
  --section-bg: rgba(5, 150, 105, 0.08);
}

.chat-section--dosage {
  --section-accent: var(--hue-dosage);
  --section-bg: rgba(2, 132, 199, 0.07);
}

.chat-section--timing {
  --section-accent: var(--hue-timing);
  --section-bg: rgba(124, 58, 237, 0.07);
}

.chat-section--effects {
  --section-accent: var(--hue-effects);
  --section-bg: rgba(234, 88, 12, 0.07);
}

.chat-section--severity {
  --section-accent: var(--hue-severity);
  --section-bg: rgba(220, 38, 38, 0.06);
}

.chat-section--advantage {
  --section-accent: var(--hue-advantage);
  --section-bg: rgba(13, 148, 136, 0.07);
}

.chat-section--safety {
  --section-accent: var(--hue-safety);
  --section-bg: rgba(3, 105, 161, 0.07);
}

.chat-section--interaction {
  --section-accent: var(--hue-interaction);
  --section-bg: rgba(67, 56, 202, 0.07);
}

.chat-section--questions {
  --section-accent: #0891b2;
  --section-bg: rgba(8, 145, 178, 0.09);
}

/* Standalone block for drug interactions (never merged with Safety) */
.chat-section[data-section="drug-interactions"] {
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
  border-width: 1px;
  border-color: rgba(67, 56, 202, 0.22);
  box-shadow: 0 4px 20px rgba(67, 56, 202, 0.1);
}

.chat-section[data-section="drug-interactions"] .chat-section-title {
  font-size: 0.78rem;
}

.chat-section--general,
.chat-section--plain {
  --section-accent: #64748b;
  --section-bg: rgba(241, 245, 249, 0.9);
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chat-input-row textarea {
  flex: 1;
  min-width: 180px;
  min-height: 2.75rem;
  max-height: 10rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-row textarea:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.chat-input-row .btn-primary {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Emergency / crisis — not a substitute for 911 */
.emergency-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, #fef2f2 0%, #fff1f2 100%);
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(185, 28, 28, 0.12);
}

.emergency-banner__inner {
  max-width: 920px;
  margin: 0 auto;
}

.emergency-banner__title {
  display: block;
  color: #991b1b;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.emergency-banner__text {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.emergency-banner__dismiss {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

/* FDA / openFDA reference links */
.sources-panel {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.sources-panel--page {
  margin-top: 0;
  margin-bottom: 1rem;
}

.sources-panel__title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #1d4ed8;
}

.sources-panel__list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.sources-panel__list a {
  font-weight: 600;
}

.sources-panel__note {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.rag-note {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.65rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-secondary);
  background: rgba(124, 58, 237, 0.06);
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: var(--radius-sm);
}

.msg-bot-inner .rag-note {
  margin-top: 0.75rem;
}

/* Response completeness (heuristic % — see note in UI) */
.ai-score {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.08) 0%, rgba(14, 165, 233, 0.06) 100%);
  border: 1px solid rgba(13, 148, 136, 0.2);
}

.ai-score--chat {
  margin-bottom: 0.65rem;
}

.ai-score--result {
  margin-bottom: 1rem;
}

.ai-score__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.ai-score__title-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 0;
}

.ai-score__title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ai-score__est {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  opacity: 0.85;
}

.ai-score__pct {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.ai-score__bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
  margin-bottom: 0.45rem;
}

.ai-score__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #14b8a6 0%, #0d9488 45%, #0ea5e9 100%);
  transition: width 0.35s ease;
}

.ai-score__note {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--text-muted);
}

/* Disclaimer */
.disclaimer {
  margin: 1.5rem 0 0;
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
  background: #fef2f2;
  border: 1px solid rgba(220, 38, 38, 0.18);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--hue-severity);
}

.disclaimer strong {
  color: #b91c1c;
}

/* Result page (medicine.php) */
.result-page .site-header {
  margin-bottom: 1.5rem;
}

.result-hero {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.result-hero-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, #0ea5e9, var(--hue-dosage));
  display: grid;
  place-items: center;
  font-size: 1.75rem;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.result-hero h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.result-hero .sub {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.result-body {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  background: var(--bg-chat);
  border: 1px solid var(--border-subtle);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.result-body .chat-section {
  margin-bottom: 0.65rem;
}

.result-body .chat-section:last-child {
  margin-bottom: 0;
}

.result-body--formatted {
  min-height: 3rem;
}

.result-actions {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  transition: background 0.2s, border-color 0.2s;
}

.back-link:hover {
  background: var(--accent-dim);
  border-color: var(--border-strong);
  color: var(--accent-hover);
}

.site-footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 540px) {
  .app-shell {
    padding: 1.25rem 1rem 2rem;
  }

  .legend {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-form {
    flex-direction: column;
  }

  .search-form .btn-primary {
    width: 100%;
  }
}
