/* ================================================================
   Didi — AI Shopping Assistant widget
   Palette mirrors main.css: bronze #c8965a, dark #1a1208, surface #faf9f7
   ================================================================ */

/* ── Widget container ──────────────────────────────────────────── */
#didi-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  font-family: var(--font-body, 'Inter', system-ui, sans-serif);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

/* ── WhatsApp button ───────────────────────────────────────────── */
#didi-whatsapp {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(37,211,102,.45);
  transition: transform .2s ease, box-shadow .2s ease;
  flex-shrink: 0;
}

#didi-whatsapp:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 26px rgba(37,211,102,.62);
  color: #fff;
}

/* ── Trigger button ────────────────────────────────────────────── */
#didi-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary, #c8965a);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(200,150,90,.50);
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
  position: relative;
  outline: none;
}

#didi-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(200,150,90,.65);
}

#didi-btn:focus-visible {
  outline: 3px solid rgba(200,150,90,.5);
  outline-offset: 3px;
}

#didi-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  background: #e53935;
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  pointer-events: none;
}

/* ── Chat panel ────────────────────────────────────────────────── */
#didi-panel {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 360px;
  max-height: 540px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 48px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(.97);
  pointer-events: none;
  transition: opacity .22s cubic-bezier(.4,0,.2,1),
              transform .22s cubic-bezier(.4,0,.2,1);
}

#didi-panel.didi-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ────────────────────────────────────────────────────── */
.didi-header {
  background: linear-gradient(135deg, #1a1208 0%, #2d1f0e 100%);
  color: #fff;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.didi-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.didi-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(200,150,90,.2);
  border: 1.5px solid rgba(200,150,90,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  color: #c8965a;
  flex-shrink: 0;
}

.didi-header-name {
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.2;
  font-family: var(--font-heading, 'Cormorant Garamond', serif);
  letter-spacing: .3px;
}

.didi-header-sub {
  font-size: .7rem;
  opacity: .55;
  margin-top: 1px;
}

.didi-header-online {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4caf50;
  margin-right: 4px;
  vertical-align: middle;
}

.didi-header-actions {
  display: flex;
  gap: 4px;
}

.didi-header-actions button {
  background: rgba(255,255,255,.1);
  border: none;
  color: rgba(255,255,255,.65);
  width: 28px;
  height: 28px;
  border-radius: 7px;
  cursor: pointer;
  font-size: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  outline: none;
}

.didi-header-actions button:hover {
  background: rgba(255,255,255,.2);
  color: #fff;
}

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

.didi-messages::-webkit-scrollbar { width: 3px; }
.didi-messages::-webkit-scrollbar-track { background: transparent; }
.didi-messages::-webkit-scrollbar-thumb { background: #ddd5c9; border-radius: 4px; }

/* ── Message rows ──────────────────────────────────────────────── */
.didi-msg {
  display: flex;
  flex-direction: column;
}

.didi-msg--user { align-items: flex-end; }
.didi-msg--ai   { align-items: flex-start; }

.didi-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  max-width: 86%;
  word-break: break-word;
  line-height: 1.55;
}

.didi-msg--user .didi-bubble {
  background: var(--primary, #c8965a);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.didi-msg--ai .didi-bubble {
  background: #fff;
  color: #3d3022;
  border: 1px solid #e8e0d6;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

/* ── Welcome chips ─────────────────────────────────────────────── */
.didi-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  max-width: 300px;
}

.didi-chip {
  background: #fff;
  border: 1.5px solid var(--primary, #c8965a);
  color: var(--primary, #c8965a);
  padding: 5px 11px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  font-family: var(--font-body, 'Inter', system-ui, sans-serif);
}

.didi-chip:hover {
  background: var(--primary, #c8965a);
  color: #fff;
}

/* ── Typing dots ───────────────────────────────────────────────── */
.didi-typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 11px 15px;
  background: #fff;
  border: 1px solid #e8e0d6;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  width: fit-content;
}

.didi-typing-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c8965a;
  display: block;
  animation: didiDot .9s infinite ease-in-out;
}
.didi-typing-bubble span:nth-child(2) { animation-delay: .16s; }
.didi-typing-bubble span:nth-child(3) { animation-delay: .32s; }

@keyframes didiDot {
  0%, 60%, 100% { transform: translateY(0);    opacity: .35; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Product cards ─────────────────────────────────────────────── */
.didi-products {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 4px;
  scrollbar-width: none;
  max-width: 312px;
  -webkit-overflow-scrolling: touch;
}

.didi-products::-webkit-scrollbar { display: none; }

.didi-card {
  flex-shrink: 0;
  width: 132px;
  background: #fff;
  border: 1px solid #e8e0d6;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: box-shadow .18s, transform .18s;
}

.didi-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.11);
  transform: translateY(-2px);
}

.didi-card-img {
  display: block;
  height: 108px;
  overflow: hidden;
  background: #f5ede0;
  text-decoration: none;
}

.didi-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}

.didi-card:hover .didi-card-img img {
  transform: scale(1.06);
}

.didi-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c8965a;
  font-size: 1.8rem;
  opacity: .35;
}

.didi-card-body {
  padding: 8px 8px 9px;
}

.didi-card-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: .73rem;
  font-weight: 500;
  color: #3d3022;
  text-decoration: none;
  line-height: 1.35;
  margin-bottom: 4px;
}

.didi-card-name:hover { color: var(--primary, #c8965a); }

.didi-card-price {
  font-size: .75rem;
  font-weight: 700;
  color: var(--primary, #c8965a);
  margin-bottom: 7px;
}

.didi-card-was {
  font-size: .68rem;
  color: #8a7a68;
  text-decoration: line-through;
  font-weight: 400;
  margin-left: 3px;
}

.didi-card-btn {
  width: 100%;
  background: var(--primary, #c8965a);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 4px;
  font-size: .72rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
  font-family: var(--font-body, 'Inter', system-ui, sans-serif);
}

.didi-card-btn:hover { background: var(--primary-dark, #a57040); }

/* ── Input area ────────────────────────────────────────────────── */
.didi-input-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 12px;
  border-top: 1px solid #e8e0d6;
  background: #fff;
  flex-shrink: 0;
}

.didi-input {
  flex: 1;
  border: 1.5px solid #e8e0d6;
  border-radius: 22px;
  padding: 8px 15px;
  font-size: .875rem;
  outline: none;
  background: #faf9f7;
  color: #3d3022;
  transition: border-color .15s, background .15s;
  font-family: var(--font-body, 'Inter', system-ui, sans-serif);
  line-height: 1.4;
}

.didi-input:focus {
  border-color: var(--primary, #c8965a);
  background: #fff;
}

.didi-input::placeholder { color: #b8a99a; }

.didi-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary, #c8965a);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
  outline: none;
}

.didi-send:hover    { background: var(--primary-dark, #a57040); }
.didi-send:active   { transform: scale(.9); }
.didi-send:disabled { background: #ddd; cursor: not-allowed; }

/* ── Footer note ───────────────────────────────────────────────── */
.didi-footer-note {
  text-align: center;
  font-size: .66rem;
  color: #b8a99a;
  padding: 5px 12px 9px;
  background: #fff;
  flex-shrink: 0;
  margin: 0;
}

.didi-footer-note a {
  color: #b8a99a;
  text-decoration: none;
}

.didi-footer-note a:hover { color: #8a7a68; }

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #didi-widget {
    bottom: 16px;
    right: 16px;
  }

  #didi-panel {
    width: calc(100vw - 32px);
    right: -8px;
    max-height: 460px;
  }

  .didi-products { max-width: calc(100vw - 64px); }

  #didi-whatsapp {
    width: 46px;
    height: 46px;
    font-size: 1.3rem;
  }
}
