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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: #f0fdf4;
  background-image:
    radial-gradient(ellipse 80% 60% at 15% -10%, #bbf7d0 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 90% 110%, #a7f3d0 0%, transparent 55%),
    radial-gradient(ellipse 40% 40% at 60%  50%, #d1fae5 0%, transparent 60%);
  background-attachment: fixed;
}

/* ── Header ───────────────────────────────────────── */
.header {
  flex-shrink: 0;
  position: relative;
  z-index: 100;
  background: rgba(5, 46, 22, 0.96);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.05), 0 4px 24px rgba(0,0,0,0.25);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.header-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(34,197,94,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.logo-emoji { font-size: 1.25rem; line-height: 1; }

.header-text {
  min-width: 0;
  overflow: hidden;
}

.header-text h1 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-text p {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.6);
  margin-top: 1px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(74,222,128,0.3);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(74,222,128,0.3); }
  50%       { box-shadow: 0 0 0 5px rgba(74,222,128,0.15); }
}

/* Header action buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.hdr-book-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 22px;
  border: none;
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 14px rgba(34,197,94,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: all 0.22s cubic-bezier(0.34,1.56,0.64,1);
}

.hdr-book-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(34,197,94,0.6), inset 0 1px 0 rgba(255,255,255,0.2);
}

.hdr-book-btn:active { transform: scale(0.96); }

/* ── Chat area ────────────────────────────────────── */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 22px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Slim custom scrollbar */
.chat-area::-webkit-scrollbar          { width: 4px; }
.chat-area::-webkit-scrollbar-track    { background: transparent; }
.chat-area::-webkit-scrollbar-thumb    {
  background: rgba(21,128,61,0.25);
  border-radius: 4px;
}
.chat-area::-webkit-scrollbar-thumb:hover { background: rgba(21,128,61,0.45); }

/* ── Message rows ─────────────────────────────────── */
.message-row {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  max-width: 740px;
  opacity: 0;
  animation: msgIn 0.32s cubic-bezier(0.34,1.46,0.64,1) forwards;
}

.message-row.user-row {
  flex-direction: row-reverse;
  align-self: flex-end;
  max-width: 580px;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Bot avatar — initials badge */
.bot-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #14532d 0%, #15803d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(21,128,61,0.35);
}

.bot-avatar span {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #86efac;
}

/* ── Message bubbles ──────────────────────────────── */
.message-bubble {
  padding: 12px 16px;
  border-radius: 20px;
  line-height: 1.6;
  font-size: 0.875rem;
  word-break: break-word;
}

.bot-bubble {
  background: rgba(255,255,255,0.93);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(220,252,231,0.9);
  border-bottom-left-radius: 6px;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.04),
    0 4px 20px rgba(0,0,0,0.07),
    inset 0 1px 0 rgba(255,255,255,0.8);
  color: #1a2e1c;
}

.user-bubble {
  background: linear-gradient(135deg, #14532d 0%, #15803d 100%);
  color: #ffffff;
  border-bottom-right-radius: 6px;
  box-shadow:
    0 4px 18px rgba(21,128,61,0.38),
    0 1px 4px rgba(21,128,61,0.2);
}

/* Bot bubble typography */
.bot-bubble p           { margin-bottom: 8px; }
.bot-bubble p:last-child { margin-bottom: 0; }
.bot-bubble strong      { color: #14532d; font-weight: 700; }
.bot-bubble em          { font-style: italic; color: #166534; }
.bot-bubble h3          { color: #14532d; font-size: 0.88rem; font-weight: 700; margin: 10px 0 4px; }
.bot-bubble h4          { color: #15803d; font-size: 0.84rem; font-weight: 700; margin: 7px 0 3px; }
.bot-bubble ul,
.bot-bubble ol          { padding-left: 18px; margin: 6px 0; }
.bot-bubble li          { margin: 4px 0; }
.bot-bubble br          { content: ''; display: block; margin: 3px 0; }

.phone-link {
  color: #15803d;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px dashed rgba(21,128,61,0.4);
}
.phone-link:hover { border-bottom-style: solid; }

/* Image in chat */
.chat-image {
  max-width: 240px;
  max-height: 200px;
  border-radius: 12px;
  display: block;
  margin-top: 6px;
  object-fit: cover;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

/* Streaming cursor */
.cursor-blink {
  display: inline-block;
  color: #16a34a;
  font-weight: 300;
  animation: blink 0.9s step-end infinite;
  margin-left: 1px;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* Error bubble */
.error-bubble {
  background: #fef2f2 !important;
  border-color: #fecaca !important;
  color: #991b1b !important;
}

/* ── Quick chips ──────────────────────────────────── */
.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 43px;
  animation: msgIn 0.4s cubic-bezier(0.34,1.46,0.64,1) 0.12s both;
}

.chip {
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(134,239,172,0.7);
  color: #14532d;
  padding: 7px 15px;
  border-radius: 22px;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.chip:hover {
  background: #15803d;
  color: white;
  border-color: transparent;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 18px rgba(21,128,61,0.35);
}

.chip:active { transform: scale(0.97); }

/* ── Typing indicator ─────────────────────────────── */
.typing-row {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  animation: msgIn 0.25s ease both;
}

.typing-bubble {
  background: rgba(255,255,255,0.93);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(220,252,231,0.9);
  border-bottom-left-radius: 6px;
  border-radius: 20px;
  padding: 13px 18px;
  display: flex;
  gap: 5px;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07);
}

.typing-bubble span {
  width: 7px;
  height: 7px;
  background: #86efac;
  border-radius: 50%;
  animation: typePulse 1.4s ease-in-out infinite;
}

.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typePulse {
  0%, 70%, 100% { transform: translateY(0);   opacity: 0.4; }
  35%           { transform: translateY(-6px); opacity: 1; }
}

/* ── Image preview bar ────────────────────────────── */
.image-preview {
  display: none;
  flex-shrink: 0;
  padding: 8px 16px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(220,252,231,0.8);
  animation: slideUp 0.22s ease both;
}

.image-preview.visible { display: flex; }

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

.preview-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.preview-inner img {
  height: 52px;
  width: 64px;
  object-fit: cover;
  border-radius: 9px;
  border: 1.5px solid rgba(134,239,172,0.5);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.preview-title {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #14532d;
}

.preview-sub {
  display: block;
  font-size: 0.7rem;
  color: #6b7280;
  margin-top: 1px;
}

.remove-img-btn {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fee2e2;
  border: none;
  color: #dc2626;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.remove-img-btn:hover { background: #fecaca; }

/* ── Input area ───────────────────────────────────── */
.input-area {
  flex-shrink: 0;
  padding: 10px 14px;
  background: transparent;
}

.input-card {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(220,252,231,0.9);
  border-radius: 26px;
  padding: 7px 7px 7px 14px;
  box-shadow:
    0 4px 24px rgba(0,0,0,0.09),
    0 1px 6px rgba(0,0,0,0.05),
    inset 0 1px 0 rgba(255,255,255,0.7);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.input-card:focus-within {
  border-color: rgba(74,222,128,0.6);
  box-shadow:
    0 4px 28px rgba(0,0,0,0.1),
    0 0 0 3px rgba(74,222,128,0.12);
}

.attach-label {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f0fdf4;
  border: 1px solid rgba(134,239,172,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #16a34a;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.attach-label:hover {
  background: #dcfce7;
  border-color: #86efac;
  transform: scale(1.08);
}

#imageInput { display: none; }

#messageInput {
  flex: 1;
  border: none;
  background: transparent;
  padding: 7px 2px;
  font-size: 0.875rem;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  outline: none;
  line-height: 1.5;
  color: #1a2e1c;
}

#messageInput::placeholder { color: #9ca3af; }

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow:
    0 4px 14px rgba(21,128,61,0.5),
    0 0 0 2px rgba(21,128,61,0.1);
}

.send-btn:hover {
  transform: scale(1.12);
  box-shadow:
    0 6px 20px rgba(21,128,61,0.6),
    0 0 0 4px rgba(21,128,61,0.12);
}

.send-btn:active  { transform: scale(0.94); }
.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Booking chip highlight ───────────────────────── */
.chip-book {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border-color: rgba(34,197,94,0.5);
  font-weight: 600;
}

.chip-book:hover {
  background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
  box-shadow: 0 6px 20px rgba(21,128,61,0.4);
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 600px) {
  .header              { padding: 8px 12px; }
  .header-text h1      { font-size: 0.85rem; }
  .header-text p       { font-size: 0.66rem; }
  .hdr-book-btn span   { display: none; }
  .hdr-book-btn        { padding: 8px 10px; border-radius: 50%; }
  .hdr-book-btn svg    { width: 17px; height: 17px; }
  .chat-area           { padding: 14px 10px 10px; }
  .input-area          { padding: 8px 10px; }
  .message-bubble      { font-size: 0.83rem; }
  .quick-chips         { padding-left: 0; }
}
