/*!
 * The IT Gear shopping assistant. Layout from theitgear-gearbot (gearbot.css), with the chat's
 * product, map and helper styles in one file.
 */
/*!
 * Gear Bot — The IT Gear chat widget (light mode)
 * All selectors are prefixed with .gb- so they never clash with the store theme.
 */
.gb-root {
  --gb-accent: #D63415;          /* brand accent (white text passes 4.5:1) */
  --gb-accent-hover: #B82A0F;
  --gb-accent-soft: #FDEDE9;
  --gb-bg: #FFFFFF;
  --gb-surface: #F4F5F7;
  --gb-surface-2: #EBEDF1;
  --gb-border: #E3E5EA;
  --gb-text: #15171C;
  --gb-muted: #5B616E;
  --gb-success: #0F8A5F;
  --gb-wa: #128C4B;
  --gb-radius: 18px;
  --gb-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --gb-display: "Chakra Petch", "Inter", system-ui, sans-serif;
  --gb-z: 2147483000;

  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: var(--gb-z);
  font-family: var(--gb-font);
  color: var(--gb-text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.gb-root *, .gb-root *::before, .gb-root *::after { box-sizing: border-box; }
.gb-root button { font-family: inherit; }
.gb-root :focus-visible { outline: 2px solid var(--gb-accent); outline-offset: 2px; }
.gb-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Launcher ---------- */
/* The launcher is the red rounded square with the speech bubble and gear (drawn in the SVG itself). */
.gb-launcher {
  width: 60px; height: 60px; padding: 0; border: 0; cursor: pointer; background: transparent;
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 10px 18px rgba(214, 52, 21, 0.35)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
  transition: transform .15s ease;
  margin-left: auto;
}
.gb-launcher:hover { transform: translateY(-2px); }
.gb-launcher svg { width: 60px; height: 60px; display: block; }
.gb-launcher .gb-ic-bg { fill: var(--gb-accent); }
.gb-launcher:hover .gb-ic-bg { fill: var(--gb-accent-hover); }
.gb-launcher .gb-ic-close { display: none; }
.gb-root.gb-open .gb-launcher .gb-ic-chat { display: none; }
.gb-root.gb-open .gb-launcher .gb-ic-close { display: block; }

.gb-teaser {
  position: absolute; right: 0; bottom: 74px; width: max-content; max-width: 260px;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 8px 10px 14px; border-radius: 14px 14px 4px 14px;
  background: var(--gb-bg); border: 1px solid var(--gb-border);
  box-shadow: 0 10px 30px rgba(21,23,28,0.14);
  font-size: 14px; font-weight: 500; cursor: pointer;
  animation: gb-pop .25s ease;
}
.gb-teaser[hidden] { display: none; }
.gb-teaser-close {
  width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent;
  color: var(--gb-muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.gb-teaser-close:hover { background: var(--gb-surface); }

/* ---------- Panel ---------- */
.gb-panel {
  position: absolute; right: 0; bottom: 76px;
  width: 380px; height: 640px; max-height: calc(100vh - 110px);
  display: flex; flex-direction: column;
  background: var(--gb-bg); border: 1px solid var(--gb-border); border-radius: var(--gb-radius);
  box-shadow: 0 24px 64px rgba(21,23,28,0.18), 0 4px 12px rgba(21,23,28,0.06);
  overflow: hidden;
  transform-origin: bottom right;
  animation: gb-pop .2s ease;
}
.gb-panel[hidden] { display: none; }

.gb-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 10px 14px 16px;
  background: var(--gb-bg); border-bottom: 1px solid var(--gb-border);
}
.gb-avatar {
  position: relative; flex: none; width: 40px; height: 40px; border-radius: 12px;
  background: var(--gb-accent); color: #fff; display: flex; align-items: center; justify-content: center;
}
.gb-avatar svg { width: 22px; height: 22px; }
.gb-avatar::after {
  content: ""; position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px;
  border-radius: 50%; background: #22C55E; border: 2px solid var(--gb-bg);
}
.gb-title { display: flex; flex-direction: column; min-width: 0; }
.gb-title strong { font-family: var(--gb-display); font-size: 17px; font-weight: 700; letter-spacing: .01em; line-height: 1.2; }
.gb-title span { font-size: 12px; color: var(--gb-muted); }
.gb-head-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.gb-expert {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px;
  border-radius: 10px; border: 1px solid var(--gb-border); background: var(--gb-bg);
  color: var(--gb-text); text-decoration: none; font-size: 12px; font-weight: 600;
}
.gb-expert:hover { background: var(--gb-surface); }
.gb-expert svg { width: 16px; height: 16px; color: var(--gb-wa); }
.gb-icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--gb-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.gb-icon-btn:hover { background: var(--gb-surface); color: var(--gb-text); }
.gb-icon-btn svg { width: 19px; height: 19px; }

/* ---------- Messages ---------- */
.gb-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 14px; display: flex; flex-direction: column; gap: 10px;
  background: #FAFAFB;
  scroll-behavior: smooth;
}
.gb-body > * { flex-shrink: 0; }
.gb-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb-msg {
  max-width: 86%; padding: 10px 14px; font-size: 14px; line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word; animation: gb-in .18s ease;
}
.gb-msg-bot { align-self: flex-start; background: var(--gb-bg); border: 1px solid var(--gb-border); border-radius: 4px 16px 16px 16px; }
.gb-msg-user { align-self: flex-end; background: var(--gb-accent); color: #fff; font-weight: 500; border-radius: 16px 4px 16px 16px; }

.gb-typing {
  align-self: flex-start; display: flex; gap: 5px; padding: 14px 16px;
  background: var(--gb-bg); border: 1px solid var(--gb-border); border-radius: 4px 16px 16px 16px;
}
.gb-typing span { width: 7px; height: 7px; border-radius: 50%; background: #A0A5B1; animation: gb-dot 1s infinite ease-in-out; }
.gb-typing span:nth-child(2) { animation-delay: .15s; }
.gb-typing span:nth-child(3) { animation-delay: .3s; }

/* ---------- Quick actions ---------- */
.gb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 2px; }
.gb-tile {
  min-height: 54px; padding: 10px 12px; border-radius: 14px;
  border: 1px solid var(--gb-border); background: var(--gb-bg); color: var(--gb-text);
  cursor: pointer; font-size: 13px; font-weight: 500; text-align: left;
  transition: border-color .15s ease, background .15s ease;
}
.gb-tile:hover { border-color: var(--gb-accent); background: var(--gb-accent-soft); }
.gb-tile-hero {
  grid-column: span 2; display: flex; align-items: center; gap: 12px; min-height: 64px;
  border-color: var(--gb-accent); background: var(--gb-accent-soft);
}
.gb-tile-hero svg { flex: none; width: 26px; height: 26px; color: var(--gb-accent); }
.gb-tile-hero b { display: block; font-family: var(--gb-display); font-size: 15px; font-weight: 700; }
.gb-tile-hero small { display: block; font-size: 12px; color: var(--gb-muted); font-weight: 400; }

.gb-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.gb-chip {
  min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid #D3D6DD; background: var(--gb-bg); color: var(--gb-text);
  font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.gb-chip:hover { border-color: var(--gb-accent); color: var(--gb-accent); }
.gb-chip-wa { border-color: var(--gb-wa); color: var(--gb-wa); font-weight: 600; }
.gb-chip-wa:hover { background: #E8F6EE; color: var(--gb-wa); }

/* ---------- Cards ---------- */
.gb-card {
  align-self: stretch; border-radius: 16px; border: 1px solid var(--gb-border);
  background: var(--gb-bg); overflow: hidden; animation: gb-in .2s ease;
  box-shadow: 0 2px 8px rgba(21,23,28,0.04);
}
.gb-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--gb-border);
}
.gb-card-head strong { font-family: var(--gb-display); font-size: 16px; font-weight: 700; }
.gb-badge { padding: 3px 8px; border-radius: 6px; background: var(--gb-accent-soft); color: var(--gb-accent); font-size: 11px; font-weight: 700; white-space: nowrap; }
.gb-spec { list-style: none; margin: 0; padding: 4px 14px; }
.gb-spec li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--gb-surface); font-size: 13px; }
.gb-spec li:last-child { border-bottom: 0; }
.gb-spec span { color: var(--gb-muted); }
.gb-spec b { font-weight: 600; text-align: right; }
.gb-card-foot { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.gb-price-row { display: flex; align-items: baseline; justify-content: space-between; font-size: 12px; color: var(--gb-muted); }
.gb-price-row b { font-family: var(--gb-display); font-size: 15px; color: var(--gb-text); }
.gb-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 14px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--gb-accent); color: #fff; text-decoration: none; font-size: 14px; font-weight: 700;
}
.gb-btn:hover { background: var(--gb-accent-hover); color: #fff; }
.gb-btn svg { width: 18px; height: 18px; }
.gb-btn-wa { background: var(--gb-wa); }
.gb-btn-wa:hover { background: #0E7340; }
.gb-btn-ghost { background: var(--gb-bg); color: var(--gb-text); border: 1px solid var(--gb-border); font-weight: 500; min-height: 40px; }
.gb-btn-ghost:hover { background: var(--gb-surface); color: var(--gb-text); }

/* ---------- Composer ---------- */
.gb-foot { padding: 10px 12px 12px; border-top: 1px solid var(--gb-border); background: var(--gb-bg); }
.gb-form {
  display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 14px;
  border-radius: 14px; background: var(--gb-surface); border: 1px solid var(--gb-border);
}
.gb-form:focus-within { border-color: var(--gb-accent); background: var(--gb-bg); }
.gb-input {
  flex: 1; min-width: 0; height: 40px; border: 0; outline: none; background: transparent;
  font: inherit; font-size: 14px; color: var(--gb-text);
}
.gb-input::placeholder { color: #80869A; }
.gb-root .gb-input:focus-visible { outline: none; }
.gb-send {
  flex: none; width: 40px; height: 40px; border-radius: 11px; border: 0; cursor: pointer;
  background: var(--gb-accent); color: #fff; display: flex; align-items: center; justify-content: center;
}
.gb-send:hover { background: var(--gb-accent-hover); }
.gb-send:disabled { background: #C9CCD4; cursor: not-allowed; }
.gb-send svg { width: 17px; height: 17px; }
.gb-legal { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--gb-muted); }
.gb-legal a { color: var(--gb-accent); font-weight: 600; text-decoration: none; }
.gb-legal a:hover { text-decoration: underline; }

/* ---------- Mobile: full screen ---------- */
@media (max-width: 480px) {
  .gb-root { right: 14px; bottom: 14px; }
  .gb-panel {
    position: fixed; inset: 0; width: 100%; height: 100%; max-height: none;
    border-radius: 0; border: 0;
  }
  .gb-root.gb-open .gb-launcher { display: none; }
  .gb-msg { font-size: 15px; }
  .gb-input { font-size: 16px; } /* stops iOS zoom on focus */
}

/* ---------- Motion ---------- */
@keyframes gb-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes gb-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes gb-dot { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  .gb-root *, .gb-root *::before, .gb-root *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Chat helpers (products, maps, links, unread badge, restore) ---------- */
/* Product, map and link helpers, using the same colour tokens as gearbot.css */
    .gb-products { align-self: stretch; display: flex; flex-direction: column; gap: 8px; }
    .gb-product {
        display: block; padding: 10px 12px; border: 1px solid var(--gb-border); border-radius: 14px;
        background: var(--gb-bg); color: var(--gb-text); text-decoration: none;
    }
    .gb-product:hover { border-color: var(--gb-accent); background: var(--gb-accent-soft); }
    .gb-product-name { font-weight: 600; font-size: 13px; }
    .gb-product-meta { font-size: 12px; color: var(--gb-muted); margin-top: 3px; }
    .gb-in-stock { color: var(--gb-success); font-weight: 600; }
    .gb-out-stock { color: var(--gb-accent); font-weight: 600; }
    .gb-map { align-self: stretch; border: 1px solid var(--gb-border); border-radius: 16px; overflow: hidden; background: var(--gb-bg); }
    .gb-map iframe { display: block; width: 100%; height: 200px; border: 0; }
    .gb-map .gb-btn-ghost { margin: 8px; }
    .gb-msg-bot a { color: var(--gb-accent); font-weight: 600; word-break: break-all; }
    .gb-msg-bot a:hover { text-decoration: underline; }
    .gb-actions { display: flex; flex-direction: column; gap: 8px; }
    .gb-actions > .gb-grid, .gb-actions > .gb-chips { margin-top: 0; }
    .gb-teaser-text { cursor: pointer; }
    /* Restoring a conversation: no entry animations. */
    .gb-no-anim { animation: none !important; }
    /* "Earlier conversation" divider after a page change. */
    .gb-divider { align-self: center; display: flex; align-items: center; gap: 10px; width: 100%; color: var(--gb-muted); font-size: 12px; margin: 4px 0; }
    .gb-divider::before, .gb-divider::after { content: ''; flex: 1; height: 1px; background: var(--gb-border); }
    /* Unread badge on the launcher. */
    .gb-launcher { position: relative; }
    .gb-unread { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #15171C; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #fff; }
    .gb-unread[hidden] { display: none; }

/* The gear inside the launcher turns slowly (not for reduced motion) */
.gb-launcher .gb-gear { transform-box: fill-box; transform-origin: center; animation: gb-gear-spin 6s linear infinite; }
@keyframes gb-gear-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .gb-launcher .gb-gear { animation: none; } }

/* Phones: the launcher sits above the site's bottom menu bar (about 80px) instead of covering its icons */
@media (max-width: 600px) {
    .gb-root { right: 14px; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
}
