:root { --gb-shadow: 0 10px 30px rgba(0,0,0,0.15); }
.gb-floating-root { position: fixed; z-index: 99999; }
.gb-floating-root .gb-fab { position: fixed; bottom: 20px; right: 20px; width: 56px; height: 56px; border-radius: 50%; border: none; background: #111827; color: #fff; font-size: 22px; box-shadow: var(--gb-shadow); cursor: pointer; }
.gb-floating-root .gb-panel.right { position: fixed; bottom: 90px; right: 20px; }
.gb-floating-root .gb-panel.left { position: fixed; bottom: 90px; left: 20px; }
.gb-floating-root .gb-panel { width: 340px; max-height: 70vh; background: #fff; border-radius: 12px; box-shadow: var(--gb-shadow); display: none; flex-direction: column; overflow: hidden; font-family: var(--gb-font-family, inherit); font-size: var(--gb-font-size, 14px); color: var(--gb-font-color, #111827); }
.gb-floating-root .gb-panel.open { display: flex; }
.gb-panel-header { color: #fff; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; }
.gb-title { font-weight: 600; }
.gb-close, .gb-fullscreen, .gb-cart { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); color: #fff; font-size: 16px; cursor: pointer; width: 28px; height: 28px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.gb-close:hover, .gb-fullscreen:hover, .gb-cart:hover { background: rgba(255,255,255,0.18); }
.gb-tools { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #eee; }
.gb-tool { padding: 6px 10px; font-size: 12px; border: 1px solid #ddd; background: #f8f8f8; border-radius: 6px; cursor: pointer; }
.gb-messages { padding: 12px; overflow: auto; display: flex; flex-direction: column; gap: 8px; min-height: 160px; flex: 1; }
.gb-bubble { max-width: 80%; padding: 8px 10px; border-radius: 12px; line-height: 1.4; font-size: inherit; overflow-wrap: anywhere; word-break: break-word; white-space: pre-wrap; }
.gb-bubble.me { align-self: flex-end; background: #e5f2ff; }
.gb-bubble.bot { align-self: flex-start; background: #f2f2f2; }
.gb-chat-row { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #eee; background: #fff; flex-shrink: 0; }
.gb-input { flex: 1; padding: 8px 10px; border: 1px solid #ddd; border-radius: 8px; font-size: inherit; font-family: inherit; color: inherit; }
.gb-send { padding: 8px 12px; border: none; border-radius: 8px; background: #111827; color: #fff; cursor: pointer; font-size: inherit; font-family: inherit; }
.gb-note { font-size: 12px; color: #3b82f6; padding: 0 12px 8px; }
.gb-lead { padding: 12px; display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed #eee; max-height: 100%; overflow: auto; }
.gb-textarea { min-height: 80px; padding: 8px 10px; border: 1px solid #ddd; border-radius: 8px; }
/* User settings (font size/family) */
.gb-user-settings { display: none; padding: 8px 12px; border-bottom: 1px solid #eee; gap: 8px; background: #fafafa; align-items: center; }
.gb-user-settings.open { display: flex; flex-wrap: wrap; }
.gb-user-settings label { font-size: 12px; color: #374151; margin-inline-end: 4px; }
.gb-user-settings select, .gb-user-settings input[type="color"] { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; background: #fff; font-family: inherit; color: inherit; }
.gb-user-settings .gb-field { display: inline-flex; align-items: center; gap: 6px; margin-inline-end: 12px; }
/* New scrollable content wrapper */
.gb-content { display: flex; flex-direction: column; flex: 1; min-height: 0; /* allow children to size */ }
/* Make sure messages can shrink within content and not hide input */
.gb-content .gb-messages { flex: 1; min-height: 0; }

/* Bigger, clearer icon tools (mic/tts) */
.gb-tool--icon { width: 44px; height: 44px; padding: 0; border-radius: 10px; font-size: 20px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #d1d5db; background: #f9fafb; color: #111827; }
.gb-tool--icon:hover { background: #eef2f7; }
.gb-mic.recording { background: #fee2e2; border-color: #ef4444; color: #b91c1c; animation: gb-pulse 1.2s infinite; }
.gb-tts[aria-pressed="true"] { background: #e0e7ff; border-color: #6366f1; color: #3730a3; }

@keyframes gb-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
  70% { box-shadow: 0 0 0 12px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

/* Lead form top bar with back */
.gb-lead-bar { position: sticky; top: 0; background: #fff; display: flex; align-items: center; gap: 8px; padding: 6px 0 10px; border-bottom: 1px solid #eee; z-index: 1; }
.gb-back { width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
/* Fullscreen slider improvements */
.gb-fullscreen .gb-slider-nav {
    position: fixed !important;
    z-index: 999999 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 50% !important;
    width: 60px !important;
    height: 60px !important;
    font-size: 24px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
}

.gb-fullscreen .gb-slider-nav:hover {
    background: rgba(0, 0, 0, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
    transform: translateY(-50%) scale(1.1) !important;
}

.gb-fullscreen .gb-slider-nav.prev {
    left: 30px !important;
}

.gb-fullscreen .gb-slider-nav.next {
    right: 30px !important;
}

.gb-fullscreen .gb-load-more {
    position: fixed !important;
    bottom: 30px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 999999 !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 25px !important;
    padding: 12px 24px !important;
    font-size: 16px !important;
    cursor: pointer !important;
    display: block !important;
    transition: all 0.3s ease !important;
}

.gb-fullscreen .gb-load-more:hover {
    background: rgba(0, 0, 0, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
    transform: translateX(-50%) scale(1.05) !important;
}

@media (max-width: 420px){
  .gb-floating-root .gb-panel { width: calc(100vw - 40px); }
}

/* Fullscreen mode (desktop/tablet) */
.gb-floating-root .gb-panel.gb-fullscreen {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  background: #fff; /* ensure readable background */
  z-index: 2147483647;
}
.gb-floating-root .gb-panel.gb-fullscreen .gb-content { min-height: 0; }
.gb-floating-root .gb-panel.gb-fullscreen .gb-messages { flex: 1; min-height: 0; }
.gb-floating-root .gb-panel.gb-fullscreen .gb-chat-row { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }

/* Fullscreen slider navigation fixes */
.gb-panel.gb-fullscreen .gb-slider-container {
    position: relative !important;
}

.gb-panel.gb-fullscreen .gb-slider-nav {
    position: absolute !important;
    z-index: 1000 !important;
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

.gb-panel.gb-fullscreen .gb-slider-nav button {
    display: flex !important;
    background: rgba(0,0,0,0.8) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    font-size: 20px !important;
    cursor: pointer !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
    transition: all 0.2s ease !important;
}

.gb-panel.gb-fullscreen .gb-slider-nav button:hover {
    background: rgba(0,0,0,0.9) !important;
    transform: scale(1.1) !important;
}

.gb-panel.gb-fullscreen .gb-slider-nav.gb-prev {
    left: 20px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.gb-panel.gb-fullscreen .gb-slider-nav.gb-next {
    right: 20px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

/* Load more button fixes for fullscreen */
.gb-panel.gb-fullscreen .gb-load-more-btn {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: relative !important;
    z-index: 100 !important;
    margin: 15px auto !important;
    padding: 12px 24px !important;
    background: #007cba !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    text-align: center !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    transition: all 0.2s ease !important;
}

.gb-panel.gb-fullscreen .gb-load-more-btn:hover {
    background: #005a87 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
}

/* Ensure slider content doesn't interfere with navigation */
.gb-panel.gb-fullscreen .gb-slider-item {
    position: relative !important;
}

.gb-panel.gb-fullscreen .gb-product-card {
    margin: 0 60px !important; /* Add margin to avoid overlap with nav buttons */
}

/* Product slider and navigation styles */
.gb-product-slider {
  position: relative;
  overflow: hidden;
}
.gb-slider-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  pointer-events: auto;
}
.gb-slider-nav.prev {
  left: 10px;
}
.gb-slider-nav.next {
  right: 10px;
}
.gb-slider-nav button {
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}
.gb-slider-nav button:hover {
  background: rgba(0,0,0,0.8);
}
.gb-load-more-btn {
  display: inline-block;
  background: #4f46e5;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  margin: 10px auto;
  cursor: pointer;
  font-size: 14px;
  text-align: center;
  transition: background-color 0.2s ease;
}
.gb-load-more-btn:hover {
  background: #3730a3;
}

/* Logo wrapper and online badge */
.gb-logo-wrap { position: relative; display: inline-block; line-height: 0; }
.gb-online-badge { position: absolute; left: 0; bottom: -2px; width: 8px; height: 8px; border-radius: 50%; background: #10b981; border: 2px solid rgba(255,255,255,0.9); }

/* Fullscreen chat on mobile */
@media (max-width: 768px){
  .gb-floating-root .gb-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }
  .gb-floating-root .gb-panel.right,
  .gb-floating-root .gb-panel.left { top: 0; right: 0; bottom: 0; left: 0; }

  .gb-content { min-height: 0; }
  .gb-messages { min-height: 0; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .gb-chat-row { position: sticky; bottom: 0; background: #fff; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .gb-panel-header { padding-top: calc(12px + env(safe-area-inset-top)); }
}

/* Larger, clearer voice buttons on small phones */
@media (max-width: 480px){
  .gb-tool--icon { width: 52px; height: 52px; font-size: 22px; }
  .gb-input { font-size: 16px; }
  .gb-send { font-size: 14px; }
}

/* User settings (font size/family) */
.gb-user-settings { display: none; padding: 8px 12px; border-bottom: 1px solid #eee; gap: 8px; background: #fafafa; align-items: center; }
.gb-user-settings.open { display: flex; flex-wrap: wrap; }
.gb-user-settings label { font-size: 12px; color: #374151; margin-inline-end: 4px; }
.gb-user-settings select, .gb-user-settings input[type="color"] { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; background: #fff; font-family: inherit; color: inherit; }
.gb-user-settings .gb-field { display: inline-flex; align-items: center; gap: 6px; margin-inline-end: 12px; }
/* New scrollable content wrapper */
.gb-content { display: flex; flex-direction: column; flex: 1; min-height: 0; /* allow children to size */ }
/* Make sure messages can shrink within content and not hide input */
.gb-content .gb-messages { flex: 1; min-height: 0; }
.gb-actions { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }

/* Product cards slider base */
.gb-slider-wrap { position: relative; }
.gb-slider {
  display: flex;
  gap: 12px;
  padding: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}
.gb-slider.dragging { 
  cursor: grabbing; 
  scroll-behavior: auto; 
}
.gb-slider.dragging, .gb-slider.dragging * { user-select: none; }

/* Individual product card */
.gb-card {
  flex: 0 0 auto;
  scroll-snap-align: start;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px;
  width: 180px;
  max-width: 180px;
  text-align: center; /* Center all content */
}
.gb-card img { 
  width: 100%; 
  max-width: 200px; 
  height: 120px; 
  object-fit: cover; 
  display: block; 
  border-radius: 8px; 
  background: #f5f5f5; 
  margin: 0 auto; /* Center the image */
}
.gb-name { font-weight: 600; margin-top: 6px; text-align: center; }
.gb-price { font-weight: 700; color: #111827; margin: 4px 0 8px; text-align: center; }

.gb-btn { display: inline-block; padding: 6px 8px; background: #0ea5e9; color: #fff; border-radius: 6px; text-decoration: none; transition: opacity .2s; font-size: 12px; }
.gb-btn:hover { opacity: .9; }
.gb-btn--ghost { background: #f1f5f9; color: #0ea5e9; }
.gb-more-wrap { margin: 8px 6px; }

.gb-cart-icon {
  padding: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  text-decoration: none;
  color: inherit;
}

.gb-cart-icon:hover {
  background-color: rgba(0, 0, 0, 0.1);
  transform: scale(1.05);
}

.gb-cart-icon svg {
  transition: transform 0.2s ease;
}

.gb-cart-icon:hover svg {
  transform: scale(1.1);
}

.gb-cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.gb-slider-arrow { position: absolute; top: 50%; transform: translateY(-50%); background: #0ea5e9; color: #fff; border-radius: 999px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; text-decoration: none; opacity: .95; z-index: 2; box-shadow: 0 2px 6px rgba(0,0,0,0.2); outline: none; }
.gb-slider-arrow:focus-visible { outline: 2px solid #fff; box-shadow: 0 0 0 2px #0ea5e9, 0 0 0 6px rgba(14,165,233,.35); }
.gb-slider-prev { left: 6px; }
.gb-slider-next { right: 6px; }
.gb-slider-wrap.gb-rtl .gb-slider-prev { right: 6px; left: auto; }
.gb-slider-wrap.gb-rtl .gb-slider-next { left: 6px; right: auto; }

/* Ensure arrows work properly in RTL */
.gb-slider-wrap.gb-rtl .gb-slider {
  direction: rtl;
}
.gb-slider-wrap.gb-rtl .gb-card {
  direction: ltr; /* Keep card content LTR */
}

/* Fix RTL scrolling behavior */
.gb-slider-wrap.gb-rtl .gb-slider::-webkit-scrollbar {
  display: none;
}
.gb-slider-wrap.gb-rtl .gb-slider {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.gb-slider-arrow.is-disabled { opacity: .4; pointer-events: none; }
.gb-slider-wrap:not(.gb-has-scroll) .gb-slider-arrow { display: none; }
.gb-slider-arrow[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.gb-slider.gb-grabbing {
  cursor: grabbing;
  scroll-behavior: auto; /* More responsive during drag */
}

@media (min-width: 480px){
  .gb-card { width: 200px; max-width: 200px; }
  .gb-card img { height: 140px; max-width: 200px; }
}
@media (min-width: 768px){
  .gb-card { width: 220px; max-width: 220px; }
  .gb-card img { height: 160px; max-width: 200px; }
}

/* --- Refactored from JS -- */

/* Floating Action Button (FAB) */
.gb-fab {
  background-color: var(--gb-primary-color, #111827);
  color: var(--gb-fab-text-color, #fff);
  width: var(--gb-fab-size, 56px);
  height: var(--gb-fab-size, 56px);
  font-size: var(--gb-fab-font-size, 22px);
  border: var(--gb-fab-border, none);
  position: fixed;
}
.gb-fab.transparent {
  background: transparent;
  border: 1px solid var(--gb-primary-color, #111827);
  color: var(--gb-primary-color, #111827);
}
.gb-fab img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
}

/* FAB Positioning */
.gb-fab-pos-bottom-left { bottom: 20px; left: 20px; }
.gb-fab-pos-bottom-center { bottom: 20px; left: 50%; transform: translateX(-50%); }
.gb-fab-pos-top-right { top: 20px; right: 20px; }
.gb-fab-pos-top-left { top: 20px; left: 20px; }
.gb-fab-pos-top-center { top: 20px; left: 50%; transform: translateX(-50%); }
.gb-fab-pos-middle-right { top: 50%; right: 20px; transform: translateY(-50%); }
.gb-fab-pos-middle-left { top: 50%; left: 20px; transform: translateY(-50%); }
.gb-fab-pos-bottom-right { bottom: 20px; right: 20px; }


/* Panel Header */
.gb-panel-header {
  background-color: var(--gb-primary-color, #111827);
}
.gb-panel-header .gb-title-wrap {
  display: inline-flex;
  align-items: center;
}
.gb-panel-header .gb-header-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Header Logo */
.gb-logo-wrap {
  margin-inline-end: 8px;
}
.gb-logo-wrap img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

/* Header Datetime */
.gb-datetime {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 12px;
  line-height: 1.1;
  opacity: 0.9;
}

/* Cart Badge Visibility */
.gb-cart-badge.is-hidden {
  display: none;
}

