/* ============================================================
   Contractor ChatBot UI — clean, mobile-first design
   Colors use orange (warmth/HVAC) — swap to blue for plumbing,
   yellow for electrical in their respective templates.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f4f8;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 20px 10px;
}

.chat-container {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 600px;
  max-height: 90vh;
}

/* ---- Header ---- */
.chat-header {
  background: linear-gradient(135deg, var(--brand), #f48c06);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-icon { font-size: 28px; }
.header-text { flex: 1; }
.header-text h1 { font-size: 16px; font-weight: 700; line-height: 1.2; }
.header-text .tagline { font-size: 12px; opacity: 0.85; margin-top: 2px; }
.header-phone a {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255,255,255,0.2);
  padding: 6px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.header-phone a:hover { background: rgba(255,255,255,0.35); }

/* ---- Messages ---- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.message { display: flex; flex-direction: column; max-width: 85%; }
.bot-message { align-self: flex-start; }
.user-message { align-self: flex-end; }

.message-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.bot-message .message-bubble {
  background: #f1f3f5;
  color: #212529;
  border-bottom-left-radius: 4px;
}
.user-message .message-bubble {
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.message-time {
  font-size: 11px;
  color: #adb5bd;
  margin-top: 3px;
  padding: 0 4px;
}
.bot-message .message-time { align-self: flex-start; }
.user-message .message-time { align-self: flex-end; }

/* ---- Typing indicator ---- */
.typing-indicator {
  padding: 8px 20px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.typing-indicator span {
  width: 8px; height: 8px;
  background: #adb5bd;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* ---- Quick replies ---- */
.quick-replies {
  padding: 0 16px 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.quick-btn {
  background: #fff;
  border: 1.5px solid var(--brand);
  color: var(--brand);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.quick-btn:hover { background: var(--brand); color: #fff; }

/* ---- Input area ---- */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e9ecef;
  background: #fff;
}
#user-input {
  flex: 1;
  border: 1.5px solid #dee2e6;
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.4;
  font-family: inherit;
  transition: border-color 0.15s;
}
#user-input:focus { border-color: var(--brand); }
.send-btn {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px; height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.send-btn:hover { background: var(--brand-dark); }
.send-btn:disabled { background: #adb5bd; cursor: default; }

/* ---- Footer ---- */
.chat-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border-top: 1px solid #e9ecef;
  background: #f8f9fa;
}
.reset-btn {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
}
.reset-btn:hover { color: var(--brand); }
.powered-by { font-size: 11px; color: #adb5bd; }

/* ---- Responsive ---- */
@media (max-width: 500px) {
  body { padding: 0; }
  .chat-container {
    border-radius: 0;
    min-height: 100vh;
    max-height: 100vh;
  }
}
