/* ═══════════════════════════════════════════════
   Chatbot Widget — chatbot.css
   ═══════════════════════════════════════════════ */

/* ── Floating trigger button ── */
.cb-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 8000;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e2330 60%, #2f3542);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 28px rgba(0,0,0,0.35), 0 0 0 0 rgba(249,168,38,0.5);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s ease;
  animation: triggerPulse 2.8s ease-in-out infinite;
}

.cb-trigger:hover {
  transform: scale(1.12);
  box-shadow: 0 12px 36px rgba(0,0,0,0.4), 0 0 0 8px rgba(249,168,38,0.15);
  animation: none;
}

@keyframes triggerPulse {
  0%, 100% { box-shadow: 0 8px 28px rgba(0,0,0,0.35), 0 0 0 0 rgba(249,168,38,0.45); }
  50%       { box-shadow: 0 8px 28px rgba(0,0,0,0.35), 0 0 0 10px rgba(249,168,38,0); }
}

/* Ping dot */
.cb-trigger__ping {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #1e2330;
}

.cb-trigger__img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* ── Chat window ── */
.cb-window {
  position: fixed;
  bottom: 102px;
  right: 28px;
  z-index: 7999;
  width: 350px;
  max-height: 540px;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(0,0,0,0.22), 0 4px 16px rgba(0,0,0,0.1);
  border: 1px solid rgba(255,255,255,0.6);
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1),
              opacity 0.3s ease;
}

.cb-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
.cb-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #1e2330, #2f3542);
  flex-shrink: 0;
}

.cb-header__avatar {
  position: relative;
  flex-shrink: 0;
}

.cb-header__img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid rgba(249,168,38,0.5);
}

.cb-header__online {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #1e2330;
}

.cb-header__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cb-header__info strong {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.cb-header__info span {
  font-size: 0.7rem;
  color: #22c55e;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.cb-header__actions {
  display: flex;
  gap: 4px;
}

.cb-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.cb-icon-btn:hover {
  background: rgba(249,168,38,0.25);
  color: #f9a826;
}

/* ── Messages area ── */
.cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f4f6f9;
  scroll-behavior: smooth;
}

.cb-messages::-webkit-scrollbar { width: 4px; }
.cb-messages::-webkit-scrollbar-track { background: transparent; }
.cb-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* ── Message bubbles ── */
.cb-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: msgPop 0.28s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes msgPop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cb-msg--bot  { align-self: flex-start; align-items: flex-start; }
.cb-msg--user { align-self: flex-end;   align-items: flex-end; }

.cb-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.55;
  word-break: break-word;
}

.cb-msg--bot  .cb-bubble {
  background: #ffffff;
  color: #2f3542;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.cb-msg--user .cb-bubble {
  background: linear-gradient(135deg, #1e2330, #2f3542);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.cb-time {
  font-size: 0.62rem;
  color: #aaa;
  margin-top: 3px;
  padding: 0 4px;
}

/* ── Typing indicator ── */
.cb-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: #ffffff;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  width: fit-content;
  animation: msgPop 0.28s ease both;
}

.cb-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c0c7d0;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.cb-typing span:nth-child(2) { animation-delay: 0.18s; }
.cb-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); background: #c0c7d0; }
  30%            { transform: translateY(-5px); background: #f9a826; }
}

/* ── Service buttons ── */
.cb-services {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
}

.cb-svc-btn {
  padding: 7px 12px;
  border-radius: 20px;
  border: 1.5px solid #e2e5ea;
  background: #ffffff;
  color: #2f3542;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}

.cb-svc-btn:hover {
  background: #f9a826;
  border-color: #f9a826;
  color: #1e1e1e;
  transform: translateY(-2px);
}

/* ── Input row ── */
.cb-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}

.cb-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #e2e5ea;
  border-radius: 24px;
  font-size: 0.84rem;
  font-family: inherit;
  color: #2f3542;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #f7f8fa;
}

.cb-input:focus {
  border-color: #f9a826;
  box-shadow: 0 0 0 3px rgba(249,168,38,0.12);
  background: #fff;
}

.cb-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #f9a826, #e8971a);
  color: #1e1e1e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(249,168,38,0.35);
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.22s ease;
}

.cb-send:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 18px rgba(249,168,38,0.5);
}

.cb-input-row.hidden {
  display: none;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .cb-window {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 90px;
    max-height: 70vh;
  }
  .cb-trigger { right: 16px; bottom: 16px; }
}
