/* WhatSupple – Natural & calm theme */

:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-alt: #f5f0e8;
  --border: #e8e2d9;
  --text: #2d2a26;
  --text-muted: #6b6560;
  --accent: #4a7c59;
  --accent-hover: #3d6b4a;
  --accent-soft: rgba(74, 124, 89, 0.12);
  --user-bg: #6b9080;
  --assistant-bg: #ffffff;
  --radius: 16px;
  --font: "Nunito", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

.header {
  flex-shrink: 0;
  padding: 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
  background: var(--surface);
}

.header h1.header-logo {
  margin: 0;
  line-height: 0;
}

.header .logo-img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 72px;
  object-fit: contain;
}

.main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.25rem 1.75rem;
  overflow: hidden;
}

.chat-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.message {
  display: flex;
  width: 100%;
}

.message.user {
  justify-content: flex-end;
}

.message.user .bubble {
  background: var(--user-bg);
  color: #fff;
  border-radius: var(--radius) var(--radius) 8px var(--radius);
  max-width: 85%;
  box-shadow: 0 2px 8px rgba(107, 144, 128, 0.25);
}

.message.assistant .bubble {
  background: var(--assistant-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) var(--radius) 8px;
  max-width: 90%;
  box-shadow: 0 2px 12px rgba(45, 42, 38, 0.06);
}

.bubble {
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  line-height: 1.65;
}

.bubble p {
  margin: 0 0 0.5rem 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble p:last-child {
  margin-bottom: 0;
}

/* Markdown inside assistant bubbles */
.bubble-content.markdown {
  line-height: 1.65;
  word-break: break-word;
}

.bubble-content.markdown > *:first-child {
  margin-top: 0;
}

.bubble-content.markdown > *:last-child {
  margin-bottom: 0;
}

.bubble-content.markdown p {
  margin: 0 0 0.5rem 0;
}

.bubble-content.markdown p:last-child {
  margin-bottom: 0;
}

.bubble-content.markdown h1,
.bubble-content.markdown h2,
.bubble-content.markdown h3,
.bubble-content.markdown h4 {
  margin: 1rem 0 0.5rem 0;
  font-weight: 600;
}

.bubble-content.markdown h1 { font-size: 1.25rem; }
.bubble-content.markdown h2 { font-size: 1.1rem; }
.bubble-content.markdown h3,
.bubble-content.markdown h4 { font-size: 1rem; }

.bubble-content.markdown ul,
.bubble-content.markdown ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.bubble-content.markdown li {
  margin: 0.25rem 0;
}

.bubble-content.markdown pre {
  margin: 0.5rem 0;
  padding: 0.75rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
}

.bubble-content.markdown code {
  font-family: ui-monospace, monospace;
  font-size: 0.9em;
}

.bubble-content.markdown pre code {
  padding: 0;
  background: none;
}

.bubble-content.markdown blockquote {
  margin: 0.5rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
}

.bubble-content.markdown a {
  color: var(--accent);
  text-decoration: none;
}

.bubble-content.markdown a:hover {
  text-decoration: underline;
}

.bubble-content.markdown hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.75rem 0;
}

.recommendations-card {
  margin-top: 0.85rem;
  padding: 1.15rem 1.25rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(45, 42, 38, 0.04);
}

.recommendations-card h4 {
  margin: 0 0 0.85rem 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.plan-card .plan-section {
  margin-top: 1.1rem;
}

.plan-card .plan-section:first-of-type {
  margin-top: 0.5rem;
}

.plan-section-title {
  margin: 0 0 0.5rem 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.plan-details {
  display: block;
  margin-top: 0.25rem;
}

.plan-summary {
  display: block;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.plan-summary::-webkit-details-marker {
  display: none;
}

.rec-item {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.rec-item:last-child {
  border-bottom: none;
}

.rec-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.rec-name {
  font-weight: 600;
}

.rec-link {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
}

.rec-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.rec-details {
  margin-top: 0.35rem;
}

.rec-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.rec-summary::-webkit-details-marker {
  display: none;
}

.rec-summary::before {
  content: "▶ ";
  font-size: 0.65rem;
  vertical-align: middle;
}

.rec-details[open] .rec-summary::before {
  content: "▼ ";
}

.rec-details-body {
  margin-top: 0.35rem;
  padding-left: 1rem;
}

.rec-reason,
.rec-dose {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.25rem 0;
}

.rec-dose:last-child {
  margin-bottom: 0;
}

/* Inline options: appear in the chat flow after assistant messages */
.inline-options {
  width: 100%;
  max-width: 90%;
  padding: 0.5rem 0 1rem 0;
  margin-bottom: 0.25rem;
}

.inline-options-label {
  margin: 0 0 0.5rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.inline-options-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.inline-options .continue-btn {
  margin-top: 0;
}

.quick-actions {
  padding: 0.9rem 0;
  border-top: 1px solid var(--border);
}

.quick-actions-label {
  margin: 0 0 0.55rem 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.quick-actions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.quick-btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.quick-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.quick-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.continue-btn {
  margin-top: 0.5rem;
  padding: 0.65rem 1.3rem;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

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

.continue-btn.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.input-area {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.input-area.hidden {
  display: none !important;
}

.get-products-row {
  margin-top: 0.85rem;
}

.get-products-label {
  margin: 0 0 0.5rem 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.input-row {
  display: flex;
  gap: 0.55rem;
  align-items: flex-end;
}

#user-input {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: none;
}

#user-input::placeholder {
  color: var(--text-muted);
}

#user-input:focus {
  outline: none;
  border-color: var(--accent);
}

.send-btn {
  padding: 0.65rem 1.3rem;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
}

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

.send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.loading {
  color: var(--text-muted);
  font-style: italic;
}

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

.error-bubble .bubble {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

/* Footer */
.footer {
  flex-shrink: 0;
  padding: 0.85rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
}

.footer-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.footer-made {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-heart {
  color: var(--accent);
  font-weight: 700;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.footer-link {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--accent);
}

.footer-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.footer-icon {
  color: currentColor;
  transition: color 0.2s;
}

.footer-info-wrap {
  position: relative;
}

.footer-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: help;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.footer-info-btn:hover,
.footer-info-btn:focus {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.footer-info-tooltip {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  right: 0;
  width: 280px;
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(45, 42, 38, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 20;
}

.footer-info-wrap:hover .footer-info-tooltip,
.footer-info-btn:focus + .footer-info-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Keep tooltip visible when focusing for keyboard users */
.footer-info-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
