/* =========================================================
   BusyBeeWork / Gaotus Chat UI — Premium Bee Support
   Clean dark panel | Bee yellow accent | Compact buttons
   ========================================================= */

/* --- ROOT / RESET IN WIDGET --- */
#bp-ai-widget{
  position:fixed;
  bottom:20px;
  right:20px;
  z-index:999999;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;

  --bp-bg:#07090d;
  --bp-surface:#0b0f16;
  --bp-surface2:#111722;
  --bp-card:rgba(255,255,255,.045);
  --bp-line:rgba(255,255,255,.10);
  --bp-line2:rgba(255,255,255,.16);
  --bp-text:#f7f8fb;
  --bp-muted:rgba(247,248,251,.66);

  /* BusyBeeWork accents */
  --bp-bee:#ffbf00;
  --bp-bee2:#ffd24a;
  --bp-bee-dark:#c98c00;
  --bp-black:#0a0b0f;

  --bp-radius:24px;
  --bp-radius2:16px;
  --bp-shadow:0 24px 70px rgba(0,0,0,.72);
  --bp-shadow2:0 18px 45px rgba(0,0,0,.55);
}

#bp-ai-widget,
#bp-ai-widget *{
  box-sizing:border-box;
  font-family:inherit;
}

/* =========================================================
   FAB BUTTON
   ========================================================= */
#bp-ai-fab{
  width:72px;
  height:72px;
  border:1px solid rgba(255,191,0,.32);
  background:
    radial-gradient(120% 140% at 30% 20%, rgba(255,255,255,.18) 0, rgba(255,255,255,0) 55%),
    linear-gradient(180deg, rgba(20,24,34,.96), rgba(8,10,14,.98));
  padding:4px;
  border-radius:999px;
  cursor:pointer;
  box-shadow:0 18px 55px rgba(0,0,0,.70);
  display:flex;
  align-items:center;
  justify-content:center;
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  animation:bp-ai-pulse 3.2s infinite;
}

#bp-ai-fab:hover{
  transform:translateY(-2px) scale(1.02);
  border-color:rgba(255,191,0,.70);
  box-shadow:0 22px 65px rgba(0,0,0,.78);
}

#bp-ai-fab img{
  width:62px;
  height:62px;
  border-radius:999px;
  display:block;
  object-fit:cover;
  background:#0b0c0e;
  border:1px solid rgba(255,255,255,.14);
}

/* =========================================================
   PANEL
   ========================================================= */
#bp-ai-panel{
  width:430px;
  max-width:calc(100vw - 28px);
  background:
    radial-gradient(100% 80% at 14% 0%, rgba(255,191,0,.12) 0, rgba(255,191,0,0) 48%),
    linear-gradient(180deg, #0f1219 0%, #080b11 100%);
  color:var(--bp-text);
  border-radius:26px;
  box-shadow:var(--bp-shadow);
  overflow:hidden;
  border:1px solid rgba(255,255,255,.10);
  backdrop-filter:blur(12px);
}

/* =========================================================
   HEADER
   ========================================================= */
#bp-ai-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:15px 16px;
  min-height:76px;
  background:
    radial-gradient(120% 140% at 18% 0%, rgba(255,191,0,.16) 0, rgba(255,191,0,0) 55%),
    linear-gradient(180deg, rgba(20,23,32,.95), rgba(12,14,20,.96));
  border-bottom:1px solid rgba(255,255,255,.085);
  color:var(--bp-text);
}

.bp-ai-head-left{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}

#bp-ai-avatar{
  width:48px;
  height:48px;
  min-width:48px;
  border-radius:999px;
  border:2px solid rgba(255,191,0,.75);
  background:#0b0c0e;
  object-fit:cover;
  box-shadow:0 8px 20px rgba(0,0,0,.35);
}

.bp-ai-head-meta{
  display:flex;
  flex-direction:column;
  line-height:1.15;
  min-width:0;
}

#bp-ai-agent-name{
  font-weight:900;
  letter-spacing:-.015em;
  font-size:18px;
  color:#fff;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.bp-ai-head-sub{
  margin-top:3px;
  font-size:12px;
  color:var(--bp-muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* Right actions */
.bp-ai-head-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-shrink:0;
}

/* Request button - repaired, compact, not bulky */
.bp-ai-offer-btn{
  height:38px;
  border:1px solid rgba(255,191,0,.34);
  background:rgba(255,191,0,.08);
  color:var(--bp-bee2);
  padding:0 15px;
  border-radius:13px;
  font-weight:850;
  font-size:12px;
  cursor:pointer;
  text-transform:uppercase;
  letter-spacing:.08em;
  line-height:1;
  box-shadow:none;
  transition:background .16s ease, border-color .16s ease, transform .16s ease, color .16s ease;
}

.bp-ai-offer-btn:hover{
  background:rgba(255,191,0,.14);
  border-color:rgba(255,191,0,.70);
  color:#fff1a6;
  transform:translateY(-1px);
}

#bp-ai-close{
  width:36px;
  height:36px;
  border:0;
  background:transparent;
  font-size:25px;
  line-height:1;
  cursor:pointer;
  color:rgba(247,248,251,.78);
  padding:0;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:background .16s ease, color .16s ease, transform .16s ease;
}

#bp-ai-close:hover{
  background:rgba(255,255,255,.07);
  color:#fff;
  transform:rotate(4deg);
}

/* =========================================================
   BODY + MESSAGES
   ========================================================= */
#bp-ai-body{
  padding:14px 14px 10px;
}

#bp-ai-messages{
  height:330px;
  overflow:auto;
  padding:2px 2px 10px;
  scrollbar-width:thin;
  scrollbar-color:rgba(255,255,255,.18) transparent;
}

#bp-ai-messages::-webkit-scrollbar{ width:10px; }

#bp-ai-messages::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.15);
  border-radius:10px;
  border:3px solid transparent;
  background-clip:content-box;
}

#bp-ai-messages::-webkit-scrollbar-thumb:hover{
  background:rgba(255,255,255,.24);
  border:3px solid transparent;
  background-clip:content-box;
}

.bp-ai-msg{
  display:flex;
  margin:9px 0;
}

.bp-ai-msg.user{
  justify-content:flex-end;
}

.bp-ai-bub{
  max-width:84%;
  padding:11px 14px;
  border-radius:17px;
  line-height:1.45;
  font-size:14px;
  background:rgba(255,255,255,.055);
  border:1px solid rgba(255,255,255,.105);
  color:var(--bp-text);
  box-shadow:0 12px 26px rgba(0,0,0,.26);
}

.bp-ai-msg.ai .bp-ai-bub{
  border-top-left-radius:8px;
}

.bp-ai-msg.user .bp-ai-bub{
  background:
    radial-gradient(120% 120% at 20% 0%, rgba(255,255,255,.18) 0, rgba(255,255,255,0) 58%),
    linear-gradient(180deg, #ffd24a 0%, #ffbf00 100%);
  border-color:rgba(255,191,0,.72);
  color:#17110a;
  font-weight:750;
  border-top-right-radius:8px;
  box-shadow:0 12px 30px rgba(255,191,0,.18), 0 10px 24px rgba(0,0,0,.30);
}

.bp-ai-typing{
  opacity:.88;
  letter-spacing:.12em;
}

/* =========================================================
   INPUT ROW - repaired sizes
   ========================================================= */
#bp-ai-row{
  display:grid;
  grid-template-columns:1fr auto;
  align-items:center;
  gap:10px;
  margin-top:8px;
}

#bp-ai-input{
  width:100%;
  height:54px;
  min-width:0;
  padding:0 16px;
  border-radius:17px;
  border:1px solid rgba(255,255,255,.13);
  background:rgba(0,0,0,.22);
  color:var(--bp-text);
  font-size:14px;
  outline:none;
  transition:border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

#bp-ai-input::placeholder{
  color:rgba(247,248,251,.42);
}

#bp-ai-input:focus{
  border-color:rgba(255,191,0,.62);
  box-shadow:0 0 0 3px rgba(255,191,0,.16);
  background:rgba(0,0,0,.30);
}

/* Send button - no longer bulky */
#bp-ai-send{
  height:54px;
  min-width:88px;
  padding:0 20px;
  border-radius:17px;
  border:1px solid rgba(255,191,0,.45);
  background:
    radial-gradient(120% 140% at 20% 0%, rgba(255,255,255,.22) 0, rgba(255,255,255,0) 58%),
    linear-gradient(180deg, #ffd24a 0%, #ffbf00 100%);
  color:#161006;
  font-size:13px;
  font-weight:950;
  cursor:pointer;
  text-transform:uppercase;
  letter-spacing:.08em;
  white-space:nowrap;
  transition:transform .16s ease, filter .16s ease, box-shadow .16s ease, border-color .16s ease;
  box-shadow:0 12px 26px rgba(255,191,0,.14), 0 10px 24px rgba(0,0,0,.35);
}

#bp-ai-send:hover{
  transform:translateY(-1px);
  filter:brightness(1.04);
  border-color:rgba(255,191,0,.80);
}

#bp-ai-send:active{
  transform:translateY(0);
}

/* If the button contains SVG only, keep it centered */
#bp-ai-send svg{
  display:block;
}

/* =========================================================
   POWERED BY FOOTER
   ========================================================= */
#bp-ai-powered{
  margin-top:10px;
  padding:9px 4px 0;
  text-align:center;
  color:rgba(247,248,251,.52);
  font-size:11.5px;
  line-height:1.3;
  letter-spacing:.01em;
  border-top:1px solid rgba(255,255,255,.06);
}

#bp-ai-powered strong{
  color:rgba(255,210,74,.92);
  font-weight:850;
}

/* =========================================================
   OFFER / REQUEST MODAL
   ========================================================= */
#bp-ai-offer-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.68);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:1000000;
}

.bp-ai-offer-overlay{
  position:absolute;
  inset:0;
}

.bp-ai-offer-card{
  position:relative;
  width:min(520px,92vw);
  background:
    radial-gradient(120% 120% at 20% 0%, rgba(255,191,0,.12) 0, rgba(255,191,0,0) 55%),
    linear-gradient(180deg, rgba(18,22,32,.98), rgba(8,10,14,.98));
  border:1px solid rgba(255,255,255,.12);
  border-radius:22px;
  padding:18px;
  color:var(--bp-text);
  box-shadow:var(--bp-shadow2);
}

.bp-ai-offer-title{
  font-weight:950;
  margin-bottom:12px;
  text-transform:uppercase;
  letter-spacing:.07em;
  font-size:13px;
  color:#fff;
}

.bp-ai-offer-fields{
  display:grid;
  gap:9px;
}

#bp-ai-offer-modal input,
#bp-ai-offer-modal textarea{
  width:100%;
  margin:0;
  padding:12px 13px;
  border-radius:15px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.22);
  color:var(--bp-text);
  font-size:14px;
  outline:none;
  transition:border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

#bp-ai-offer-modal textarea{
  min-height:118px;
  resize:vertical;
}

#bp-ai-offer-modal input::placeholder,
#bp-ai-offer-modal textarea::placeholder{
  color:rgba(247,248,251,.42);
}

#bp-ai-offer-modal input:focus,
#bp-ai-offer-modal textarea:focus{
  border-color:rgba(255,191,0,.62);
  box-shadow:0 0 0 3px rgba(255,191,0,.16);
  background:rgba(0,0,0,.30);
}

.bp-ai-offer-actions{
  display:flex;
  gap:10px;
  margin-top:12px;
}

#bp-ai-offer-send{
  flex:1;
  height:44px;
  padding:0 16px;
  border-radius:15px;
  border:1px solid rgba(255,191,0,.48);
  background:
    radial-gradient(120% 140% at 20% 0%, rgba(255,255,255,.20) 0, rgba(255,255,255,0) 58%),
    linear-gradient(180deg, #ffd24a 0%, #ffbf00 100%);
  color:#161006;
  font-weight:950;
  cursor:pointer;
  text-transform:uppercase;
  letter-spacing:.07em;
  transition:transform .16s ease, filter .16s ease, border-color .16s ease;
}

#bp-ai-offer-send:hover{
  transform:translateY(-1px);
  filter:brightness(1.04);
  border-color:rgba(255,191,0,.85);
}

#bp-ai-offer-close{
  height:44px;
  padding:0 16px;
  border-radius:15px;
  border:1px solid rgba(255,255,255,.13);
  background:rgba(255,255,255,.045);
  color:var(--bp-text);
  font-weight:850;
  cursor:pointer;
  text-transform:uppercase;
  letter-spacing:.07em;
  transition:background .16s ease, border-color .16s ease, transform .16s ease;
}

#bp-ai-offer-close:hover{
  background:rgba(255,255,255,.075);
  border-color:rgba(255,255,255,.20);
  transform:translateY(-1px);
}

/* Modal helper line if kept inline in PHP */
.bp-ai-offer-card > div[style]{
  color:rgba(247,248,251,.58) !important;
}

/* =========================================================
   PULSE
   ========================================================= */
@keyframes bp-ai-pulse{
  0%{
    box-shadow:0 0 0 0 rgba(255,191,0,.24), 0 18px 55px rgba(0,0,0,.70);
  }
  70%{
    box-shadow:0 0 0 18px rgba(255,191,0,0), 0 18px 55px rgba(0,0,0,.70);
  }
  100%{
    box-shadow:0 0 0 0 rgba(255,191,0,0), 0 18px 55px rgba(0,0,0,.70);
  }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width:480px){
  #bp-ai-widget{
    right:12px;
    bottom:12px;
  }

  #bp-ai-panel{
    width:calc(100vw - 24px);
    border-radius:22px;
  }

  #bp-ai-header{
    padding:13px;
    min-height:70px;
  }

  #bp-ai-avatar{
    width:42px;
    height:42px;
    min-width:42px;
  }

  #bp-ai-agent-name{
    font-size:16px;
  }

  .bp-ai-head-sub{
    font-size:11px;
  }

  .bp-ai-offer-btn{
    height:35px;
    padding:0 11px;
    font-size:11px;
    letter-spacing:.06em;
  }

  #bp-ai-close{
    width:32px;
    height:32px;
    font-size:23px;
  }

  #bp-ai-messages{
    height:285px;
  }

  #bp-ai-row{
    gap:8px;
  }

  #bp-ai-input{
    height:50px;
    border-radius:15px;
    padding:0 13px;
  }

  #bp-ai-send{
    height:50px;
    min-width:74px;
    padding:0 14px;
    border-radius:15px;
    font-size:12px;
    letter-spacing:.06em;
  }

  #bp-ai-fab{
    width:66px;
    height:66px;
  }

  #bp-ai-fab img{
    width:56px;
    height:56px;
  }

  .bp-ai-offer-actions{
    flex-direction:column;
  }

  #bp-ai-offer-close,
  #bp-ai-offer-send{
    width:100%;
  }
}

@media (max-width:380px){
  #bp-ai-header{
    gap:8px;
  }

  .bp-ai-head-left{
    gap:9px;
  }

  #bp-ai-agent-name{
    max-width:150px;
  }

  .bp-ai-head-sub{
    max-width:150px;
  }

  .bp-ai-offer-btn{
    padding:0 9px;
  }

  #bp-ai-send{
    min-width:68px;
    padding:0 12px;
  }
}
