/* BIB AI Chat — Buddy v4.1 */

#bib-chat-root {
  --bib-pink:      #EE2A7B;
  --bib-pink-dk:   #c91f68;
  --bib-grape:     #662D91;
  --bib-teal:      #00AEEF;
  --bib-soft-pink: #F59FC5;
  --bib-bg:        #15151a;
  --bib-bg2:       #1d1d24;
  --bib-bg3:       #27272f;
  --bib-border:    rgba(255,255,255,0.1);
  --bib-text:      #f2f2f2;
  --bib-muted:     rgba(242,242,242,0.5);
  --bib-r:         14px;
  --bib-shadow:    0 20px 56px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.07);

  position: fixed !important;
  bottom: 80px !important;
  left: 24px !important;
  right: auto !important;
  z-index: 2147483647 !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif !important;
  font-size: 14px;
  line-height: 1.5;
  box-sizing: border-box;
}

/* ── Bubble ─────────────────────────────────────────── */
#bib-chat-bubble {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bib-pink);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 18px rgba(238,42,123,0.5), 0 2px 6px rgba(0,0,0,0.2);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.18s;
  position: relative;
  outline: none;
  -webkit-appearance: none;
  flex-shrink: 0;
}
#bib-chat-bubble:hover { transform: scale(1.07); box-shadow: 0 6px 24px rgba(238,42,123,0.65); }
#bib-chat-bubble:active { transform: scale(0.94); }
.bib-bico { display: flex; align-items: center; justify-content: center; }

.bib-dot {
  position: absolute; top: 3px; right: 3px;
  width: 11px; height: 11px;
  background: var(--bib-teal); border-radius: 50%;
  border: 2px solid var(--bib-pink);
  animation: bib-pulse 2.2s infinite;
}

/* ── Bubble + label wrapper ─────────────────────────── */
.bib-bubble-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bib-bubble-label {
  background: #fff;
  color: #1a1a1a;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  white-space: nowrap;
  pointer-events: none;
  animation: bib-fadein 0.3s ease;
  letter-spacing: 0.01em;
}

/* ── Window ─────────────────────────────────────────── */
.bib-win {
  position: absolute;
  bottom: 66px;
  left: 0;
  right: auto;
  width: 340px;
  max-height: 580px;
  background: var(--bib-bg);
  border-radius: var(--bib-r);
  box-shadow: var(--bib-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--bib-border);
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(.34,1.3,.64,1);
  box-sizing: border-box;
}
.bib-win.bib-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }

.bib-screen { display: flex; flex-direction: column; overflow: hidden; flex: 1; min-height: 0; }

/* ── HOME SCREEN ────────────────────────────────────── */
.bib-home-hdr {
  display: flex; align-items: center; gap: 10px;
  padding: 16px;
  background: linear-gradient(135deg, #1a1020, #1f162a);
  border-bottom: 1px solid var(--bib-border);
  flex-shrink: 0;
}
.bib-h-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--bib-pink), var(--bib-grape));
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.bib-h-name { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; }
.bib-h-sub  { font-size: 11px; color: rgba(242,242,242,0.6); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.bib-sdot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; flex-shrink: 0; animation: bib-pulse 3s infinite; }

.bib-home-intro { padding: 14px 16px 8px; flex-shrink: 0; }
.bib-home-intro p { margin: 0; font-size: 13.5px; color: rgba(242,242,242,0.8); line-height: 1.55; }
.bib-home-intro strong { color: #fff; }
.bib-home-intro em { font-style: normal; color: var(--bib-soft-pink); }

.bib-faq-group { flex: 1; overflow-y: auto; padding: 0 12px; }
.bib-faq-group::-webkit-scrollbar { width: 3px; }
.bib-faq-group::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.bib-faq-row {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: var(--bib-bg2);
  border: 1px solid var(--bib-border);
  border-radius: 10px; color: #f2f2f2;
  cursor: pointer; margin-bottom: 6px;
  font-size: 13px; font-family: inherit; text-align: left;
  transition: background 0.15s, border-color 0.15s;
  -webkit-appearance: none;
}
.bib-faq-row:hover { background: var(--bib-bg3); border-color: rgba(238,42,123,0.35); }
.bib-faq-row.bib-active { border-color: rgba(238,42,123,0.5); }
.bib-faq-row-l { display: flex; align-items: center; gap: 9px; }
.bib-faq-ico { color: var(--bib-soft-pink); display: flex; align-items: center; flex-shrink: 0; }
.bib-chevron { color: rgba(242,242,242,0.4); flex-shrink: 0; transition: transform 0.2s; }
.bib-faq-row.bib-active .bib-chevron { transform: rotate(90deg); }

.bib-faq-ans {
  display: none;
  padding: 10px 14px 12px;
  margin-top: -4px; margin-bottom: 6px;
  background: var(--bib-bg3);
  border: 1px solid var(--bib-border); border-top: none;
  border-radius: 0 0 10px 10px;
  font-size: 13px; color: #e8e8e8; line-height: 1.6;
  animation: bib-fadein 0.15s ease;
}
.bib-faq-ans strong { color: #fff; }
.bib-faq-ans .bib-note { color: rgba(242,242,242,0.5); font-size: 11.5px; display: block; margin-top: 4px; }

.bib-home-cta { padding: 12px 12px 6px; flex-shrink: 0; }

/* ── SUB HEADERS ────────────────────────────────────── */
.bib-sub-hdr {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--bib-bg2);
  border-bottom: 1px solid var(--bib-border);
  font-size: 13px; font-weight: 600; color: #f2f2f2;
  flex-shrink: 0;
}
.bib-chat-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #1a1020, #1f162a);
  border-bottom: 1px solid var(--bib-border);
  flex-shrink: 0;
}
.bib-chat-hdr-info { display: flex; align-items: center; gap: 8px; flex: 1; }
.bib-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--bib-pink), var(--bib-grape));
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.bib-hdr-name   { font-size: 13px; font-weight: 700; color: #fff; line-height: 1.2; }
.bib-hdr-status { font-size: 11px; color: rgba(242,242,242,0.55); display: flex; align-items: center; gap: 4px; }

.bib-back {
  background: none; border: none; color: rgba(242,242,242,0.5); cursor: pointer;
  padding: 4px; border-radius: 6px; display: flex; align-items: center;
  transition: color 0.15s; flex-shrink: 0;
}
.bib-back:hover { color: #fff; }
.bib-x-btn {
  background: none; border: none; color: rgba(242,242,242,0.5); cursor: pointer;
  padding: 4px; border-radius: 6px; display: flex; align-items: center; margin-left: auto;
}
.bib-x-btn:hover { color: #fff; }

/* ── FORM SCREEN ────────────────────────────────────── */
.bib-form-wrap {
  flex: 1; overflow-y: auto; padding: 20px 16px 16px;
  display: flex; flex-direction: column; align-items: center;
}
.bib-form-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--bib-pink), var(--bib-grape));
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.bib-form-intro {
  font-size: 14px;
  color: #e8e8e8;  /* bright, readable */
  text-align: center; margin: 0 0 20px; line-height: 1.6;
}

.bib-field { width: 100%; margin-bottom: 14px; }
.bib-field label {
  display: block;
  font-size: 12px; font-weight: 700;
  color: #c8c8d0;  /* clearly visible label */
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px;
}
.bib-field input {
  width: 100%; padding: 11px 14px;
  background: #2a2a34;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 9px;
  color: #f2f2f2;  /* bright input text */
  font-size: 15px; font-family: inherit;
  outline: none; box-sizing: border-box;
  transition: border-color 0.15s;
}
.bib-field input:focus { border-color: var(--bib-pink); box-shadow: 0 0 0 3px rgba(238,42,123,0.15); }
.bib-field input::placeholder { color: rgba(242,242,242,0.3); }

.bib-form-note {
  font-size: 11.5px;
  color: rgba(242,242,242,0.45);
  text-align: center; margin: 0 0 18px;
}
.bib-cta-full  { width: 100%; justify-content: center; }

/* Skip button — high contrast */
.bib-skip-wrap { margin-top: 10px; text-align: center; width: 100%; }
.bib-skip {
  background: var(--bib-bg3);
  border: 1px solid rgba(255,255,255,0.2);
  color: #d0d0d8;  /* clearly readable */
  font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  padding: 9px 24px; border-radius: 8px;
  width: 100%;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.bib-skip:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}

/* ── CTA BUTTON ─────────────────────────────────────── */
.bib-cta-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 12px 20px;
  background: var(--bib-pink); border: none; border-radius: 10px;
  color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: background 0.15s, transform 0.12s;
  -webkit-appearance: none;
}
.bib-cta-btn:hover  { background: var(--bib-pink-dk); }
.bib-cta-btn:active { transform: scale(0.97); }

/* ── CHAT SCREEN ────────────────────────────────────── */
.bib-messages {
  flex: 1; overflow-y: auto;
  padding: 14px 12px 10px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth; -webkit-overflow-scrolling: touch;
}
.bib-messages::-webkit-scrollbar { width: 3px; }
.bib-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.bib-msg { display: flex; flex-direction: column; max-width: 88%; animation: bib-fadein 0.17s ease; }
.bib-msg.bib-bot  { align-self: flex-start; }
.bib-msg.bib-user { align-self: flex-end; }

.bib-bubble {
  padding: 10px 13px; border-radius: 13px;
  font-size: 13.5px; line-height: 1.6;
  word-wrap: break-word; overflow-wrap: break-word; margin: 0;
}
.bib-msg.bib-bot  .bib-bubble {
  background: var(--bib-bg3);
  border: 1px solid var(--bib-border);
  border-bottom-left-radius: 4px;
  color: #f0f0f0;
}
.bib-msg.bib-user .bib-bubble {
  background: linear-gradient(135deg, var(--bib-pink), var(--bib-pink-dk));
  border-bottom-right-radius: 4px; color: #fff;
}
.bib-bubble a.bib-buy {
  display: inline-block; margin-top: 8px; padding: 6px 14px;
  background: var(--bib-pink); color: #fff !important;
  border-radius: 20px; font-size: 12px; font-weight: 600;
  text-decoration: none !important; transition: background 0.15s;
}
.bib-bubble a.bib-buy:hover { background: var(--bib-pink-dk); }
.bib-bubble a.bib-link { color: var(--bib-soft-pink); text-decoration: underline; }

.bib-msg-time { font-size: 10px; color: var(--bib-muted); margin-top: 3px; padding: 0 3px; }
.bib-msg.bib-user .bib-msg-time { text-align: right; }

.bib-typing {
  display: flex; gap: 4px; padding: 10px 13px;
  background: var(--bib-bg3); border: 1px solid var(--bib-border);
  border-radius: 13px; border-bottom-left-radius: 4px;
  align-self: flex-start; animation: bib-fadein 0.17s ease;
}
.bib-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(242,242,242,0.4); display: block;
  animation: bib-bounce 1.3s infinite;
}
.bib-typing span:nth-child(2) { animation-delay: 0.18s; }
.bib-typing span:nth-child(3) { animation-delay: 0.36s; }

.bib-input-row {
  display: flex; align-items: flex-end; gap: 7px;
  padding: 9px 11px;
  border-top: 1px solid var(--bib-border);
  background: var(--bib-bg2); flex-shrink: 0;
}
.bib-textarea {
  flex: 1; background: var(--bib-bg3);
  border: 1px solid rgba(255,255,255,0.13); border-radius: 9px;
  color: #f2f2f2; font-size: 16px; line-height: 1.45;
  padding: 8px 11px; resize: none; outline: none;
  font-family: inherit; max-height: 88px; overflow-y: auto;
  transition: border-color 0.15s; box-sizing: border-box;
}
.bib-textarea:focus { border-color: rgba(238,42,123,0.5); }
.bib-textarea::placeholder { color: rgba(242,242,242,0.3); }

.bib-send-btn {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 0 13px; height: 36px;
  background: var(--bib-pink); border: none; border-radius: 9px;
  color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; flex-shrink: 0;
  transition: background 0.15s, transform 0.12s;
  -webkit-appearance: none; white-space: nowrap;
}
.bib-send-btn:hover  { background: var(--bib-pink-dk); }
.bib-send-btn:active { transform: scale(0.95); }
.bib-send-btn:disabled { background: var(--bib-bg3); color: var(--bib-muted); cursor: not-allowed; }

/* ── Footer — no site URL, just AI notice ───────────── */
.bib-footer {
  text-align: center; font-size: 10px;
  color: rgba(242,242,242,0.25);
  padding: 5px 12px;
  background: var(--bib-bg2);
  border-top: 1px solid var(--bib-border); flex-shrink: 0;
  letter-spacing: 0.01em;
}
.bib-footer a { display: none; } /* hide the URL */
.bib-ai-notice { display: block; }

/* ── Animations ─────────────────────────────────────── */
@keyframes bib-pulse  { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(1.35);opacity:.65} }
@keyframes bib-fadein { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:translateY(0)} }
@keyframes bib-bounce { 0%,100%{transform:translateY(0);opacity:.4} 50%{transform:translateY(-5px);opacity:1} }

/* ── Mobile ─────────────────────────────────────────── */
@media (max-width: 600px) {
  #bib-chat-root { bottom: 72px !important; left: 14px !important; }
  .bib-win { bottom: 64px; left: 0; width: calc(100vw - 28px); max-height: 72vh; border-radius: 13px; }
  #bib-chat-bubble { width: 52px; height: 52px; }
  .bib-bubble { font-size: 14px; }
  .bib-bubble-label { font-size: 12px; padding: 6px 11px; }
}
@media (max-width: 375px) {
  #bib-chat-root { left: 10px !important; bottom: 68px !important; }
  .bib-win { width: calc(100vw - 20px); max-height: 68vh; }
}
