/* ============================================================
   Bruges City Concierge — Chat UI Styles
   Mobile-first. Designed to work both as standalone page
   and inside an iframe (hotel widget).
   ============================================================ */

:root {
  --brand:        #1B3A6B;   /* overridden by JS with hotel brand color */
  --bg:           #ffffff;
  --surface:      #f8f8f8;
  --border:       #e0e0e0;
  --text:         #222222;
  --text-muted:   #888888;
  --bubble-ai:    #f0f0f0;
  --bubble-user:  var(--brand);
  --radius:       18px;
  --shadow:       0 2px 12px rgba(0, 0, 0, 0.08);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── SEO header (standalone mode only) ────────────────────── */
#seo-header {
  background: linear-gradient(135deg, var(--brand) 0%, #2a5298 100%);
  color: white;
  padding: 32px 20px 28px;
  text-align: center;
}

.seo-inner {
  max-width: 600px;
  margin: 0 auto;
}

#seo-header h1 {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 12px;
}

.seo-subtitle {
  font-size: 15px;
  opacity: 0.88;
  line-height: 1.6;
  margin-bottom: 20px;
}

.trust-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.chip {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

/* ── Chat container ─────────────────────────────────────────── */
#chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: var(--shadow);
}

/* When SEO header is shown, chat container fills remaining space */
#seo-header + #chat-container {
  height: calc(100vh - 180px);
  min-height: 480px;
}

/* ── Chat header ─────────────────────────────────────────────── */
#chat-header {
  background: var(--brand);
  color: white;
  padding: 16px 20px;
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-icon {
  flex-shrink: 0;
  opacity: 0.9;
}

#header-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ── Message list ────────────────────────────────────────────── */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

/* Scrollbar styling */
#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-track { background: transparent; }
#chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Chat bubbles ─────────────────────────────────────────────── */
.bubble {
  max-width: 84%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}

.bubble-assistant {
  background: var(--bubble-ai);
  color: var(--text);
  align-self: flex-start;
  border-radius: var(--radius) var(--radius) var(--radius) 4px;
}

.bubble-user {
  background: var(--brand);
  color: white;
  align-self: flex-end;
  border-radius: var(--radius) var(--radius) 4px var(--radius);
}

.welcome-bubble {
  background: var(--bubble-ai);
  color: var(--text);
  align-self: flex-start;
  border-radius: var(--radius) var(--radius) var(--radius) 4px;
}

/* ── Typing indicator ─────────────────────────────────────────── */
#typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 16px;
  flex-shrink: 0;
}

#typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite ease-in-out;
}

#typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
#typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* ── Input area ───────────────────────────────────────────────── */
#input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  line-height: 1.4;
  max-height: 120px;
  transition: border-color 0.2s;
  /* Mobile: prevent zoom on focus */
  font-size: 16px;
}

#chat-input:focus {
  border-color: var(--brand);
}

#chat-input::placeholder {
  color: var(--text-muted);
}

#send-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.1s;
}

#send-btn:hover  { opacity: 0.85; }
#send-btn:active { transform: scale(0.94); }
#send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Responsive — full screen on mobile ───────────────────────── */
@media (max-width: 480px) {
  html, body { overflow: hidden; }

  #chat-container {
    max-width: 100%;
    height: 100dvh;  /* dynamic viewport height accounts for mobile browser chrome */
    box-shadow: none;
  }

  #seo-header + #chat-container {
    height: calc(100dvh - 160px);
  }

  #seo-header {
    padding: 20px 16px 16px;
  }

  #seo-header h1 {
    font-size: 18px;
  }

  .trust-chips {
    gap: 6px;
  }

  .chip {
    font-size: 12px;
    padding: 5px 10px;
  }
}

/* ── Inside iframe — remove body margin, full height ─────────── */
@media (max-height: 700px) {
  #seo-header { display: none !important; }
  #chat-container { height: 100vh; }
}
