/* ===== DOOTYFUL SCOOPERS — CHAT WIDGET (chat-widget.css) ===== */
/* Floating AI chat widget. Add to <head>: <link rel="stylesheet" href="chat-widget.css"> */
/* Uses the same CSS variables as styles.css — no conflicts. */

/* ── ROOT ──────────────────────────────────────────────────────────────── */
#ds-chat-root {
  --ds-navy:       #1e3a5f;
  --ds-navy-mid:   #2a4f7c;
  --ds-sky:        #7fc8d5;
  --ds-sky-light:  #b8e2e9;
  --ds-gold:       #f5a623;
  --ds-brown:      #8b4513;
  --ds-cream:      #fdf8f2;
  --ds-white:      #ffffff;
  --ds-text:       #2c3e50;
  --ds-text-light: #5a6a7a;
  --ds-shadow:     0 8px 40px rgba(30, 58, 95, 0.22);
  --ds-radius:     18px;
  --ds-font:       'Nunito', sans-serif;

  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: var(--ds-font);
}

/* ── PROACTIVE BUBBLE ──────────────────────────────────────────────────── */
#ds-chat-promo {
  position: absolute;
  bottom: 76px;
  right: 0;
  background: var(--ds-white);
  border: 2px solid var(--ds-sky);
  border-radius: 14px 14px 4px 14px;
  padding: 12px 36px 12px 14px;
  width: 230px;
  box-shadow: var(--ds-shadow);
  font-size: 0.85rem;
  color: var(--ds-text);
  line-height: 1.45;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#ds-chat-promo.ds-promo-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

#ds-chat-promo p {
  margin: 0;
}

#ds-chat-promo-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  font-size: 0.75rem;
  color: var(--ds-text-light);
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.15s;
}

#ds-chat-promo-close:hover {
  background: #f0f0f0;
}

/* ── TOGGLE BUTTON ─────────────────────────────────────────────────────── */
#ds-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ds-navy);
  border: 3px solid var(--ds-sky);
  box-shadow: var(--ds-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

#ds-chat-toggle:hover {
  transform: scale(1.08);
  background: var(--ds-navy-mid);
  box-shadow: 0 10px 48px rgba(30, 58, 95, 0.32);
}

#ds-chat-toggle:focus-visible {
  outline: 3px solid var(--ds-sky);
  outline-offset: 3px;
}

#ds-chat-toggle.ds-active {
  background: var(--ds-sky);
  border-color: var(--ds-navy);
}

/* Notification badge */
#ds-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: var(--ds-gold);
  color: var(--ds-navy);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

#ds-chat-badge.ds-badge-visible {
  opacity: 1;
  transform: scale(1);
}

/* ── CHAT PANEL ─────────────────────────────────────────────────────────── */
#ds-chat-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 360px;
  max-height: 540px;
  background: var(--ds-cream);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1.5px solid rgba(127, 200, 213, 0.35);
}

#ds-chat-panel.ds-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── HEADER ─────────────────────────────────────────────────────────────── */
#ds-chat-header {
  background: var(--ds-navy);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#ds-chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

#ds-chat-avatar {
  width: 42px;
  height: 42px;
  background: rgba(127, 200, 213, 0.15);
  border: 2px solid var(--ds-sky);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 2px;
}

#ds-chat-name {
  color: var(--ds-white);
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.2;
}

#ds-chat-status {
  color: var(--ds-sky-light);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

#ds-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #4cde80;
  border-radius: 50%;
  flex-shrink: 0;
  animation: ds-pulse 2.2s infinite;
}

@keyframes ds-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

#ds-chat-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  color: var(--ds-sky-light);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

#ds-chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--ds-white);
}

/* ── MESSAGES ────────────────────────────────────────────────────────────── */
#ds-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#ds-chat-messages::-webkit-scrollbar {
  width: 4px;
}
#ds-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
#ds-chat-messages::-webkit-scrollbar-thumb {
  background: var(--ds-sky-light);
  border-radius: 4px;
}

.ds-msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  word-break: break-word;
  animation: ds-msg-in 0.22s ease;
}

@keyframes ds-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ds-msg-bot {
  background: var(--ds-white);
  color: var(--ds-text);
  border-radius: 4px 16px 16px 16px;
  align-self: flex-start;
  box-shadow: 0 2px 8px rgba(30, 58, 95, 0.08);
  border: 1px solid rgba(127, 200, 213, 0.25);
}

.ds-msg-user {
  background: var(--ds-navy);
  color: var(--ds-white);
  border-radius: 16px 16px 4px 16px;
  align-self: flex-end;
}

.ds-link {
  color: var(--ds-sky-dark, #4da8b8);
  text-decoration: underline;
}

/* Typing indicator */
.ds-typing {
  padding: 12px 16px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.ds-typing span {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--ds-sky);
  border-radius: 50%;
  animation: ds-bounce 1.1s infinite ease-in-out;
}

.ds-typing span:nth-child(2) { animation-delay: 0.16s; }
.ds-typing span:nth-child(3) { animation-delay: 0.32s; }

@keyframes ds-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-7px); }
}

/* ── FOOTER / INPUT ──────────────────────────────────────────────────────── */
#ds-chat-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(127, 200, 213, 0.25);
  background: var(--ds-white);
  flex-shrink: 0;
}

#ds-chat-input {
  flex: 1;
  border: 1.5px solid rgba(127, 200, 213, 0.5);
  border-radius: 22px;
  padding: 9px 15px;
  font-family: var(--ds-font);
  font-size: 0.875rem;
  color: var(--ds-text);
  background: var(--ds-cream);
  outline: none;
  transition: border-color 0.2s;
}

#ds-chat-input:focus {
  border-color: var(--ds-sky);
}

#ds-chat-input::placeholder {
  color: var(--ds-text-light);
  opacity: 0.7;
}

#ds-chat-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#ds-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ds-navy);
  border: none;
  color: var(--ds-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

#ds-chat-send:hover {
  background: var(--ds-navy-mid);
  transform: scale(1.08);
}

#ds-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── MOBILE RESPONSIVE ───────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #ds-chat-root {
    bottom: 16px;
    right: 16px;
  }

  #ds-chat-panel {
    width: calc(100vw - 32px);
    max-height: 70vh;
    right: 0;
    bottom: 72px;
  }

  #ds-chat-promo {
    width: 200px;
    font-size: 0.8rem;
  }
}
