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

:root {
  --bg-dark:       #1a1412;
  --bg-sidebar:    #211a16;
  --bg-chat:       #1e1714;
  --bg-input:      #2a211b;
  --bg-user-msg:   #c2703a;
  --bg-bot-msg:    #2e2420;
  --text-primary:  #f5ebe0;
  --text-secondary:#b8a99a;
  --text-muted:    #8a7b6d;
  --accent:        #e8913a;
  --accent-hover:  #f0a050;
  --border:        #3a2e26;
  --online-green:  #4ade80;
  --radius:        12px;
  --radius-sm:     8px;
  --font:          'Inter', system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── App Layout ──────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.business-card {
  text-align: center;
  padding: 32px 24px 24px;
  border-bottom: 1px solid var(--border);
}

.logo-placeholder {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--accent), #d4622a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  box-shadow: 0 4px 20px rgba(232, 145, 58, .25);
}

.business-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.business-tagline {
  font-size: .85rem;
  color: var(--text-secondary);
}

/* Info rows */
.info-section { padding: 20px 24px; flex: 1; }

.info-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }

.info-icon { font-size: 1.25rem; margin-top: 2px; }
.info-label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 2px; }
.info-value { display: block; font-size: .88rem; color: var(--text-secondary); line-height: 1.45; }
.info-link  { font-size: .88rem; font-weight: 500; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  font-size: .72rem;
  color: var(--text-muted);
  text-align: center;
}
.sidebar-footer strong { color: var(--accent); font-weight: 600; }

/* ── Chat Area ───────────────────────────────────── */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-chat);
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
}
.chat-header-left { display: flex; align-items: center; gap: 12px; }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
}

.header-avatar {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent), #d4622a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.header-name { font-size: .95rem; font-weight: 600; }

.header-status {
  font-size: .75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--online-green);
  display: inline-block;
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* Messages Container */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}

/* Scrollbar */
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Message Bubbles */
.message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 78%;
  animation: fadeSlideIn .3s ease;
}
.message-row.user { align-self: flex-end; flex-direction: row-reverse; }
.message-row.bot  { align-self: flex-start; }

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

.bot-avatar {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--accent), #d4622a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.bubble {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: .9rem;
  line-height: 1.55;
  position: relative;
  word-break: break-word;
}

.message-row.bot .bubble {
  background: var(--bg-bot-msg);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}
.message-row.user .bubble {
  background: var(--bg-user-msg);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble .timestamp {
  display: block;
  font-size: .65rem;
  color: rgba(255,255,255,.45);
  margin-top: 4px;
  text-align: right;
}
.message-row.bot .bubble .timestamp { color: var(--text-muted); }

.bubble a { color: #ffd6a5; font-weight: 500; }
.message-row.user .bubble a { color: #ffe4c9; }

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 18px;
  background: var(--bg-bot-msg);
  border-radius: var(--radius);
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingDot 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: .15s; }
.typing-indicator span:nth-child(3) { animation-delay: .3s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Day divider */
.day-divider {
  text-align: center;
  font-size: .7rem;
  color: var(--text-muted);
  padding: 8px 0 4px;
  letter-spacing: .04em;
}

/* ── Input Area ──────────────────────────────────── */
.chat-input-area {
  padding: 12px 24px 10px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
}

#chatForm {
  display: flex;
  gap: 10px;
  align-items: center;
}

#chatInput {
  flex: 1;
  padding: 12px 18px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 24px;
  color: var(--text-primary);
  font-size: .92rem;
  font-family: var(--font);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#chatInput::placeholder { color: var(--text-muted); }
#chatInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 145, 58, .15);
}

#sendBtn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .1s;
  flex-shrink: 0;
}
#sendBtn:hover { background: var(--accent-hover); }
#sendBtn:active { transform: scale(.93); }

.input-footer {
  text-align: center;
  font-size: .68rem;
  color: var(--text-muted);
  padding-top: 8px;
}
.input-footer strong { color: var(--accent); font-weight: 600; }

/* ── Mobile Overlay ──────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 90;
}
.sidebar-overlay.active { display: block; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -320px;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: left .3s ease;
  }
  .sidebar.open { left: 0; }

  .mobile-menu-btn { display: block; }

  .chat-area { width: 100%; }

  .messages { padding: 16px 14px 8px; }
  .message-row { max-width: 90%; }

  .chat-input-area { padding: 10px 14px 8px; }

  .chat-header { padding: 12px 14px; }
}

@media (max-width: 400px) {
  .bubble { font-size: .84rem; padding: 9px 13px; }
  #chatInput { font-size: .86rem; padding: 10px 14px; }
}
