/* ===========================
   FLOORMATE AI CHATBOT CSS
   Brand: CarpetFloorTiles.co.uk
   =========================== */

:root {
  --brand-dark: #002833;
  --brand-accent: #FDBA74;
  --brand-bg: #f8fafc;
  --brand-text: #0f172a;
  --brand-muted: #475569;
  --brand-light: #e6f0f2;
}

/* ROOT WRAPPER */
#aifcb-chatbot-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 14px;
  color: var(--brand-text);
}

/* WRAPPER */
.aifcb-wrapper {
  position: relative;
}

/* ========== LAUNCHER ICON (fixed bottom-right) ========== */
.aifcb-launcher {
  position: fixed;           /* fixed to viewport */
  bottom: 26px;
  right: 26px;
  z-index: 100000;           /* above everything */
  display: flex;
  align-items: center;
  justify-content: center;
}

.aifcb-launcher-inner {
  background: transparent;
  width: 84px;
  height: 84px;
  padding: 0;
  border-radius: 0;
  cursor: pointer;
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aifcb-launcher-inner:hover {
  transform: scale(1.06);
}

.aifcb-launcher-icon img {
  width: 84px;
  height: 84px;
  pointer-events: none;
  animation: floatUp 3s ease-in-out infinite;
  will-change: transform;
}

@keyframes floatUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Adjust for small screens */
@media (max-width: 768px) {
  .aifcb-launcher {
    bottom: 18px;
    right: 18px;
  }

  .aifcb-launcher-inner {
    width: 68px;
    height: 68px;
  }

  .aifcb-launcher-icon img {
    width: 68px;
    height: 68px;
  }
}


/* FLOATING "HELLO" BUBBLE */
.aifcb-floating-hello {
  position: absolute;
  bottom: 100px;
  right: 45px;
  opacity: 0;
  transform: translateY(8px) scale(.95);
  pointer-events: none;
  transition: all .4s ease;
  z-index: 9999;
}
.aifcb-floating-hello.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.aifcb-floating-hello .hello-inner {
  background: var(--brand-dark);
  color: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 16px 32px rgba(0,0,0,0.4);
  min-width: 200px;
}
.aifcb-floating-hello .hello-line {
  font-size: 13px;
  font-weight: 600;
}
.aifcb-floating-hello .hello-sub {
  font-size: 12px;
  opacity: .9;
  margin-top: 4px;
}
.aifcb-floating-hello .hello-tail {
  position: absolute;
  right: 18px;
  bottom: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--brand-dark);
}

/* ========== CHAT WINDOW PANEL ========== */
.aifcb-window {
  position: absolute;
  bottom: 90px;
  right: 0;
  width: 340px;
  max-height: 520px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.4);
  border: 1px solid rgba(0,0,0,0.07);
  overflow: hidden;
  display: none;
  flex-direction: column;
}
.aifcb-wrapper.open .aifcb-window {
  display: flex;
  animation: popup .25s ease;
}
@keyframes popup {
  0% { opacity: 0; transform: translateY(10px) scale(.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* HEADER */
.aifcb-header {
  background: var(--brand-dark);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.aifcb-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.aifcb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
}
.aifcb-avatar img {
  width: 100%;
  height: 100%;
}
.aifcb-brand {
  font-size: 14px;
  font-weight: 600;
}
.aifcb-status {
  font-size: 12px;
  color: #a7f3d0;
}
.aifcb-close-btn {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
}
.aifcb-close-btn:hover {
  background: rgba(255,255,255,0.12);
}

/* MESSAGES */
.aifcb-messages {
  flex: 1;
  background: var(--brand-bg);
  padding: 16px;
  overflow-y: auto;
  font-size: 14px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.aifcb-messages::-webkit-scrollbar { width: 6px; }
.aifcb-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* BUBBLES */
.aifcb-msg {
  display: flex;
  margin-bottom: 14px;
  max-width: 100%;
}
.aifcb-msg.user { justify-content: flex-end; }
.aifcb-msg.bot { justify-content: flex-start; }

.bot-bubble,
.intro-card {
  background: #fff;
  color: var(--brand-text);
  border-radius: 14px 14px 14px 4px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 8px 18px rgba(0,0,0,0.06);
  padding: 12px 14px;
}
.user-bubble {
  background: var(--brand-dark);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
  padding: 10px 12px;
}

/* INTRO BLOCK */
.intro-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.intro-icon img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid rgba(0,0,0,.07);
  padding: 4px;
}
.intro-line {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-text);
}
.intro-sub {
  font-size: 13px;
  color: var(--brand-muted);
  margin-top: 4px;
}

/* SUGGEST BUTTONS */
.intro-suggest {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
.aifcb-suggest {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 6px rgba(0,0,0,0.03);
}
.aifcb-suggest:hover {
  background: #f8fafc;
  transform: translateY(-2px);
}

/* CTA BLOCK */
.intro-cta {
  background: #fffaf6;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  padding: 14px;
  margin-top: 18px;
  text-align: center;
}
.cta-copy {
  font-size: 13px;
  color: #7c2d12;
  margin-bottom: 8px;
}
.cta-btn-quote {
  border: 0;
  border-radius: 8px;
  background: var(--brand-dark);
  color: #fff;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
}
.cta-btn-quote:hover { background: #01414a; }

/* FOOTER INPUT */
.aifcb-footer {
  background: #fff;
  border-top: 1px solid rgba(0,0,0,0.06);
  padding: 12px;
}
.aifcb-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 10px;
}
#aifcb-user-input {
  border: 0;
  outline: 0;
  flex: 1;
  background: transparent;
  font-size: 14px;
}
#aifcb-user-input::placeholder {
  color: #94a3b8;
}
#aifcb-send-btn {
  background: var(--brand-dark);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
  cursor: pointer;
  min-width: 46px;
  box-shadow: 0 4px 10px rgba(0,0,0,.2);
}
#aifcb-send-btn:hover { filter: brightness(1.1); }

/* QUOTE FOOTER BAR */
.aifcb-quote-footer {
  margin-top: 10px;
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.quote-text {
  flex: 1;
  color: var(--brand-text);
  font-weight: 500;
}
.quote-text span {
  display: block;
  font-size: 12px;
  color: var(--brand-muted);
  margin-top: 2px;
}
.quote-action {
  border: 1px solid var(--brand-dark);
  color: var(--brand-dark);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.quote-action:hover {
  background: var(--brand-dark);
  color: #fff !important;
}

/* PRODUCT CARDS */
.aifcb-product-card {
  display: flex;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.07);
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
  padding: 12px;
  margin-top: 12px;
  transition: all 0.22s ease;
}
.aifcb-product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 28px rgba(0,0,0,0.1);
}
.aifcb-card-media { margin-right: 12px; }
.aifcb-prod-img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--brand-light);
  border: 1px solid rgba(0,0,0,0.05);
}
.aifcb-card-body {
  flex: 1;
  line-height: 1.3;
}
.aifcb-prod-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-dark);
  margin-bottom: 2px;
}
.aifcb-prod-price {
  font-size: 13px;
  color: #065f46;
  font-weight: 500;
}
.per-unit {
  font-size: 12px;
  color: var(--brand-muted);
  margin-left: 4px;
}
.aifcb-prod-badges { margin-top: 6px; }
.aifcb-badge {
  display: inline-block;
  background: #dcfce7;
  color: #065f46;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 6px;
}
.aifcb-view-btn {
  display: inline-block;
  background: var(--brand-dark);
  color: #fff;
  border-radius: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  margin-top: 8px;
  text-decoration: none;
}
.aifcb-view-btn:hover {
  background: #C68A3E;
}

/* LINKS IN AI REPLY */
.aifcb-link {
  display: inline-block;
  background: #fff;
  color: var(--brand-dark);
  border: 1px solid var(--brand-dark);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  line-height: 1.2;
  text-decoration: none;
  margin-top: 6px;
}
.aifcb-link:hover {
  background: var(--brand-dark);
  color: #fff;
}

/* TYPING BUBBLE */
.typing-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.06);
  padding: 10px 12px;
}
.dot {
  width: 6px;
  height: 6px;
  background: var(--brand-muted);
  border-radius: 999px;
  margin: 0 2px;
  animation: dots 1.2s infinite ease-in-out;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dots {
  0% { opacity: 0.2; }
  20% { opacity: 1; }
  100% { opacity: 0.2; }
}

/* MOBILE OPTIMIZATION */
@media (max-width: 768px) {
  #aifcb-chatbot-root {
    bottom: 18px;
    right: 18px;
  }
  .aifcb-window {
    width: 95vw;
    max-height: 75vh;
    right: 0;
    bottom: 80px;
  }
  .aifcb-launcher-icon img {
    width: 64px;
    height: 64px;
  }
  .aifcb-floating-hello {
    right: 20px;
    bottom: 80px;
  }
}
.floormate-bubble.show {
  animation: helloPop 0.6s ease forwards;
}

@keyframes helloPop {
  0% { opacity: 0; transform: translateY(12px) scale(0.9); }
  60% { opacity: 1; transform: translateY(-2px) scale(1.03); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.suggest-bubble {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
}

.aifcb-suggest {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.aifcb-suggest:hover {
  background: #fff;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

