/* ============================================================
   BEST CREW CONSTRUCTION — CHATBOT v2 STYLES
   ============================================================ */

/* ── BUBBLE ─────────────────────────────────────────────────── */
#chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E07B1A, #F59332);
  box-shadow: 0 4px 24px rgba(224,123,26,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
#chat-bubble:hover { transform: scale(1.07); box-shadow: 0 6px 32px rgba(224,123,26,0.75); }
#chat-bubble:active { transform: scale(0.96); }
#chat-bubble svg { width: 26px; height: 26px; fill: #fff; }

.chat-notif {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 19px;
  height: 19px;
  background: #f44336;
  border-radius: 50%;
  border: 2px solid #080808;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
}

/* ── WINDOW ─────────────────────────────────────────────────── */
#chat-window {
  position: fixed;
  bottom: 94px;
  right: 24px;
  width: 368px;
  max-width: calc(100vw - 32px);
  background: #111111;
  border: 1px solid rgba(224,123,26,0.35);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.8);
  z-index: 998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-height: 540px;
}
#chat-window.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* ── HEADER ─────────────────────────────────────────────────── */
.chat-header {
  background: #181818;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E07B1A, #F59332);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.chat-agent-info { flex: 1; min-width: 0; }
.chat-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: #F5F5F5;
  line-height: 1.2;
}
.chat-status {
  font-size: 0.72rem;
  color: #4caf50;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'DM Sans', sans-serif;
  margin-top: 1px;
}
.chat-status-dot {
  width: 6px;
  height: 6px;
  background: #4caf50;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.chat-close {
  background: none;
  border: none;
  color: #A0A0A0;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-close:hover { color: #F5F5F5; background: rgba(255,255,255,0.07); }

/* ── MESSAGES ───────────────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  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); border-radius: 4px; }

.chat-msg { max-width: 88%; display: flex; flex-direction: column; }
.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; }

.chat-bubble-msg {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.55;
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
}
.chat-msg.bot .chat-bubble-msg {
  background: #1a1a1a;
  color: #F5F5F5;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255,255,255,0.07);
}
.chat-msg.user .chat-bubble-msg {
  background: linear-gradient(135deg, #E07B1A, #F59332);
  color: #fff;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

/* ── CHIPS ──────────────────────────────────────────────────── */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.chat-chip {
  background: transparent;
  border: 1px solid rgba(224,123,26,0.45);
  border-radius: 100px;
  padding: 5px 13px;
  font-size: 0.78rem;
  color: #E07B1A;
  cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1.4;
}
.chat-chip:hover {
  background: rgba(224,123,26,0.15);
  border-color: #E07B1A;
  color: #F59332;
}
.chat-chip:active { transform: scale(0.97); }

/* ── TYPING INDICATOR ───────────────────────────────────────── */
.chat-typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px !important;
}
.chat-typing-dots span {
  width: 7px;
  height: 7px;
  background: #A0A0A0;
  border-radius: 50%;
  animation: chatDotBounce 1.2s ease-in-out infinite;
  display: block;
}
.chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatDotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ── INPUT ROW ──────────────────────────────────────────────── */
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  background: #0d0d0d;
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  background: #1c1c1c;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.9rem;
  color: #F5F5F5;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.15s;
  /* iOS zoom prevention */
  font-size: 16px;
}
.chat-input::placeholder { color: #555; }
.chat-input:focus { border-color: rgba(224,123,26,0.5); }
.chat-send {
  background: linear-gradient(135deg, #E07B1A, #F59332);
  border: none;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: opacity 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.chat-send:hover { opacity: 0.88; }
.chat-send:active { transform: scale(0.94); }

/* ── MOBILE ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #chat-bubble { bottom: 16px; right: 16px; width: 52px; height: 52px; }
  #chat-window {
    bottom: 80px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    max-height: 72vh;
    border-radius: 16px;
  }
  .chat-input { font-size: 16px; } /* critical — prevents iOS zoom */
}
