@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Raleway:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --bg: #f4f7fa; /* teal-50 equivalent */
  --surface: #ffffff;
  --surface-2: #eaf3f3; /* teal-100 equivalent */
  --surface-3: #d9e9e9; /* teal-200 equivalent */
  --border: rgba(15, 45, 45, 0.08); /* Dark teal with low opacity */
  --border-strong: rgba(15, 45, 45, 0.15);
  --text: #0f2d2d; /* Dark teal text */
  --muted: #3a5c5c; /* Muted teal */

  /* Spa / Wellness Primary (Teal) */
  --primary: #64b4b4; /* User requested accent */
  --primary-700: #4a8f8f; /* Slightly darker */
  --primary-50: #f0f7f7; /* Very light */
  --primary-100: #e0f0f0; /* Light */
  
  /* CTA / Accent */
  --cta: #8b5cf6; /* violet-500 */

  --danger: #e11d48; /* rose-600 */
  --focus: rgba(100, 180, 180, 0.35);

  --shadow: 0 4px 6px -1px rgba(15, 45, 45, 0.06), 0 2px 4px -2px rgba(15, 45, 45, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 45, 45, 0.05), 0 1px 2px -1px rgba(15, 45, 45, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(15, 45, 45, 0.08), 0 4px 6px -4px rgba(15, 45, 45, 0.05);

  --radius: 16px;
  --radius-sm: 12px;
  --max: 1400px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.shell {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.layout {
  display: flex;
  gap: 20px;
  height: 100%;
  min-height: 0;
}

.card {
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- Top bar ---- */
.topbar {
  flex-shrink: 0;
  background: rgba(244, 247, 250, 0.85); /* Matches new var(--bg) with opacity */
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--border-strong);
  position: relative;
  z-index: 50;
}
.topbar__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar__right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand__mark {
  width: 30px;
  height: 30px;
  color: var(--primary);
}
.brand__title {
  font-family: "Lora", serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 19px;
}
.brand__subtitle {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  min-height: 30px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--muted);
}
.status-pill[data-state="connected"] .status-dot { background: #10b981; }
.status-pill[data-state="error"] .status-dot { background: var(--danger); }

/* ---- Chat section ---- */
.chat {
  flex: 1;
  min-width: 0;
}

.chat__header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.h1 {
  margin: 0;
  font-family: "Lora", serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.h2 {
  margin: 0;
  font-family: "Lora", serif;
  font-size: 16px;
  font-weight: 600;
}

.banner {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 13px;
  line-height: 1.5;
}

/* ---- Messages area ---- */
.messages {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--bg) 0%, var(--surface-2) 100%);
  scroll-behavior: smooth;
}
.messages:focus { outline: none; }
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
.messages::-webkit-scrollbar-track { background: transparent; }

.chat__footer {
  padding: 14px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

/* ---- Message bubbles ---- */
.msg {
  display: flex;
  align-items: flex-start;
  max-width: 100%;
  animation: msg-in 0.25s ease-out;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg--user {
  justify-content: flex-end;
}

.msg__bubble {
  width: fit-content;
  max-width: 78%;
  padding: 11px 16px;
  border-radius: 18px;
  border: 1px solid transparent;
  font-size: 15px;
  line-height: 1.55;
}

.msg--assistant .msg__bubble {
  background: var(--surface);
  border-color: var(--border);
  border-top-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.msg--user .msg__bubble {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-700) 100%);
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(100, 180, 180, 0.25);
}
.msg--user .msg__role { display: none; }

.msg__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 3px;
}
.msg__role {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.msg__text p {
  margin: 0 0 0.85rem 0;
}
.msg__text p:last-child {
  margin-bottom: 0;
}
.msg__text ul, .msg__text ol {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}
.msg__text li {
  margin-bottom: 0.25rem;
}
.msg__text strong {
  font-weight: 700;
}
.msg__text em {
  font-style: italic;
}
.msg__text blockquote {
  margin: 0.5rem 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
}
.msg--user .msg__text blockquote {
  border-left-color: rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.85);
}
.msg__text code {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
}
.msg--user .msg__text code {
  background: rgba(255, 255, 255, 0.15);
}
.msg__text a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.msg--user .msg__text a {
  color: white;
  font-weight: 600;
}

/* ---- UI Components (carousel, chips, receipt) ---- */
.msg--ui {
  display: block;
  margin: 2px 0 10px;
  width: 100%;
  animation: msg-in 0.25s ease-out;
}

/* Carousel */
.carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scroll-snap-type: x mandatory;
}
.carousel::-webkit-scrollbar { height: 4px; }
.carousel::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.carousel__item {
  flex: 0 0 190px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  cursor: pointer;
  appearance: none;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}
.carousel__item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.2s;
}
.carousel__item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.carousel__item:hover::before {
  opacity: 1;
}

.carousel__icon {
  font-size: 22px;
  margin-bottom: 6px;
  line-height: 1;
}
.carousel__title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text);
  line-height: 1.3;
}
.carousel__meta {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.carousel__category {
  margin-top: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary);
  opacity: 0.75;
}

/* Package cards */
.carousel__item--package {
  flex: 0 0 220px;
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--surface) 100%);
  border-color: var(--primary-100);
}
.carousel__item--package:hover {
  border-color: var(--primary);
}
.carousel__desc {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Chips (time slots) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.chip {
  appearance: none;
  font-family: inherit;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-50);
  transform: translateY(-1px);
}

/* Suggestion chips (welcome & follow-up) */
.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 8px;
}
.suggestion-chip {
  appearance: none;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 9px 18px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.suggestion-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-50);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.suggestion-chip:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* Receipt */
.receipt {
  max-width: 300px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-top: 4px;
}
.receipt__head {
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 1.2px;
  margin-bottom: 14px;
  text-align: center;
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 10px;
}
.receipt__body { font-size: 14px; color: var(--text); }
.receipt__code {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  background: var(--surface-2);
  padding: 8px;
  border-radius: 6px;
}
.receipt__time {
  text-align: center;
  margin-bottom: 12px;
  font-weight: 500;
}
.receipt__items {
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* ---- Typing indicator ---- */
.typing-bubble {
  padding: 14px 22px !important;
  background: var(--surface) !important;
  border-color: var(--border) !important;
  border-top-left-radius: 4px !important;
  box-shadow: var(--shadow-sm) !important;
}
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 20px;
}
.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.35;
  animation: typing-bounce 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.32s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* ---- Composer ---- */
.helper {
  min-height: 18px;
  color: var(--muted);
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 500;
}
.helper:not(:empty) { display: inline-block; }

.composer {
  display: flex;
  gap: 10px;
  align-items: center;
}
.composer .icon-btn {
  min-height: 46px;
  min-width: 46px;
}
input[type="text"] {
  flex: 1;
  min-height: 46px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: all 0.2s;
}
input[type="text"]::placeholder { color: #94a3b8; }
input[type="text"]:focus-visible {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--focus);
}

/* ---- Buttons ---- */
button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}
button:hover { background: var(--surface-2); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.btn-icon { width: 20px; height: 20px; }

#sendBtn {
  min-height: 46px;
  padding: 0 22px;
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-700) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(100, 180, 180, 0.25);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
}
#sendBtn:hover {
  box-shadow: 0 6px 16px rgba(100, 180, 180, 0.35);
  transform: translateY(-1px);
}
#sendBtn:active { transform: translateY(1px); box-shadow: none; }

#micBtn {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
}
#micBtn[data-state="recording"] {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Icon buttons */
.icon-btn {
  min-height: 36px;
  min-width: 36px;
  padding: 0;
  border-radius: 99px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.icon-btn:focus-visible { background: var(--surface-2); box-shadow: 0 0 0 3px var(--focus); }
.icon { width: 20px; height: 20px; display: block; fill: currentColor; }

.icon-btn--reset { color: var(--muted); }
.icon-btn--reset:hover { color: var(--danger); background: #fef2f2; }

/* ---- Sidebar ---- */
.sidebar {
  width: 300px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.timeline-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.timeline-title {
  padding: 14px 18px;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}
.timeline__list {
  padding: 14px 18px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.timeline__item {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  align-items: start;
}
.timeline__dot {
  width: 9px; height: 9px;
  border-radius: 99px;
  margin-top: 6px;
  background: var(--muted);
  opacity: 0.3;
}
.timeline__item[data-status="start"] .timeline__dot {
  background: #3b82f6; opacity: 1;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.timeline__item[data-status="done"] .timeline__dot { background: #10b981; opacity: 1; }
.timeline__item[data-status="error"] .timeline__dot { background: var(--danger); opacity: 1; }
.timeline__text { font-size: 13px; color: var(--text); font-weight: 500; }
.timeline__sub { margin-top: 2px; font-size: 11px; color: var(--muted); line-height: 1.4; }

/* ---- Service with packages ---- */
.service-packages { padding: 8px 0; }
.service-packages__confirmed { margin-bottom: 12px; }
.service-packages__title { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.service-packages__item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: var(--primary-50); border-radius: var(--radius-sm); border: 1px solid var(--primary-100);
}
.service-packages__name { font-weight: 600; color: var(--primary-700); }
.service-packages__meta { font-size: 13px; color: var(--primary); }
.service-packages__related { margin-top: 16px; }
.service-packages__related .service-packages__title { margin-bottom: 10px; }
.carousel--packages { margin-top: 4px; }

/* ---- Utilities ---- */
.skip-link {
  position: absolute; left: -999px; top: 8px;
  padding: 10px 12px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.skip-link:focus-visible { left: 12px; outline: 2px solid var(--focus); outline-offset: 2px; }
.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;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; max-height: 260px; }
  .chat { height: auto; min-height: 50vh; }
  .messages { max-height: 60vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
