/* ─────────────────────────────────────────────
   All American Contractors LLC — chatbot.css
   ───────────────────────────────────────────── */

#chatWidget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  font-family: var(--font-body);
}

/* ── Launcher bubble ── */
.chat-launcher {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(200,16,46,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.chat-launcher:hover {
  background: var(--red-dark);
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(200,16,46,0.55);
}
.chat-launcher-icon svg { width: 24px; height: 24px; display: block; }
.chat-launcher-x { font-size: 1.6rem; line-height: 1; }

/* Unread badge */
.chat-badge {
  position: absolute;
  top: -3px; right: -3px;
  width: 16px; height: 16px;
  background: #FFB800;
  border-radius: 50%;
  border: 2px solid var(--white);
  display: none;
}
.chat-badge.visible { display: block; }

/* ── Panel ── */
.chat-panel {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 370px;
  max-height: 580px;
  background: #0D1F38;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 16px 60px rgba(0,0,0,0.5);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 4px;
}
.chat-panel.open { display: flex; }

/* ── Header ── */
.chat-header {
  background: #0B1A2F;
  border-bottom: 2px solid var(--red);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat-header-left { display: flex; align-items: center; gap: 10px; }
.chat-avatar {
  width: 38px; height: 38px; background: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--white); font-weight: bold; flex-shrink: 0;
}
.chat-header-name { font-size: 0.85rem; font-weight: 500; color: var(--white); letter-spacing: 0.03em; }
.chat-header-status {
  font-size: 0.68rem; color: #6A8099;
  display: flex; align-items: center; gap: 5px; margin-top: 2px;
}
.chat-dot { width: 6px; height: 6px; border-radius: 50%; background: #3DBA72; display: inline-block; }
.chat-header-close {
  background: none; border: none; color: #6A8099;
  font-size: 1.4rem; cursor: pointer; line-height: 1; transition: color 0.2s; padding: 0;
}
.chat-header-close:hover { color: var(--white); }

/* ── Messages ── */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }

.msg-bot, .msg-user { display: flex; flex-direction: column; gap: 4px; }
.msg-bot  { align-items: flex-start; }
.msg-user { align-items: flex-end; }

.bubble { max-width: 88%; padding: 10px 14px; font-size: 0.88rem; line-height: 1.55; }
.bubble-bot  { background: #152D50; color: #C8D8E8; border-radius: 0 10px 10px 10px; }
.bubble-user { background: var(--red); color: var(--white); border-radius: 10px 10px 0 10px; }
.msg-time { font-size: 0.62rem; color: #4A6580; letter-spacing: 0.05em; }

/* ── Options ── */
.chat-options { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.chat-option-btn {
  background: transparent; border: 1px solid rgba(200,16,46,0.4);
  color: #A8C0D8; padding: 9px 14px; font-family: var(--font-body);
  font-size: 0.82rem; text-align: left; cursor: pointer;
  transition: all 0.18s; border-radius: 6px;
}
.chat-option-btn:hover { border-color: var(--red); background: rgba(200,16,46,0.12); color: var(--white); }
.chat-option-btn.selected { border-color: var(--red); background: rgba(200,16,46,0.18); color: var(--white); pointer-events: none; }
.chat-option-btn:disabled { opacity: 0.45; pointer-events: none; }

/* ── Multi-select chips ── */
.chat-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.chat-chip {
  background: transparent; border: 1px solid rgba(200,16,46,0.35);
  color: #A8C0D8; padding: 7px 12px; font-family: var(--font-body);
  font-size: 0.78rem; cursor: pointer; border-radius: 20px; transition: all 0.18s;
}
.chat-chip:hover { border-color: var(--red); color: var(--white); }
.chat-chip.on { background: var(--red); border-color: var(--red); color: var(--white); }
.chip-confirm-btn {
  background: #152D50; border: 1px solid rgba(255,255,255,0.15);
  color: #A8C0D8; padding: 8px 16px; font-family: var(--font-body);
  font-size: 0.78rem; cursor: pointer; border-radius: 6px;
  margin-top: 6px; transition: all 0.18s; width: 100%;
}
.chip-confirm-btn:hover { border-color: var(--red); color: var(--white); }

/* ── Typing indicator ── */
.typing-bubble {
  background: #152D50; border-radius: 0 10px 10px 10px;
  padding: 12px 16px; display: flex; gap: 5px; align-items: center;
}
.typing-dot {
  width: 6px; height: 6px; background: #6A8099;
  border-radius: 50%; animation: typingBounce 1.1s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%,60%,100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* ── Summary card ── */
.summary-card {
  background: #0B1A2F; border: 1px solid rgba(200,16,46,0.3);
  border-left: 3px solid var(--red); padding: 12px 14px; border-radius: 4px; margin-top: 4px;
}
.summary-row {
  display: flex; justify-content: space-between;
  font-size: 0.78rem; padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05); gap: 8px;
}
.summary-row:last-child { border-bottom: none; }
.summary-label { color: #6A8099; flex-shrink: 0; }
.summary-val { color: #C8D8E8; text-align: right; }

/* ── Contact form inside chat ── */
.chat-input-area {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 14px; flex-shrink: 0; background: #0B1A2F;
}
.chat-field-group { display: flex; flex-direction: column; gap: 8px; }
.chat-field { display: flex; flex-direction: column; gap: 3px; }
.chat-field label {
  font-size: 0.62rem; letter-spacing: 0.15em; text-transform: uppercase;
  color: #4A6580; font-weight: 500; margin-bottom: 0;
}
.chat-field input,
.chat-field textarea {
  background: #152D50; border: 1px solid rgba(255,255,255,0.1);
  color: var(--white); padding: 9px 12px; font-family: var(--font-body);
  font-size: 0.85rem; border-radius: 4px; width: 100%; outline: none; transition: border-color 0.2s;
}
.chat-field input:focus,
.chat-field textarea:focus { border-color: var(--red); }
.chat-field textarea { resize: none; min-height: 56px; }
.chat-submit-btn {
  background: var(--red); color: var(--white); border: none; width: 100%;
  padding: 12px; font-family: var(--font-body); font-size: 0.78rem; font-weight: 500;
  letter-spacing: 0.15em; text-transform: uppercase; cursor: pointer;
  margin-top: 8px; border-radius: 4px; transition: background 0.2s;
}
.chat-submit-btn:hover { background: var(--red-dark); }

@media (max-width: 420px) {
  .chat-panel { width: calc(100vw - 24px); right: -4px; }
  #chatWidget { bottom: 16px; right: 12px; }
}
