/* ============================================
   QC Home & Business Project Pros — Chat Widget
   ============================================ */

.qcpp-chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
  font-family: var(--font-sans, 'Inter', sans-serif);
}

/* --- Launcher button --- */
.qcpp-chat__launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  background: linear-gradient(120deg, var(--primary, #0F766E) 0%, #14B8A6 100%);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(15, 118, 110, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.qcpp-chat__launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(15, 118, 110, 0.45);
}
.qcpp-chat--open .qcpp-chat__launcher { display: none; }

/* --- Panel --- */
.qcpp-chat__panel {
  display: none;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 110px));
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: var(--radius-lg, 20px);
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.22);
  overflow: hidden;
}
.qcpp-chat--open .qcpp-chat__panel { display: flex; }

.qcpp-chat__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(120deg, var(--primary, #0F766E) 0%, #14B8A6 100%);
  color: #fff;
}
.qcpp-chat__header img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
}
.qcpp-chat__header-text { flex: 1; min-width: 0; }
.qcpp-chat__title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}
.qcpp-chat__subtitle {
  font-size: 0.72rem;
  opacity: 0.85;
}
.qcpp-chat__close {
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.qcpp-chat__close:hover { background: rgba(255, 255, 255, 0.3); }

/* --- Messages --- */
.qcpp-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg, #F9FAFB);
}
.qcpp-chat__msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.qcpp-chat__msg--bot {
  align-self: flex-start;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #E5E7EB);
  color: var(--text-primary, #111827);
  border-bottom-left-radius: 4px;
}
.qcpp-chat__msg--user {
  align-self: flex-end;
  background: var(--primary, #0F766E);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.qcpp-chat__msg--error {
  align-self: flex-start;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #991B1B;
}
.qcpp-chat__msg a {
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}

/* Typing indicator */
.qcpp-chat__typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.qcpp-chat__typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted, #9CA3AF);
  animation: qcpp-bounce 1.2s infinite;
}
.qcpp-chat__typing span:nth-child(2) { animation-delay: 0.15s; }
.qcpp-chat__typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes qcpp-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* --- Starter suggestion chips --- */
.qcpp-chat__starters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
  background: var(--bg, #F9FAFB);
}
.qcpp-chat__starter {
  border: 1px solid rgba(15, 118, 110, 0.3);
  background: var(--accent-light, #CCFBF1);
  color: var(--primary, #0F766E);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  transition: background 0.2s ease;
}
.qcpp-chat__starter:hover { background: #99F6E4; }

/* --- Input --- */
.qcpp-chat__form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border, #E5E7EB);
  background: var(--bg-card, #fff);
}
.qcpp-chat__input {
  flex: 1;
  border: 1px solid var(--border-strong, #D1D5DB);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.qcpp-chat__input:focus {
  border-color: var(--primary, #0F766E);
  box-shadow: 0 0 0 3px var(--primary-glow, rgba(15, 118, 110, 0.18));
}
.qcpp-chat__send {
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary, #0F766E);
  color: #fff;
  transition: background 0.2s ease;
}
.qcpp-chat__send:hover { background: var(--primary-hover, #115E59); }
.qcpp-chat__send:disabled { background: var(--text-muted, #9CA3AF); cursor: default; }

.qcpp-chat__disclaimer {
  font-size: 0.66rem;
  color: var(--text-muted, #9CA3AF);
  text-align: center;
  padding: 0 12px 8px;
  background: var(--bg-card, #fff);
}

/* --- Mobile --- */
@media (max-width: 480px) {
  .qcpp-chat { right: 12px; bottom: 12px; }
  .qcpp-chat--open {
    right: 8px;
    left: 8px;
    bottom: 8px;
  }
  .qcpp-chat__panel {
    width: 100%;
    height: min(560px, calc(100dvh - 80px));
  }
  .qcpp-chat__launcher span { display: none; }
  .qcpp-chat__launcher { padding: 14px; }
}
