/* Goldie chat widget. Uses the site's colour variables from includes/theme.php. */

.goldie-fab {
  position: fixed; z-index: 70; bottom: 20px; right: 20px;
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center;
  background: var(--gold-deep); color: #fff;
  box-shadow: 0 10px 26px rgba(133, 104, 58, .35);
  transition: transform .2s var(--ease), background-color .2s var(--ease);
}
.goldie-fab:hover { background: #6F5630; transform: translateY(-2px); }
.goldie-fab[hidden] { display: none; }
.goldie-fab svg { width: 26px; height: 26px; }
[dir="rtl"] .goldie-fab { right: auto; left: 20px; }
#goldie.is-open .goldie-fab { transform: scale(.92); }

.goldie-panel {
  position: fixed; z-index: 71; bottom: 92px; right: 20px;
  width: 380px; height: min(640px, calc(100vh - 120px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(35, 35, 35, .18);
  font-family: var(--sans); color: var(--ink);
  animation: goldie-in .22s var(--ease);
}
.goldie-panel[hidden] { display: none; }
[dir="rtl"] .goldie-panel { right: auto; left: 20px; }
@keyframes goldie-in { from { opacity: 0; transform: translateY(12px); } }

.goldie-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; background: var(--tint); border-bottom: 1px solid var(--line); }
.goldie-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.goldie-title { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.goldie-title strong { font-family: var(--wordmark); font-size: 1.125rem; font-weight: 700; letter-spacing: .02em; }
.goldie-title span { font-size: .8125rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goldie-icon { width: 38px; height: 38px; border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.goldie-icon:hover { background: rgba(255, 255, 255, .7); }
.goldie-icon svg { width: 20px; height: 20px; }

.goldie-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.goldie-msg { max-width: 86%; display: grid; gap: 8px; justify-items: start; }
.goldie-msg p { padding: 10px 14px; border-radius: 16px; font-size: .9375rem; line-height: 1.5; white-space: pre-wrap; }
.goldie-msg.is-bot { align-self: flex-start; }
.goldie-msg.is-bot p { background: var(--surface); border: 1px solid var(--line); border-end-start-radius: 4px; }
.goldie-msg.is-user { align-self: flex-end; }
.goldie-msg.is-user p { background: var(--gold-deep); color: #fff; border-end-end-radius: 4px; }
/* Bot on the start side, customer on the end side; flex follows the page direction. */

.goldie-typing { flex-direction: row; display: flex; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.goldie-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: goldie-dot 1s infinite ease-in-out; }
.goldie-typing span:nth-child(2) { animation-delay: .15s; }
.goldie-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes goldie-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.goldie-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.goldie-chip {
  padding: 8px 14px; border-radius: 99px; border: 1px solid var(--gold); background: #fff; color: var(--gold-deep);
  font: inherit; font-size: .875rem; cursor: pointer; transition: background-color .15s var(--ease), color .15s var(--ease);
}
.goldie-chip:hover { background: var(--tint); }
.goldie-chip[aria-pressed="true"] { background: var(--gold-deep); border-color: var(--gold-deep); color: #fff; }
.goldie-chip.is-done { background: var(--ink); border-color: var(--ink); color: #fff; }
.goldie-chip:disabled { opacity: .45; cursor: default; }

.goldie-cards { display: grid; gap: 10px; }
.goldie-card { position: relative; display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.goldie-rank { position: absolute; top: 6px; inset-inline-start: 6px; z-index: 1; width: 22px; height: 22px; border-radius: 50%; background: var(--gold-deep); color: #fff; font-size: .75rem; display: grid; place-items: center; }
.goldie-card-img img { width: 84px; height: 112px; object-fit: cover; border-radius: 10px; background: var(--tint); }
.goldie-card-body { display: grid; gap: 4px; align-content: start; min-width: 0; }
.goldie-card h3 { font-family: var(--title); font-weight: 700; font-size: .9375rem; letter-spacing: .02em; }
.goldie-reason { font-size: .8125rem; line-height: 1.45; color: var(--muted); }
.goldie-price { font-size: .875rem; font-weight: 500; }
.goldie-price s { color: var(--muted); font-weight: 400; }
.goldie-price.is-soon { font-weight: 400; font-style: italic; color: var(--muted); }
.goldie-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.goldie-btn {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: .8125rem; text-decoration: none; cursor: pointer;
}
.goldie-btn:hover { border-color: var(--gold); }
.goldie-btn.gold { background: var(--gold-deep); border-color: var(--gold-deep); color: #fff; }
.goldie-btn.gold:hover { background: #6F5630; }
.goldie-btn:disabled { opacity: .7; cursor: default; }

.goldie-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }
.goldie-input {
  flex: 1; min-height: 42px; max-height: 110px; resize: none; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 21px; background: var(--surface); font: inherit; font-size: .9375rem; line-height: 1.35;
}
.goldie-input:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 0; }
.goldie-send { width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; background: var(--gold-deep); color: #fff; cursor: pointer; display: grid; place-items: center; }
.goldie-send svg { width: 18px; height: 18px; }
[dir="rtl"] .goldie-send svg { transform: scaleX(-1); }

/* Phones: full screen. */
@media (max-width: 600px) {
  .goldie-panel, [dir="rtl"] .goldie-panel { inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
  #goldie.is-open .goldie-fab { display: none; }
  html.goldie-locked, html.goldie-locked body { overflow: hidden; }
  .goldie-fab { bottom: 16px; right: 16px; }
  [dir="rtl"] .goldie-fab { left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .goldie-panel, .goldie-typing span { animation: none; }
}

/* "Talk to our team on WhatsApp" link above the input. */
.goldie-wa { display: block; padding: 8px 16px; border-top: 1px solid var(--line); font-size: .8125rem; color: var(--gold-deep); text-align: center; text-decoration: underline; text-underline-offset: 3px; background: var(--surface); }
.goldie-wa:hover { color: var(--ink); }
