/* Онлайн-чат с мастером (src/components/chat_widget.php, assets/js/chat.js).
   Палитра сайта: молочный #FBF8F4, жемчужный #ECE7E1, линии #D9D2CB, пудра #F3DCDC,
   роза #D9A5A5, текст #2B2826, вторичный #7A736D. Шрифты — из fonts.css. */
.bk-chat { --bk-chat-bottom: 1.25rem; position: fixed; right: 1rem; bottom: var(--bk-chat-bottom); z-index: 45; font-family: Manrope, system-ui, sans-serif; }
.bk-chat--lifted { --bk-chat-bottom: 5.25rem; } /* /constructor: над панелью итога (h-14) */
.bk-chat [hidden] { display: none !important; }
@media (min-width: 640px) { .bk-chat { right: 1.5rem; } }

.bk-chat__toggle { position: relative; display: flex; align-items: center; justify-content: center; width: 3.5rem; height: 3.5rem; border-radius: 9999px; background: #2B2826; color: #FBF8F4; box-shadow: 0 10px 40px -12px rgba(43,40,38,.4); transition: background .3s, color .3s, transform .3s; cursor: pointer; }
.bk-chat__toggle:hover { background: #D9A5A5; color: #2B2826; transform: translateY(-2px); }
.bk-chat__toggle[aria-expanded="true"] { background: #D9A5A5; color: #2B2826; }
.bk-chat__badge { position: absolute; top: -.25rem; right: -.25rem; min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem; border-radius: 9999px; background: #D9A5A5; color: #2B2826; font-size: 11px; font-weight: 600; line-height: 1.25rem; text-align: center; box-shadow: 0 0 0 2px #FBF8F4; }

.bk-chat__panel { position: fixed; left: .75rem; right: .75rem; bottom: calc(var(--bk-chat-bottom) + 4.25rem); display: flex; flex-direction: column; height: 70vh; max-height: 540px; overflow: hidden; border: 1px solid #D9D2CB; border-radius: 1rem; background: #FBF8F4; box-shadow: 0 0 0 1px rgba(255,255,255,.6), 0 18px 50px -20px rgba(43,40,38,.35); animation: bk-chat-in .35s cubic-bezier(.2,.7,.2,1) both; }
@media (min-width: 640px) { .bk-chat__panel { left: auto; right: 0; width: 23rem; height: 540px; } }
@keyframes bk-chat-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.bk-chat__head { display: flex; align-items: center; gap: .75rem; padding: .9rem 1rem; border-bottom: 1px solid rgba(217,210,203,.6); background: linear-gradient(135deg, #FBF8F4 0%, #F3DCDC 100%); }
.bk-chat__title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bk-chat__title .font-display { font-size: 1.35rem; line-height: 1.1; color: #2B2826; }
.bk-chat__title small { font-size: 12px; color: #7A736D; margin-top: .15rem; }
.bk-chat__close { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 9999px; color: #7A736D; transition: background .2s, color .2s; }
.bk-chat__close:hover { background: rgba(255,255,255,.7); color: #2B2826; }

.bk-chat__log { flex: 1; display: flex; flex-direction: column; gap: .6rem; padding: 1rem; overflow-y: auto; overscroll-behavior: contain; }
.bk-chat__msg { max-width: 85%; padding: .65rem .9rem; border-radius: 1rem; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.bk-chat__msg--manager { align-self: flex-start; border-bottom-left-radius: .3rem; background: #fff; color: #2B2826; box-shadow: 0 10px 40px -12px rgba(43,40,38,.12); }
.bk-chat__msg--client { align-self: flex-end; border-bottom-right-radius: .3rem; background: #F3DCDC; color: #2B2826; }
.bk-chat__author { display: block; margin-bottom: .15rem; font-size: 11px; text-transform: uppercase; letter-spacing: .18em; color: #7A736D; }

.bk-chat__error { margin: 0; padding: 0 1rem .5rem; font-size: 12px; color: #a0463f; }
.bk-chat__form { display: flex; align-items: flex-end; gap: .5rem; padding: .75rem .75rem .5rem; border-top: 1px solid rgba(217,210,203,.6); background: #fff; }
.bk-chat__input { flex: 1; min-height: 2.75rem; max-height: 7rem; resize: none; border: 1px solid #D9D2CB; border-radius: .75rem; background: #FBF8F4; padding: .65rem .9rem; font: inherit; font-size: 15px; color: #2B2826; outline: none; transition: border-color .2s; }
.bk-chat__input:focus { border-color: #D9A5A5; background: #fff; }
.bk-chat__input::placeholder { color: rgba(122,115,109,.7); }
.bk-chat__send { display: grid; place-items: center; flex: none; width: 2.75rem; height: 2.75rem; border-radius: .75rem; background: #2B2826; color: #FBF8F4; transition: background .3s, color .3s, opacity .3s; }
.bk-chat__send:hover { background: #D9A5A5; color: #2B2826; }
.bk-chat__send[disabled] { opacity: .4; pointer-events: none; }
.bk-chat__note { margin: 0; padding: 0 1rem .75rem; background: #fff; font-size: 11px; color: #7A736D; }

@media (prefers-reduced-motion: reduce) { .bk-chat__panel { animation: none; } .bk-chat__toggle:hover { transform: none; } }
/* Телефон: открытый чат — полноэкранный лист, круглая кнопка прячется (крестик в шапке панели). */
@media (max-width: 639px) {
  .bk-chat__panel { left: 0; right: 0; bottom: 0; top: 0; height: auto; max-height: none; border: 0; border-radius: 0; }
  .bk-chat__toggle[aria-expanded="true"] { visibility: hidden; }
}
@media print { .bk-chat { display: none; } }

/* Телефон: кнопка поменьше и прячется, пока листают вниз (не перекрывает «В корзину»). */
.bk-chat { transition: transform .35s cubic-bezier(.22,.8,.24,1), opacity .25s ease; }
.bk-chat.is-tucked { transform: translateY(160%); opacity: 0; pointer-events: none; }
@media (max-width: 639px) { .bk-chat__toggle { width: 3rem; height: 3rem; } .bk-chat__toggle svg { width: 22px; height: 22px; } }
@media (prefers-reduced-motion: reduce) { .bk-chat { transition: none; } }
