/* CartBuddy Widget v1.9 — Premium */
#cb-widget-root *,
#cb-widget-root *::before,
#cb-widget-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* ── CSS Variables ─────────────────── */
#cb-widget-root {
  --cb-accent:        #2563eb;
  --cb-btn-color:     #ffffff;
  --cb-panel-bg:      #13162b;
  --cb-header-bg:     #1a1e35;
  --cb-text:          #f1f5f9;
  --cb-text-muted:    #8892a4;
  --cb-input-bg:      #1e2340;
  --cb-action-bg:     #1e2340;
  --cb-action-hover:  #252b48;
  --cb-border:        rgba(255,255,255,.07);
  --cb-border-hover:  rgba(255,255,255,.14);
  --cb-user-bubble:   var(--cb-accent);
  --cb-ai-bubble:     #1e2340;
  --cb-panel-radius:  22px;
  --cb-btn-radius:    14px;
  --cb-fab-size:      60px;
  --cb-panel-width:   360px;
  --cb-panel-height:  600px;

  position: fixed;
  z-index: 999999;
  bottom: 28px;
  right: 28px;
}
#cb-widget-root.cb-pos-left { right: auto; left: 28px; }

/* ── FAB ───────────────────────────── */
#cb-fab {
  width: var(--cb-fab-size);
  height: var(--cb-fab-size);
  border-radius: 50%;
  background: var(--cb-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.2);
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  outline: none;
  margin-left: auto;
  position: relative;
}
#cb-fab:hover  { transform: scale(1.1); box-shadow: 0 12px 40px rgba(0,0,0,.5); }
#cb-fab:active { transform: scale(.95); }
#cb-fab::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--cb-accent);
  opacity: 0;
  animation: cb-pulse 2.8s ease-out infinite;
}
@keyframes cb-pulse {
  0%   { transform: scale(1); opacity: .55; }
  70%  { transform: scale(1.3); opacity: 0; }
  100% { opacity: 0; }
}
#cb-fab.cb-open::before  { animation: none; }
#cb-fab .cb-icon-close   { display: none; }
#cb-fab.cb-open .cb-icon-open  { display: none; }
#cb-fab.cb-open .cb-icon-close { display: block; }

/* ── Panel ─────────────────────────── */
#cb-panel {
  position: absolute;
  bottom: calc(var(--cb-fab-size) + 16px);
  right: 0;
  width: var(--cb-panel-width);
  max-height: var(--cb-panel-height);
  background: var(--cb-panel-bg);
  border-radius: var(--cb-panel-radius);
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 4px 16px rgba(0,0,0,.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  transform: scale(.86) translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .22s;
}
.cb-pos-left #cb-panel { right: auto; left: 0; transform-origin: bottom left; }
#cb-panel.cb-visible   { transform: scale(1) translateY(0); opacity: 1; pointer-events: all; }

/* ── Header ────────────────────────── */
#cb-header {
  padding: 18px 20px 17px;
  background: var(--cb-header-bg);
  border-bottom: 1px solid var(--cb-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}
.cb-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--cb-accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.cb-avatar--logo { background: rgba(255,255,255,.08); padding: 4px; }
.cb-header-text h2 {
  font-size: 16px; font-weight: 700;
  color: var(--cb-text); line-height: 1.2;
  letter-spacing: -.01em;
}
.cb-online-badge {
  font-size: 12px; color: var(--cb-text-muted);
  margin-top: 4px; display: flex; align-items: center; gap: 6px;
}
.cb-online-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e; flex-shrink: 0;
  animation: cb-blink 2.2s ease-in-out infinite;
}
@keyframes cb-blink {
  0%,100% { opacity: 1; }
  50%      { opacity: .45; }
}

/* ── Body ──────────────────────────── */
#cb-body {
  flex: 1; overflow-y: auto;
  padding: 22px 20px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
}
#cb-body::-webkit-scrollbar       { width: 3px; }
#cb-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }

/* ── Step animation ────────────────── */
.cb-step { animation: cb-fade-up .25s cubic-bezier(.16,1,.3,1); }
@keyframes cb-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Greeting ──────────────────────── */
.cb-greeting {
  font-size: 17px; font-weight: 700;
  color: var(--cb-text);
  margin-bottom: 20px; line-height: 1.45;
  letter-spacing: -.01em;
}

/* ── Action buttons ────────────────── */
.cb-actions { display: flex; flex-direction: column; gap: 8px; }

.cb-action-btn {
  display: flex; align-items: center; gap: 15px;
  padding: 15px 16px;
  background: var(--cb-action-bg);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-btn-radius);
  cursor: pointer;
  transition: background .18s, border-color .18s, transform .14s;
  text-align: left; width: 100%;
  position: relative;
}
.cb-action-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--cb-btn-radius);
  opacity: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.04), rgba(255,255,255,0));
  transition: opacity .18s;
}
.cb-action-btn:hover {
  background: var(--cb-action-hover);
  border-color: var(--cb-border-hover);
  transform: translateX(3px);
}
.cb-action-btn:hover::after { opacity: 1; }
.cb-action-btn:active { transform: translateX(1px) scale(.99); }

.cb-action-icon-wrap {
  width: 42px; height: 42px;
  border-radius: calc(var(--cb-btn-radius) - 2px);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cb-action-label {
  font-size: 15px; font-weight: 600;
  color: var(--cb-text); line-height: 1;
  flex: 1;
}
.cb-action-arrow {
  color: var(--cb-text-muted); font-size: 18px; font-weight: 300;
  opacity: 0; transform: translateX(-6px);
  transition: opacity .18s, transform .18s;
  flex-shrink: 0;
}
.cb-action-btn:hover .cb-action-arrow { opacity: 1; transform: translateX(0); }

/* ── Back + Flow title ─────────────── */
.cb-back-btn {
  background: none; border: none;
  color: var(--cb-text-muted); font-size: 13px;
  cursor: pointer; padding: 0 0 18px;
  display: flex; align-items: center; gap: 6px;
  transition: color .15s;
}
.cb-back-btn:hover { color: var(--cb-text); }

.cb-flow-title {
  font-size: 16px; font-weight: 700;
  color: var(--cb-text); letter-spacing: -.01em;
  margin-bottom: 18px;
}

/* ── Input fields ──────────────────── */
.cb-field-group { margin-bottom: 14px; }
.cb-field-group label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--cb-text-muted);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em;
}
.cb-field-group input,
.cb-field-group textarea {
  width: 100%; padding: 12px 14px;
  background: var(--cb-input-bg);
  border: 1.5px solid rgba(255,255,255,.09);
  border-radius: var(--cb-btn-radius);
  font-size: 14px; color: var(--cb-text);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  resize: vertical;
  line-height: 1.5;
}
.cb-field-group input::placeholder,
.cb-field-group textarea::placeholder { color: rgba(255,255,255,.2); }
.cb-field-group input:focus,
.cb-field-group textarea:focus {
  border-color: var(--cb-accent);
  box-shadow: 0 0 0 4px rgba(37,99,235,.18);
}
.cb-field-group textarea { min-height: 82px; }

/* ── Validation states ─────────────── */
.cb-field-invalid input,
.cb-field-invalid textarea {
  border-color: rgba(248,113,113,.65) !important;
  box-shadow: 0 0 0 3px rgba(248,113,113,.12) !important;
}
.cb-field-valid input,
.cb-field-valid textarea { border-color: rgba(74,222,128,.45) !important; }
.cb-field-error {
  font-size: 12px; color: #fca5a5;
  margin-top: 5px; line-height: 1.4;
  animation: cb-fade-up .15s ease;
}
.cb-opt-tag {
  font-weight: 400; opacity: .4;
  font-size: 10px; text-transform: none; letter-spacing: 0;
}

/* ── Submit button ─────────────────── */
.cb-submit-btn {
  width: 100%; padding: 14px;
  background: var(--cb-accent); color: #fff;
  border: none; border-radius: var(--cb-btn-radius);
  font-size: 15px; font-weight: 700; letter-spacing: -.01em;
  cursor: pointer; margin-top: 10px;
  transition: filter .2s, transform .14s;
  position: relative; overflow: hidden;
}
.cb-submit-btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0);
  transition: background .2s;
}
.cb-submit-btn:hover::after  { background: rgba(255,255,255,.08); }
.cb-submit-btn:active        { transform: scale(.98); }
.cb-submit-btn:disabled      { opacity: .55; cursor: not-allowed; }

/* ── Spinner ───────────────────────── */
.cb-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
  border-radius: 50%; animation: cb-spin .7s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
@keyframes cb-spin { to { transform: rotate(360deg); } }

/* ── Error box ─────────────────────── */
.cb-error-msg {
  background: rgba(220,38,38,.12); color: #fca5a5;
  border: 1px solid rgba(220,38,38,.2); border-radius: 10px;
  padding: 10px 14px; font-size: 13px; margin-top: 10px; display: none;
  line-height: 1.5;
}
.cb-error-msg.cb-show { display: block; }

/* ── Honeypot ──────────────────────── */
.cb-hp { display: none !important; }

/* ── Hours banners ─────────────────── */
.cb-hours-banner {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 16px; border-radius: var(--cb-btn-radius);
  font-size: 13px; line-height: 1.55; margin-bottom: 16px;
}
.cb-hours-banner--closed { background: rgba(249,115,22,.1); border: 1px solid rgba(249,115,22,.2); color: #fed7aa; }
.cb-hours-banner--warn   { background: rgba(234,179,8,.09); border: 1px solid rgba(234,179,8,.2);  color: #fde68a; }
.cb-hours-banner-icon    { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* ── Address cards ─────────────────── */
.cb-address-card {
  background: var(--cb-input-bg);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-btn-radius);
  padding: 18px;
}
.cb-address-card--multi { margin-bottom: 10px; }
.cb-address-card--multi:last-child { margin-bottom: 0; }

.cb-loc-name {
  font-size: 14px; font-weight: 700;
  color: var(--cb-text);
  margin-bottom: 14px; padding-bottom: 11px;
  border-bottom: 1px solid var(--cb-border);
  letter-spacing: -.01em;
}
.cb-loc-row {
  display: flex; align-items: flex-start;
  gap: 10px; margin-bottom: 11px;
  font-size: 13.5px; color: #94a3b8; line-height: 1.55;
}
.cb-loc-row:last-child { margin-bottom: 0; }
.cb-loc-row svg    { flex-shrink: 0; margin-top: 2px; color: var(--cb-text-muted); opacity: .75; }
.cb-loc-phone      { color: #60a5fa; text-decoration: none; }
.cb-loc-phone:hover{ text-decoration: underline; }
.cb-loc-map-row    { margin-top: 14px; }
.cb-map-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; background: var(--cb-accent); color: #fff;
  border-radius: var(--cb-btn-radius); font-size: 13px; font-weight: 600;
  text-decoration: none; transition: filter .2s;
}
.cb-map-btn:hover  { filter: brightness(1.12); color: #fff; }
.cb-map-btn svg    { color: #fff; opacity: 1; margin-top: 0; }

/* ── Success screen ────────────────── */
.cb-success { text-align: center; padding: 32px 16px; animation: cb-fade-up .3s ease; }
.cb-success-icon {
  width: 60px; height: 60px;
  background: rgba(34,197,94,.12); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; font-size: 28px;
}
.cb-success h3 { font-size: 17px; font-weight: 700; color: var(--cb-text); margin-bottom: 8px; letter-spacing: -.01em; }
.cb-success p  { font-size: 14px; color: var(--cb-text-muted); line-height: 1.6; }
.cb-success-actions { margin-top: 20px; }
.cb-new-btn {
  padding: 10px 22px; background: var(--cb-input-bg);
  border: 1px solid var(--cb-border); border-radius: var(--cb-btn-radius);
  font-size: 13px; font-weight: 600; cursor: pointer; color: var(--cb-text);
  transition: background .15s;
}
.cb-new-btn:hover { background: var(--cb-action-hover); }

/* ── Booking CTA ───────────────────── */
.cb-booking-cta {
  background: rgba(34,197,94,.08);
  border: 1px solid rgba(34,197,94,.18);
  border-radius: var(--cb-btn-radius); padding: 18px; margin-top: 14px; text-align: center;
}
.cb-booking-cta p { font-size: 13px; color: #94a3b8; margin-bottom: 12px; line-height: 1.55; }
.cb-booking-link-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; background: #22c55e; color: #fff;
  border-radius: var(--cb-btn-radius); font-size: 14px; font-weight: 700;
  text-decoration: none; transition: filter .2s;
}
.cb-booking-link-btn:hover { filter: brightness(1.08); color: #fff; }

/* ── AI chat ───────────────────────── */
.cb-ai-messages {
  display: flex; flex-direction: column; gap: 10px;
  min-height: 80px; max-height: 250px; overflow-y: auto;
  margin-bottom: 14px; padding-right: 4px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.08) transparent;
}
.cb-ai-messages::-webkit-scrollbar       { width: 3px; }
.cb-ai-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.cb-ai-bubble {
  padding: 11px 15px; border-radius: 16px;
  font-size: 14px; line-height: 1.6; max-width: 88%;
  word-break: break-word; animation: cb-fade-up .2s ease;
}
.cb-ai-bubble--user      { background: var(--cb-user-bubble); color: #fff; align-self: flex-end; border-bottom-right-radius: 5px; }
.cb-ai-bubble--assistant { background: var(--cb-ai-bubble);   color: var(--cb-text); align-self: flex-start; border-bottom-left-radius: 5px; }

.cb-ai-typing { display: flex; align-items: center; gap: 5px; padding: 14px 16px; }
.cb-ai-typing span {
  width: 7px; height: 7px; background: #94a3b8; border-radius: 50%;
  animation: cb-bounce .9s ease-in-out infinite;
}
.cb-ai-typing span:nth-child(2) { animation-delay: .15s; }
.cb-ai-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes cb-bounce {
  0%,80%,100% { transform: translateY(0); opacity: .4; }
  40%          { transform: translateY(-5px); opacity: 1; }
}
.cb-ai-input-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.cb-ai-send-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: var(--cb-btn-radius);
  background: var(--cb-accent); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #fff;
  transition: filter .15s, transform .12s;
}
.cb-ai-send-btn:hover   { filter: brightness(1.12); }
.cb-ai-send-btn:active  { transform: scale(.94); }
.cb-ai-send-btn:disabled{ opacity: .5; cursor: not-allowed; }
.cb-ai-input {
  flex: 1; padding: 12px 14px;
  background: var(--cb-input-bg);
  border: 1.5px solid rgba(255,255,255,.09);
  border-radius: var(--cb-btn-radius);
  font-size: 14px; color: var(--cb-text); outline: none;
  transition: border-color .15s;
}
.cb-ai-input::placeholder { color: rgba(255,255,255,.2); }
.cb-ai-input:focus        { border-color: var(--cb-accent); }

.cb-ai-cta-box {
  background: rgba(37,99,235,.12);
  border: 1px solid rgba(37,99,235,.22);
  border-radius: var(--cb-btn-radius); padding: 14px; margin-top: 12px;
  animation: cb-fade-up .25s ease;
}
.cb-ai-cta-box p { font-size: 13px; color: #94a3b8; margin-bottom: 10px; line-height: 1.5; }
.cb-ai-cta-btns  { display: flex; gap: 8px; flex-wrap: wrap; }
.cb-ai-cta-btn {
  padding: 9px 16px; background: var(--cb-accent); color: #fff; border: none;
  border-radius: var(--cb-btn-radius); font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: filter .15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.cb-ai-cta-btn:hover { filter: brightness(1.1); color: #fff; }
.cb-ai-cta-btn--ghost {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
}
.cb-ai-cta-btn--ghost:hover { background: rgba(255,255,255,.13); }

/* ── Footer ────────────────────────── */
#cb-footer {
  padding: 10px 20px; text-align: center;
  font-size: 11px; color: rgba(255,255,255,.18);
  border-top: 1px solid var(--cb-border); flex-shrink: 0;
  letter-spacing: .01em;
}
#cb-footer a { color: rgba(255,255,255,.25); text-decoration: none; }

/* ── Size variants ─────────────────── */
#cb-widget-root.cb-size-sm { --cb-panel-width: 300px; --cb-panel-height: 520px; --cb-fab-size: 54px; }
#cb-widget-root.cb-size-lg { --cb-panel-width: 420px; --cb-panel-height: 640px; --cb-fab-size: 66px; }

/* ── Shape variants ────────────────── */
#cb-widget-root.cb-shape-pill   { --cb-panel-radius: 26px; --cb-btn-radius: 100px; }
#cb-widget-root.cb-shape-square { --cb-panel-radius: 8px;  --cb-btn-radius: 8px; }

/* ── Mobile ────────────────────────── */
@media (max-width: 420px) {
  #cb-widget-root               { bottom: 16px; right: 12px; }
  #cb-widget-root.cb-pos-left   { left: 12px; }
  #cb-panel                     { width: calc(100vw - 28px) !important; }
}

/* ── Social flow ───────────────────── */
.cb-social-links { display: flex; flex-direction: column; gap: 8px; }
.cb-social-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  background: var(--cb-action-bg);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-btn-radius);
  text-decoration: none;
  transition: background .18s, border-color .18s, transform .14s;
}
.cb-social-btn:hover {
  background: var(--cb-action-hover);
  border-color: var(--cb-border-hover);
  transform: translateX(3px);
}
.cb-social-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cb-social-icon svg { width: 20px; height: 20px; }
.cb-social-btn-label {
  font-size: 15px; font-weight: 600; color: var(--cb-text);
}

/* ── Proactive trigger ─────────────── */
@keyframes cb-bounce-fab {
  0%,100% { transform: scale(1); }
  20%      { transform: scale(1.18); }
  40%      { transform: scale(.92); }
  60%      { transform: scale(1.10); }
  80%      { transform: scale(.97); }
}
#cb-fab.cb-fab-bounce { animation: cb-bounce-fab .6s ease; }

/* Notification speech bubble above FAB */
.cb-notif-bubble {
  position: absolute;
  bottom: calc(var(--cb-fab-size) + 12px);
  right: 0;
  background: #ffffff;
  color: #111827;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  padding: 12px 36px 12px 16px;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.1);
  max-width: 240px;
  cursor: pointer;
  animation: cb-fade-up .35s cubic-bezier(.16,1,.3,1);
  white-space: normal;
  z-index: 1;
}
.cb-notif-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 20px;
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 0px solid transparent;
  border-top: 8px solid #ffffff;
}
.cb-notif-bubble:hover { box-shadow: 0 12px 40px rgba(0,0,0,.22); }
.cb-notif-close {
  position: absolute;
  top: 8px; right: 8px;
  background: none; border: none;
  font-size: 16px; color: #9ca3af;
  cursor: pointer; line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .15s;
}
.cb-notif-close:hover { color: #374151; }

/* Left-position variant */
.cb-pos-left .cb-notif-bubble {
  right: auto; left: 0;
  border-radius: 16px 16px 16px 4px;
}
.cb-pos-left .cb-notif-bubble::after {
  right: auto; left: 20px;
}

/* ── GDPR consent checkbox ─────────── */
.cb-gdpr-wrap {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-btn-radius);
}
.cb-gdpr-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--cb-text-muted);
  line-height: 1.5;
}
.cb-gdpr-check {
  width: 17px; height: 17px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--cb-accent);
  cursor: pointer;
  border-radius: 4px;
}
.cb-gdpr-error {
  font-size: 12px;
  color: #fca5a5;
  margin-top: 6px;
  padding-left: 27px;
  animation: cb-fade-up .15s ease;
}
