/* ============================================================
   iDEALCAR — INQUIRY CHATBOT WIDGET
   Floating toggle button sits above the scroll-top / view-quote
   row (see cart.css .idc-fab-row) at the bottom-right corner.
   ============================================================ */

.idc-chat-toggle {
  position: fixed; bottom: 90px; right: 20px; z-index: 950;
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: var(--color-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg); cursor: pointer;
  transition: transform var(--transition);
}
.idc-chat-toggle:hover { transform: scale(1.06); }
.idc-chat-toggle svg { width: 26px; height: 26px; }
.idc-chat-toggle .idc-chat-close-icon { display: none; }
.idc-chat-toggle.open .idc-chat-bubble-icon { display: none; }
.idc-chat-toggle.open .idc-chat-close-icon { display: block; }

.idc-chat-badge {
  position: absolute; top: -2px; right: -2px;
  background: #fff; color: var(--color-red);
  border-radius: 50%; width: 20px; height: 20px;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--color-red-dark);
}

.idc-chat-window {
  position: fixed; bottom: 156px; right: 20px; z-index: 950;
  width: 340px; max-width: calc(100vw - 40px);
  height: 460px; max-height: calc(100vh - 200px);
  background: #fff; border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(16px);
  transition: opacity var(--transition), transform var(--transition);
}
.idc-chat-window.show { display: flex; opacity: 1; transform: translateY(0); }

.idc-chat-header {
  background: var(--color-gradient); color: #fff;
  padding: 14px 16px; display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.idc-chat-header-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.idc-chat-header-avatar svg { width: 18px; height: 18px; }
.idc-chat-header-text { flex: 1; min-width: 0; }
.idc-chat-header-text strong { display: block; font-size: 14px; }
.idc-chat-header-text span { display: block; font-size: 11.5px; opacity: 0.85; }
.idc-chat-header-status { width: 8px; height: 8px; border-radius: 50%; background: #3ecf5f; margin-right: 2px; display: inline-block; }
.idc-chat-close {
  background: none; border: none; color: #fff; cursor: pointer;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; opacity: 0.9;
}
.idc-chat-close:hover { background: rgba(255,255,255,0.15); }

.idc-chat-messages {
  flex: 1; overflow-y: auto; padding: 14px; background: var(--color-bg-soft);
  display: flex; flex-direction: column; gap: 10px;
}
.idc-chat-msg {
  max-width: 82%; padding: 10px 13px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.45; word-wrap: break-word;
}
.idc-chat-msg.bot {
  background: #fff; color: var(--color-text); align-self: flex-start;
  border-bottom-left-radius: 4px; box-shadow: var(--shadow-sm);
}
.idc-chat-msg.user {
  background: var(--color-gradient); color: #fff; align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.idc-chat-typing {
  align-self: flex-start; background: #fff; border-radius: 14px;
  border-bottom-left-radius: 4px; padding: 10px 14px; box-shadow: var(--shadow-sm);
  display: inline-flex; gap: 4px;
}
.idc-chat-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #b5b5b5;
  animation: idcTypingBounce 1s infinite ease-in-out;
}
.idc-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.idc-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes idcTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.idc-chat-quick-replies {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 12px; background: var(--color-bg-soft);
  flex-shrink: 0;
}
.idc-chat-chip {
  border: 1.5px solid var(--color-red); color: var(--color-red); background: #fff;
  border-radius: 50px; padding: 6px 12px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.idc-chat-chip:hover { background: var(--color-red); color: #fff; }

.idc-chat-input-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--color-border); background: #fff; flex-shrink: 0;
}
.idc-chat-input-row input {
  flex: 1; border: 1.5px solid var(--color-border); border-radius: 50px;
  padding: 10px 15px; font-size: 13.5px; outline: none;
  font-family: var(--font-body); transition: border-color var(--transition);
}
.idc-chat-input-row input:focus { border-color: var(--color-red); }
.idc-chat-send {
  width: 38px; height: 38px; border-radius: 50%; border: none; flex-shrink: 0;
  background: var(--color-gradient); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.idc-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
.idc-chat-send svg { width: 16px; height: 16px; }

@media (max-width: 480px) {
  .idc-chat-window {
    right: 12px; left: 12px; width: auto; bottom: 150px;
  }
  .idc-chat-toggle { right: 16px; }
}
