/* ═══════════════════════════════════════════════════════════════
   Bot Chat Widget — White Liquid Glass (усиленная версия для тёмной темы)
   • Фон панели — почти непрозрачное белое стекло (alpha 0.88)
   • Фабрика — яркая с сильным свечением
   • Все элементы получили белый цвет с сохранением "стекла"
   ═══════════════════════════════════════════════════════════════ */

.bot {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999999;
    font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: #0f172a;
    line-height: 1.45;

    --bot-white-strong: rgba(255, 255, 255, 0.92);
    --bot-white-milk: rgba(255, 255, 250, 0.96);
    --bot-pearl-light: rgba(255, 248, 240, 0.98);
    --bot-shadow-dark: 0 20px 40px rgba(0, 0, 0, 0.25);
}

/* ═══ FAB — жидкое стекло (усиленное свечение) ═══ */
.bot__fab {
    position: relative;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(12px) saturate(200%);
    -webkit-backdrop-filter: blur(12px) saturate(200%);
    box-shadow:
        inset 0 1px 3px rgba(255, 255, 255, 1),
        inset 0 -2px 8px rgba(255, 255, 255, 0.5),
        0 12px 28px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.3);
    color: #1e2a4a;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
}
.bot__fab::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: radial-gradient(ellipse 60% 40% at 50% 12%,
        rgba(255, 255, 255, 0.98) 0%, transparent 70%);
    pointer-events: none;
}
.bot__fab-icon {
    width: 26px;
    height: 26px;
    position: relative;
    z-index: 1;
    color: #1f2b4e;
    filter: drop-shadow(0 1px 2px white);
}
.bot__fab:hover { transform: translateY(-3px) scale(1.04); }
.bot__fab:active { transform: translateY(0) scale(0.97); }
.bot--open .bot__fab { transform: scale(0.9); opacity: 0.9; }

.bot__badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 21px;
    height: 21px;
    border-radius: 11px;
    background: #ff8a8a;
    color: white;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid white;
    z-index: 2;
}

/* ═══ Panel — ПЛОТНОЕ БЕЛОЕ СТЕКЛО (не серое на тёмном фоне) ═══ */
.bot__panel {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: 380px;
    height: 580px;
    min-width: 300px;
    min-height: 380px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    backdrop-filter: blur(24px) saturate(200%);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    background: rgba(255, 255, 255, 0.88); /* <-- плотный белый */
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 28px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 30px 50px -20px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    transition: opacity 0.24s ease, transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bot--open .bot__panel {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}
.bot--dragging .bot__panel,
.bot--resizing .bot__panel {
    transition: none;
    user-select: none;
}

/* ═══ Header — перламутрово-белый, плотный ═══ */
.bot__header {
    position: relative;
    flex-shrink: 0;
    height: 72px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #fffef7 0%, #fffaf0 100%);
    color: #0f172a;
    cursor: grab;
    user-select: none;
    touch-action: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.8);
}
.bot--dragging .bot__header { cursor: grabbing; }

.bot__avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}
.bot__avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bot__head-text {
    flex: 1;
    min-width: 0;
    color: #1e293b;
}
.bot__head-title {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #0a0f1c;
}
.bot__head-status {
    font-size: 11.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
    color: #334155;
}
.bot__head-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6ee7b7;
    box-shadow: 0 0 0 2px white;
    flex-shrink: 0;
}
.bot__close {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: #334155;
    width: 32px;
    height: 32px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}
.bot__close:hover {
    background: rgba(0, 0, 0, 0.12);
}

/* ═══ Body ═══ */
.bot__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: transparent;
}
.bot__body::-webkit-scrollbar {
    width: 6px;
}
.bot__body::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.4);
    border-radius: 12px;
}

/* FAQ списки — белый полупрозрачный, но читаемый */
.bot__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bot__item {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 12px 14px;
    cursor: pointer;
    font-size: 14px;
    color: #0f172a;
    transition: all 0.2s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}
.bot__item:hover {
    background: white;
    border-color: white;
    box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.2);
}
.bot__item:active {
    transform: scale(0.99);
}
.bot__item::after {
    content: '›';
    margin-left: auto;
    color: #64748b;
    font-size: 20px;
}

.bot__back {
    background: rgba(255, 255, 245, 0.9);
    border: none;
    color: #2c3e66;
    font-size: 13px;
    cursor: pointer;
    padding: 6px 14px;
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    border-radius: 40px;
    backdrop-filter: blur(2px);
}
.bot__back:hover {
    background: white;
}

.bot__answer {
    font-size: 14px;
}
.bot__answer h3 {
    font-size: 15px;
    margin: 0 0 10px 0;
    padding: 6px 14px;
    border-radius: 40px;
    background: rgba(255, 255, 245, 0.95);
    color: #0f172a;
    display: inline-block;
    font-weight: 600;
}
.bot__answer-body {
    white-space: pre-wrap;
    display: block;
    padding: 14px 18px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.9);
    color: #0f172a;
    backdrop-filter: blur(8px);
    border: 1px solid white;
}

.bot__cta {
    margin-top: 16px;
    padding: 14px;
    background: rgba(255, 255, 250, 0.95);
    border-radius: 20px;
    border: 1px solid white;
    text-align: center;
}
.bot__cta p {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #0f172a;
}

.bot__btn {
    background: white;
    color: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 9px 18px;
    border-radius: 40px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.15s;
}
.bot__btn:hover {
    background: #f8fafc;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}
.bot__btn:active {
    transform: scale(0.98);
}
.bot__btn--ghost {
    background: transparent;
    color: #2c3e66;
    border: 1px solid rgba(255, 255, 255, 0.7);
}
.bot__btn--ghost:hover {
    background: rgba(255, 255, 255, 0.6);
}
.bot__btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ═══ Chat — белые сообщения ═══ */
.bot__chat {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bot__banner {
    background: rgba(255, 255, 245, 0.95);
    color: #1e2a4a;
    padding: 10px 14px;
    border-radius: 20px;
    font-size: 12px;
    text-align: center;
    margin-bottom: 4px;
}
.bot__msg {
    max-width: 82%;
    padding: 10px 16px;
    border-radius: 24px;
    font-size: 14px;
    word-wrap: break-word;
}
.bot__msg--user {
    background: #eef2ff;
    color: #0f172a;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    border: 1px solid white;
}
.bot__msg--support {
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
    align-self: flex-start;
    border: 1px solid white;
    border-bottom-left-radius: 6px;
}
.bot__msg--system {
    align-self: center;
    background: transparent;
    color: #64748b;
    font-size: 12px;
    padding: 4px 10px;
    text-align: center;
}

/* форма */
.bot__form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0;
}
.bot__input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 40px;
    font-size: 13px;
    font-family: inherit;
    color: #0f172a;
    background: rgba(255, 255, 255, 0.85);
    transition: all 0.15s;
}
.bot__input:focus {
    outline: none;
    border-color: white;
    background: white;
}

/* ═══ Footer ═══ */
.bot__footer {
    flex-shrink: 0;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 250, 0.4);
    display: none;
    align-items: flex-end;
    gap: 8px;
}
.bot--chat .bot__footer {
    display: flex;
}

.bot__textarea {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 28px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 14px;
    color: #0f172a;
    background: rgba(255, 255, 255, 0.9);
    resize: none;
    max-height: 100px;
    min-height: 38px;
    line-height: 1.4;
}
.bot__textarea:focus {
    outline: none;
    border-color: white;
    background: white;
}

.bot__send {
    background: white;
    color: #2c3e66;
    border: 1px solid rgba(255, 255, 255, 0.7);
    width: 38px;
    height: 38px;
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}
.bot__send:hover {
    background: #f1f5f9;
}
.bot__send[disabled] {
    background: rgba(200, 200, 200, 0.5);
    cursor: not-allowed;
}
.bot__send svg {
    width: 18px;
    height: 18px;
}

.bot__end {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    width: 38px;
    height: 38px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
    flex-shrink: 0;
}
.bot__end:hover {
    color: #f97373;
}

/* ═══ Resize handle — белый, хорошо видимый ═══ */
.bot__resize {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 22px;
    height: 22px;
    cursor: nwse-resize;
    z-index: 6;
    background: linear-gradient(135deg,
        transparent 0%, transparent 45%,
        rgba(255, 255, 255, 0.9) 48%, rgba(255, 255, 255, 1) 52%,
        transparent 56%, transparent 68%,
        rgba(255, 255, 255, 1) 70%, rgba(255, 255, 255, 1) 76%,
        transparent 78%);
    border-bottom-right-radius: 28px;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.bot__resize:hover {
    opacity: 1;
}

/* ═══ Адаптация для тёмной темы (усиление, если фон очень тёмный) ═══ */
@media (prefers-color-scheme: dark) {
    .bot__panel {
        background: rgba(255, 255, 255, 0.94); /* ещё плотнее */
        box-shadow: 0 30px 50px -10px rgba(0, 0, 0, 0.5);
    }
    .bot__fab {
        background: rgba(255, 255, 255, 0.45);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    }
}

/* ═══ Мобильный ═══ */
@media (max-width: 480px) {
    .bot {
        right: 12px;
        bottom: 12px;
    }
    .bot__panel {
        right: 12px !important;
        bottom: 84px !important;
        left: 12px !important;
        top: auto !important;
        width: auto !important;
        height: calc(100vh - 110px) !important;
        background: rgba(255, 255, 255, 0.94);
        backdrop-filter: blur(30px);
    }
    .bot__header {
        cursor: default;
    }
    .bot__resize {
        display: none;
    }
}