/**
 * Ayat Gift Assistant — floating messenger widget
 * Dock: WhatsApp (left) + Robo (right) on ONE horizontal line
 */
.aga-root {
  --aga-accent: #b6735b;
  --aga-ink: #1c1814;
  --aga-muted: #8e8278;
  --aga-bg: #fbf7f2;
  --aga-panel: #ffffff;
  --aga-bot-w: 118px;
  --aga-bot-h: 138px;
  --aga-dock-right: 14px;
  --aga-dock-bottom: clamp(16px, 3vw, 24px);
  --aga-dock-gap: 12px;
  --wa-size: 56px;
  position: relative;
  z-index: 9990;
  font-family: var(--font-sans, system-ui, sans-serif);
}

/* Hide standalone WA FAB — dock already has WhatsApp beside robo */
body:has(.aga-dock) .wa-fab {
  display: none !important;
}

/* Fixed dock: WA left + Robo right, same line */
.aga-dock {
  position: fixed;
  right: var(--aga-dock-right);
  bottom: var(--aga-dock-bottom);
  z-index: 9991;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: var(--aga-dock-gap);
  pointer-events: none;
}
.aga-dock > * {
  pointer-events: auto;
}

body.has-sticky-cta .aga-dock,
body.has-checkout-sticky .aga-dock {
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 768px) {
  body.has-sticky-cta .aga-dock {
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
}

.aga-dock__wa {
  flex-shrink: 0;
  width: var(--wa-size);
  height: var(--wa-size);
  margin-bottom: calc((var(--aga-bot-h) - var(--wa-size)) / 2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #25d366;
  color: #fff;
  box-shadow: 0 6px 24px rgba(37, 211, 102, 0.45);
  transition: transform 200ms ease, box-shadow 200ms ease;
  text-decoration: none;
}
.aga-dock__wa:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 28px rgba(37, 211, 102, 0.55);
  color: #fff;
}

.aga-fab {
  position: relative;
  right: auto;
  bottom: auto;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 12px 26px rgba(28, 24, 20, 0.2));
  transition: transform 220ms ease;
}
.aga-fab:hover {
  transform: translateY(-3px);
}

.aga-fab__bubble {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  border-radius: 14px;
  background: #fff;
  border: 1.5px solid rgba(28, 24, 20, 0.12);
  color: var(--aga-ink);
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(28, 24, 20, 0.1);
  animation: agaBubbleFloat 2.8s ease-in-out infinite;
  z-index: 2;
}
.aga-fab__bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 11px;
  height: 11px;
  background: #fff;
  border-right: 1.5px solid rgba(28, 24, 20, 0.12);
  border-bottom: 1.5px solid rgba(28, 24, 20, 0.12);
  transform: translateX(-50%) rotate(45deg);
}

.aga-fab__bot {
  position: relative;
  width: var(--aga-bot-w);
  height: var(--aga-bot-h);
}

.aga-fab__bot-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.aga-fab__logo {
  position: absolute;
  left: 50%;
  top: 62%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(182, 115, 91, 0.4);
  box-shadow: 0 3px 10px rgba(28, 24, 20, 0.14);
  display: grid;
  place-items: center;
  overflow: hidden;
  z-index: 2;
}
.aga-fab__logo img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

@keyframes agaBubbleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.aga-panel {
  position: fixed;
  right: var(--aga-dock-right);
  bottom: calc(var(--aga-dock-bottom) + var(--aga-bot-h) + 64px);
  width: min(390px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 160px));
  background: var(--aga-panel);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(17, 24, 39, 0.22);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9992;
  border: 1px solid rgba(182, 115, 91, 0.2);
}

.aga-panel.is-open { display: flex; }

@media (max-width: 480px) {
  .aga-root {
    --aga-bot-w: 100px;
    --aga-bot-h: 118px;
    --aga-dock-right: 10px;
    --aga-dock-gap: 10px;
  }
  .aga-fab__logo {
    width: 34px;
    height: 34px;
  }
  .aga-fab__logo img {
    width: 24px;
    height: 24px;
  }
  .aga-fab__bubble {
    font-size: 0.8rem;
    padding: 8px 11px;
  }
}

.aga-head {
  background: linear-gradient(135deg, #2a211c, #3d2f28);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.aga-head__avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.35);
  position: relative;
}

.aga-head__avatar--logo {
  background: #fff;
  padding: 4px;
}

.aga-head__avatar--logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 50%;
}

.aga-head__meta strong { display: block; font-size: 0.9375rem; }
.aga-head__meta span { font-size: 0.75rem; opacity: 0.8; }

.aga-head__close {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.aga-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: var(--aga-bg);
}

.aga-msg {
  display: flex;
  margin-bottom: 12px;
  max-width: 92%;
}

.aga-msg--bot { justify-content: flex-start; }
.aga-msg--user { justify-content: flex-end; margin-left: auto; }

.aga-bubble {
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.aga-msg--bot .aga-bubble {
  background: #fff;
  color: var(--aga-ink);
  border-bottom-left-radius: 4px;
}

.aga-msg--user .aga-bubble {
  background: var(--aga-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.aga-typing {
  display: none;
  gap: 4px;
  padding: 8px 12px;
  background: #fff;
  border-radius: 14px;
  width: fit-content;
  margin-bottom: 10px;
}

.aga-typing.is-on { display: inline-flex; }
.aga-typing i {
  width: 6px; height: 6px; border-radius: 50%; background: #9ca3af;
  animation: aga-bounce 1s infinite ease-in-out;
}
.aga-typing i:nth-child(2) { animation-delay: 0.15s; }
.aga-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes aga-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.aga-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 10px;
}

.aga-chip {
  border: 1px solid rgba(193,127,99,0.45);
  background: #fff;
  color: var(--aga-accent);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.aga-products {
  display: grid;
  gap: 10px;
  margin: 8px 0 4px;
}

.aga-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  display: grid;
  grid-template-columns: 88px 1fr;
}

.aga-card img {
  width: 88px;
  height: 88px;
  object-fit: cover;
}

.aga-card__body { padding: 8px 10px; }
.aga-card__name { font-size: 0.8125rem; font-weight: 700; margin: 0 0 2px; color: var(--aga-ink); }
.aga-card__price { font-size: 0.8125rem; color: var(--aga-accent); font-weight: 700; margin: 0 0 4px; }
.aga-card__desc { font-size: 0.6875rem; color: var(--aga-muted); margin: 0 0 8px; }
.aga-card__actions { display: flex; flex-wrap: wrap; gap: 4px; }
.aga-card__actions a {
  font-size: 0.6875rem;
  font-weight: 700;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  background: #f3f4f6;
  color: var(--aga-ink);
}
.aga-card__actions a.aga-buy {
  background: var(--aga-accent);
  color: #fff;
}

.aga-handover {
  margin-top: 8px;
}
.aga-handover a {
  display: block;
  text-align: center;
  background: #25d366;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 10px;
  border-radius: 10px;
  font-size: 0.875rem;
}

.aga-foot {
  border-top: 1px solid #e5e7eb;
  padding: 10px;
  display: flex;
  gap: 8px;
  background: #fff;
}

.aga-foot input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.875rem;
}

.aga-foot button {
  border: 0;
  border-radius: 999px;
  background: var(--aga-accent);
  color: #fff;
  font-weight: 700;
  padding: 0 16px;
  cursor: pointer;
}

.aga-note {
  font-size: 0.625rem;
  color: var(--aga-muted);
  text-align: center;
  padding: 0 10px 8px;
  background: #fff;
}

@media (max-width: 480px) {
  .aga-fab { right: 14px; bottom: 86px; }
  .aga-panel {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 150px;
    height: min(70vh, 560px);
  }
}
