/* =========================================================================
   bCloud AI Assistant — chat widget styles
   - Responsive: full-screen on mobile, floating panel on desktop
   - Matches the reference design: rounded header, light bot bubbles,
     blue pill buttons, send arrow, privacy footer.
   ========================================================================= */

:root {
  --bc-primary: #2563eb;
  --bc-primary-dark: #1d4ed8;
  --bc-primary-light: #dbeafe;
  --bc-bg: rgba(255, 255, 255, 0.85); /* Semi-transparent for glass effect */
  --bc-bubble-bot: #f1f5f9;
  --bc-bubble-user: #2563eb;
  --bc-text: #0f172a;
  --bc-text-muted: #64748b;
  --bc-border: rgba(229, 231, 235, 0.5);
  --bc-header-bg: rgba(244, 235, 224, 0.9);
  --bc-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
  --bc-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}


/* Glassmorphism utility */
.glass {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bc-border);
}

/* ---------- Demo page (not part of the embeddable widget) ----------------- */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--bc-font);
  color: var(--bc-text);
  background:
    radial-gradient(1200px 600px at 80% -100px, #dbeafe 0%, transparent 60%),
    radial-gradient(1000px 500px at 0% 100%, #ede9fe 0%, transparent 55%),
    #ffffff;
  min-height: 100vh;
}
.demo-page { max-width: 1180px; margin: 0 auto; padding: 24px; }
.demo-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
}
.demo-logo {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 20px; letter-spacing: -0.01em;
}
.demo-logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--bc-primary), #7c3aed);
  color: #fff; font-weight: 800;
}
.demo-nav-links { display: flex; gap: 24px; align-items: center; }
.demo-nav-links a {
  color: var(--bc-text); text-decoration: none; font-weight: 500; font-size: 15px;
}
.demo-btn-primary {
  background: var(--bc-text); color: #fff !important;
  padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
}
.demo-btn-ghost {
  color: var(--bc-text); font-weight: 600; text-decoration: none;
}
.demo-hero { padding: 80px 0 120px; max-width: 760px; }
.demo-badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: #fff; border: 1px solid var(--bc-border);
  font-size: 13px; font-weight: 500; margin-bottom: 24px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.demo-hero h1 {
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.05; margin: 0 0 24px; letter-spacing: -0.03em; font-weight: 700;
}
.demo-hero h1 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--bc-primary), #7c3aed);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.demo-sub { font-size: 18px; color: var(--bc-text-muted); margin: 0 0 32px; line-height: 1.6; }
.demo-cta-row { display: flex; gap: 16px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .demo-nav-links a:not(.demo-btn-primary) { display: none; }
  .demo-hero { padding: 40px 0 80px; }
}

/* ========================================================================= */
/* ---------- Widget launcher (3D animated) -------------------------------- */
/* ========================================================================= */

/* angle used by the white shine beam */
@property --bc-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* Stage = 3D space + position. Hover lift/tilt lives here so it never
   fights the button's continuous float. */
.bc-launcher-stage {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  display: inline-flex;
  perspective: 1000px;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}
/* Hide the old blue circular pulse */
.bc-launcher-pulse {
  display: none !important;
}
/* breathing purple halo behind the button */
.bc-launcher-stage::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 999px;
  background: radial-gradient(closest-side,
              rgba(97, 39, 203, 0.55),
              rgba(79, 70, 229, 0.28),
              rgba(139, 92, 246, 0) 78%);
  filter: blur(16px);
  opacity: 0.6;
  z-index: -1;
  pointer-events: none;
  animation: bc-glow 3.6s ease-in-out infinite;
}

.bc-launcher {
  position: relative;
  height: 60px;
  padding: 0 24px 0 16px;

  /* SAME gradient border */
  border: 4px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(#f8f8f8, #f7f7f7) padding-box,
    linear-gradient(
      90deg,
      #8B5CF6 0%,
      #6127CB 20%,
      #4F46E5 35%,
      #000 75%,
      #fff 75%,
      #4F46E5 65%,
      #6127CB 80%,
      #8B5CF6 100%
    ) border-box;
  background-size: 100% 100%, 400% 100%;

  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;

  box-shadow:
    0 0 8px rgba(97, 39, 203, 0.45),
    0 0 16px rgba(97, 39, 203, 0.25);

  /* flowing border + continuous 3D float */
  animation:
    borderFlow 10.2s linear infinite,
    bc-float   5s    ease-in-out infinite;

  transform-origin: center;
  will-change: transform, background-position;
}

/* white shine beam travelling around the border (black + colors stay) */
.bc-launcher::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  padding: 4px;                       /* matches the 4px border, sits on the rim */
  background: conic-gradient(from var(--bc-angle),
            transparent 0deg,
            rgba(255, 255, 255, 0) 8deg,
            rgba(255, 255, 255, 0.9) 22deg,
            #ffffff 30deg,
            rgba(255, 255, 255, 0.9) 38deg,
            rgba(255, 255, 255, 0) 55deg,
            transparent 360deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask-composite: exclude;
  animation: bc-beam 3s linear infinite;
  pointer-events: none;
}

@keyframes borderFlow {
  0%   { background-position: 0 0, 0% 50%; }
  100% { background-position: 0 0, 400% 50%; }
}
@keyframes bc-beam { to { --bc-angle: 360deg; } }
@keyframes bc-float {
  0%   { transform: perspective(900px) translateY(0)    rotateX(0)     rotateY(0); }
  25%  { transform: perspective(900px) translateY(-5px) rotateX(3deg)  rotateY(-4deg); }
  50%  { transform: perspective(900px) translateY(0)    rotateX(0)     rotateY(0); }
  75%  { transform: perspective(900px) translateY(-5px) rotateX(-3deg) rotateY(4deg); }
  100% { transform: perspective(900px) translateY(0)    rotateX(0)     rotateY(0); }
}
@keyframes bc-glow {
  0%, 100% { opacity: 0.5;  transform: scale(1); }
  50%      { opacity: 0.85; transform: scale(1.08); }
}

.bc-launcher-inner {
  display: flex;
  align-items: center;
  gap: 0px;
  perspective: 500px; /* gives the sparkle a real 3D flip on hover */
}

.button-avatar {
  transform: scale(1.4);
  transform-origin: center;
  flex-shrink: 0;
  display: block;
  animation: bc-twinkle 3.6s ease-in-out infinite;
}
@keyframes bc-twinkle {
  0%, 100% { transform: scale(1.4)  rotate(0deg); }
  50%      { transform: scale(1.55) rotate(12deg); }
}

.bc-launcher-text {
  color: #000;
  font-family: var(--bc-font, 'Inter', sans-serif);
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

/* hover: springy 3D lift + tilt */
.bc-launcher-stage:hover {
  transform: perspective(1000px) translateY(-10px) scale(1.05);
}
.bc-launcher-stage:hover::before { inset: -16px; filter: blur(22px); }

/* press dip + click burst ring */
.bc-launcher:active .bc-launcher-inner { transform: scale(0.93); }
.bc-launcher-stage.is-clicked::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 2px solid rgba(129, 140, 248, 0.75);
  pointer-events: none;
  animation: bc-burst 0.6s ease-out forwards;
}
@keyframes bc-burst {
  0%   { transform: scale(0.9);  opacity: 0.85; }
  100% { transform: scale(1.85); opacity: 0; }
}

/* ---------- Tooltip ---------- */
.bc-tooltip {
  position: absolute;
  bottom: 85px;
  right: 0;
  width: 270px;
  background: #000000;
  border: 1px solid #333333;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  text-align: left;
  cursor: default;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.bc-launcher-stage:hover .bc-tooltip {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.bc-tooltip-title {
  display: block;
  font-family: var(--bc-font, 'Inter', sans-serif);
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
}
  .bc-tooltip-title:hover{
    color:#ffffff;
  }
.bc-tooltip-text {
  display: block;
  font-family: var(--bc-font, 'Inter', sans-serif);
  font-size: 14px;
  font-weight: 400;
  color: #ffffff;
  line-height: 1.5;
}

.bc-launcher.is-hidden,
.bc-launcher-stage:has(.bc-launcher.is-hidden) { 
  opacity: 0; 
  pointer-events: none; 
  transform: scale(0.7); 
}

/* respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  .bc-launcher,
  .bc-launcher::after,
  .bc-launcher-stage::before,
  .button-avatar { animation: none !important; }
  .bc-launcher-stage { transition: none; }
}
/* ========================================================================= */
/* ---------- Widget panel -------------------------------------------------- */
/* ========================================================================= */
.bc-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-height: min(640px, calc(100vh - 48px));
  height: 640px;
  background: var(--bc-bg);
  border-radius: 18px;
  box-shadow: var(--bc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: var(--bc-font);
  /* Hidden by default */
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.bc-widget.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---------- Header -------------------------------------------------------- */
.bc-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  background: var(--bc-header-bg);
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.bc-header-info { display: flex; align-items: center; gap: 12px; }
.bc-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  flex-shrink: 0;
  overflow: hidden;
}
.bc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.bc-header-text { line-height: 1.1; }
.bc-title { margin: 0; font-size: 13px; font-weight: 700; color: var(--bc-text); }
.bc-subtitle { margin: 1px 0 0; font-size: 10.5px; color: var(--bc-text-muted); }
.bc-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--bc-text-muted); padding: 6px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease;
}
.bc-close:hover { background: rgba(0,0,0,0.06); color: var(--bc-text); }

/* ---------- Messages list ------------------------------------------------- */
.bc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  scroll-behavior: smooth;
}
.bc-messages::-webkit-scrollbar { width: 6px; }
.bc-messages::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,0.15); border-radius: 3px;
}

.bc-msg {
  display: flex; gap: 10px; width: 100%;
  animation: bc-fade-in 0.3s ease;
}
@keyframes bc-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bc-msg--bot { justify-content: flex-start; }
.bc-msg--user { justify-content: flex-end; }

.bc-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--bc-primary), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}
.bc-msg--user .bc-msg-avatar { display: none; }

.bc-msg-bubble {
  background: var(--bc-bubble-bot);
  color: var(--bc-text);
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.35;
  width: auto;
  max-width: 85%;
  word-wrap: break-word;
  white-space: normal;
  text-align: left;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  flex-shrink: 0;
}
.bc-msg--user .bc-msg-bubble {
  background: var(--bc-bubble-user);
  color: #fff;
  border-radius: 18px 18px 2px 18px;
  align-self: flex-end;
  margin-left: auto;
}
.bc-msg--bot .bc-msg-bubble {
  border-radius: 18px 18px 18px 2px;
  align-self: flex-start;
}
.bc-msg-bubble a {
  color: var(--bc-primary-dark);
  text-decoration: underline;
}
.bc-msg-bubble strong {
  font-weight: 700;
}
.bc-msg-bubble p {
  margin: 0 0 6px 0;
}
.bc-msg-bubble p:last-child {
  margin-bottom: 0;
}
.bc-msg-bubble ul {
  margin: 4px 0;
  padding-left: 18px;
}
.bc-msg-bubble li {
  margin-bottom: 2px;
}
.bc-msg-bubble li:last-child {
  margin-bottom: 0;
}
.bc-msg--user .bc-msg-bubble a { color: #fff; }

/* Typing indicator (three bouncing dots) */
.bc-typing {
  display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px;
}
.bc-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--bc-text-muted); opacity: 0.6;
  animation: bc-bounce 1.2s infinite;
}
.bc-typing span:nth-child(2) { animation-delay: 0.15s; }
.bc-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bc-bounce {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.4; }
  30%           { transform: translateY(-4px); opacity: 1;   }
}

/* ---------- Quick action chips ------------------------------------------- */
.bc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 14px 10px;
  background: #fff;
  overflow-x: hidden;
  scrollbar-width: none; /* Hide scrollbar for Firefox */
  -ms-overflow-style: none;  /* Hide scrollbar for IE/Edge */
}
.bc-actions::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}
.bc-chip {
  background: var(--bc-primary);
  color: #fff;
  border: none;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  font-family: inherit;
  flex-shrink: 0;
}
.bc-chip:hover { background: var(--bc-primary-dark); }
.bc-chip:active { transform: scale(0.97); }
.bc-chip:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------- Input area --------------------------------------------------- */
.bc-input-wrap {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px 4px;
  background: #fff;
}
.bc-input {
  flex: 1;
  border: 1.5px solid var(--bc-primary);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  color: var(--bc-text);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.bc-input:focus {
  border-color: var(--bc-primary-dark);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.bc-input::placeholder { color: #94a3b8; }
.bc-send {
  background: transparent;
  border: none;
  color: var(--bc-primary);
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
}
.bc-send:hover { background: var(--bc-primary-light); }
.bc-send:active { transform: scale(0.92); }
.bc-send:disabled { color: #94a3b8; cursor: not-allowed; }

/* ---------- Footer ------------------------------------------------------- */
.bc-footer {
  margin: 0;
  padding: 4px 14px 8px;
  font-size: 10px;
  color: var(--bc-text-muted);
  line-height: 1.3;
  background: #fff;
  border-top: 1px solid var(--bc-border);
}
.bc-footer a { color: var(--bc-text); text-decoration: underline; }

/* ========================================================================= */
/* ---------- Responsive: mobile takes the full screen --------------------- */
/* ========================================================================= */
@media (max-width: 520px) {
  .bc-widget {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100dvh;          /* full viewport on phones */
    max-height: 100dvh;
    border-radius: 0;
  }
.bc-launcher-stage {
    bottom: 18px;
    right: 18px;
  }
  .bc-msg-bubble { max-width: 82%; font-size: 15px; }
  .bc-actions { padding: 4px 14px 10px; }
  .bc-chip { padding: 10px 16px; font-size: 14px; }
}

/* Slightly larger touch targets on tablets */
@media (min-width: 521px) and (max-width: 900px) {
  .bc-widget { width: 360px; height: 600px; }
}
