/* F583.W6.1/W6.1b — плавающий виджет-консьерж (проактивный продавец + бронь).
   Премиум на бренд-токенах публичного сайта (--p-color-*), фолбэк — navy/gold. */

.bkc-root {
  --bkc-accent: var(--p-color-cta, var(--p-color-primary, #1f3a5f));
  --bkc-accent-text: #fff;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

/* ---- Avatar ---- */
.bkc-ava { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.bkc-ava--initial { background: linear-gradient(135deg, var(--bkc-accent), color-mix(in srgb, var(--bkc-accent) 70%, #000)); color: var(--bkc-accent-text); font: 700 18px "Inter", sans-serif; }
.bkc-ava--sm { width: 32px; height: 32px; }
.bkc-ava--sm.bkc-ava--initial { font-size: 14px; }
.bkc-ava--xs { width: 24px; height: 24px; }
.bkc-ava--xs.bkc-ava--initial { font-size: 11px; }

/* ---- Launcher (контакт-карточка консультанта) ---- */
.bkc-launch {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 8px 18px 8px 8px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.22);
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, opacity 0.2s ease-out;
}
.bkc-launch:hover { transform: translateY(-2px); box-shadow: 0 16px 38px rgba(15, 23, 42, 0.3); }
.bkc-launch__ava { position: relative; display: inline-flex; }
.bkc-launch__txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.bkc-launch__name { font: 700 15px "Inter", sans-serif; color: #0f172a; letter-spacing: -0.01em; }
.bkc-launch__status { font: 500 12px "Inter", sans-serif; color: #16a34a; }
.bkc-root.is-open .bkc-launch { opacity: 0; pointer-events: none; }

/* online dot + пульс-привлечение */
.bkc-dot { position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }
.bkc-pulse { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 0 color-mix(in srgb, var(--bkc-accent) 55%, transparent); animation: bkc-pulse 2.4s infinite; }
@keyframes bkc-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bkc-accent) 50%, transparent); } 70% { box-shadow: 0 0 0 14px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---- Teaser (проактивное приглашение) ---- */
.bkc-teaser {
  position: absolute;
  right: 0;
  bottom: 70px;
  width: 290px;
  background: #fff;
  border-radius: 16px;
  padding: 14px 14px 12px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.26);
  cursor: pointer;
  animation: bkc-pop 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes bkc-pop { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
.bkc-teaser__close { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border: 0; background: #f1f5f9; border-radius: 50%; color: #64748b; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.bkc-teaser__close svg { width: 13px; height: 13px; }
.bkc-teaser__row { display: flex; gap: 10px; align-items: flex-start; }
.bkc-teaser__name { font: 700 13px "Inter", sans-serif; color: #0f172a; margin-bottom: 2px; }
.bkc-teaser__text { font: 400 13px "Inter", sans-serif; color: #475569; line-height: 1.45; }
.bkc-teaser__cta { margin-top: 10px; font: 600 13px "Inter", sans-serif; color: var(--bkc-accent); background: color-mix(in srgb, var(--bkc-accent) 10%, #fff); border-radius: 10px; padding: 8px 11px; text-align: center; }

/* ---- Panel ---- */
.bkc-panel[hidden] { display: none; }
.bkc-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 384px;
  height: min(620px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
  animation: bkc-pop 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}
.bkc-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; background: var(--bkc-accent); color: var(--bkc-accent-text); }
.bkc-head__id { display: inline-flex; align-items: center; gap: 10px; }
.bkc-head__id .bkc-ava--initial { background: rgba(255, 255, 255, 0.22); color: #fff; }
.bkc-head__meta { display: flex; flex-direction: column; line-height: 1.25; }
.bkc-head__name { font: 700 15px "Inter", sans-serif; letter-spacing: -0.01em; }
.bkc-head__status { font: 500 12px "Inter", sans-serif; opacity: 0.85; }
.bkc-head__close { background: transparent; border: 0; color: inherit; cursor: pointer; opacity: 0.85; padding: 4px; border-radius: 6px; }
.bkc-head__close:hover { opacity: 1; background: rgba(255, 255, 255, 0.15); }
.bkc-head__close svg { width: 20px; height: 20px; display: block; }

.bkc-tabs { display: flex; border-bottom: 1px solid #eef1f5; }
.bkc-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 12px 8px; border: 0; background: transparent; color: #64748b; font: 600 14px "Inter", sans-serif; cursor: pointer; border-bottom: 2px solid transparent; transition: color 0.15s ease-out, border-color 0.15s ease-out; }
.bkc-tab svg { width: 18px; height: 18px; }
.bkc-tab.is-active { color: var(--bkc-accent); border-bottom-color: var(--bkc-accent); }

.bkc-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.bkc-body[hidden] { display: none; }
.bkc-book-frame { width: 100%; height: 100%; border: 0; }

/* ---- Chat ---- */
.bkc-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #f8fafc; }
.bkc-msg { display: flex; align-items: flex-end; gap: 7px; }
.bkc-msg--user { justify-content: flex-end; }
.bkc-msg__ava { flex: 0 0 auto; }
.bkc-bubble { max-width: 78%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.bkc-msg--assistant .bkc-bubble { background: #fff; color: #0f172a; border: 1px solid #eef1f5; border-bottom-left-radius: 4px; }
.bkc-msg--user .bkc-bubble { background: var(--bkc-accent); color: var(--bkc-accent-text); border-bottom-right-radius: 4px; }
.bkc-typing .bkc-bubble { display: inline-flex; gap: 4px; padding: 13px; }
.bkc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; animation: bkc-blink 1.2s infinite ease-in-out; }
.bkc-typing span:nth-child(2) { animation-delay: 0.2s; }
.bkc-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bkc-blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

.bkc-input { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid #eef1f5; background: #fff; }
.bkc-input textarea { flex: 1; resize: none; border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px 12px; font: 400 14px "Inter", sans-serif; line-height: 1.4; max-height: 120px; outline: none; color: #0f172a; }
.bkc-input textarea:focus { border-color: var(--bkc-accent); }
.bkc-send { flex: 0 0 auto; width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--bkc-accent); color: var(--bkc-accent-text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: opacity 0.15s ease-out; }
.bkc-send:hover { opacity: 0.9; }
.bkc-send svg { width: 19px; height: 19px; }

@media (max-width: 480px) {
  .bkc-root { right: 12px; bottom: 12px; }
  .bkc-panel { width: calc(100vw - 24px); height: min(80vh, calc(100vh - 24px)); }
  .bkc-teaser { width: calc(100vw - 24px); max-width: 320px; }
  .bkc-launch__txt { display: none; }
  .bkc-launch { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .bkc-panel, .bkc-teaser { animation: none; }
  .bkc-pulse { animation: none; }
  .bkc-launch { transition: none; }
}

/* F702.W3 — rich-карточка ресурса в чате (фото/видео/удобства/ссылка).
   Палитра/тень согласованы с виджетом (--bkc-accent, slate, тонированная тень). */
.bkc-card { max-width: 300px; margin: 8px 0 8px 34px; background: #fff; border-radius: 14px; border: 1px solid #eef1f5; box-shadow: rgba(15,23,42,.05) 0 2px 6px, rgba(15,23,42,.08) 0 8px 20px; overflow: hidden; font-family: "Inter", sans-serif; }
.bkc-card__img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #f1f5f9; }
.bkc-card__body { padding: 12px 13px; }
.bkc-card__name { font: 700 15px "Inter", sans-serif; color: #0f172a; letter-spacing: -0.01em; line-height: 1.3; }
.bkc-card__desc { margin-top: 4px; font: 400 13px "Inter", sans-serif; color: #64748b; line-height: 1.45; }
.bkc-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bkc-card__tags span { font: 500 12px "Inter", sans-serif; color: #334155; background: #f1f5f9; border-radius: 9999px; padding: 3px 9px; }
.bkc-card__video { margin-top: 10px; }
.bkc-card__video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; display: block; }
.bkc-card__cta { display: inline-block; margin-top: 12px; background: var(--bkc-accent); color: var(--bkc-accent-text); text-decoration: none; font: 600 13px "Inter", sans-serif; padding: 9px 15px; border-radius: 10px; transition: opacity .15s ease-out, transform .15s ease-out; }
.bkc-card__cta:hover { opacity: .92; transform: translateY(-1px); }

/* ---- F700 B-W11/12 — вложения чата ---------------------------------------- */
.bkc-attach { flex: 0 0 auto; width: 40px; height: 40px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; color: #64748b; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: color 0.15s ease-out, border-color 0.15s ease-out; }
.bkc-attach:hover { color: var(--bkc-accent); border-color: var(--bkc-accent); }
.bkc-attach svg { width: 18px; height: 18px; }
.bkc-pending { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; background: #fff; border-top: 1px solid #eef1f5; }
.bkc-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 6px 4px 8px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; font-size: 12px; color: #0f172a; }
.bkc-chip img { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; }
.bkc-chip svg { width: 14px; height: 14px; color: #64748b; flex: 0 0 auto; }
.bkc-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.bkc-chip__x { border: 0; background: transparent; color: #94a3b8; cursor: pointer; display: inline-flex; padding: 2px; }
.bkc-chip__x:hover { color: #475569; }
.bkc-chip__x svg { width: 12px; height: 12px; }
.bkc-attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.bkc-bubble .bkc-attachments:first-child { margin-top: 0; }
.bkc-attach-img { display: block; max-width: 220px; border-radius: 10px; overflow: hidden; }
.bkc-attach-img img { display: block; width: 100%; height: auto; border-radius: 10px; }
.bkc-attach-file { display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(15, 23, 42, 0.05); color: inherit; text-decoration: none; font-size: 13px; word-break: break-all; }
.bkc-msg--user .bkc-attach-file { background: rgba(255, 255, 255, 0.16); }
.bkc-attach-file svg { width: 16px; height: 16px; flex: 0 0 auto; }
.bkc-attach-file:hover { text-decoration: underline; }
