.astra-chat {
    position: fixed;
    right: 24px;
    bottom: calc(24px + var(--tab-nav-height, 0px));
    z-index: 100001;
    pointer-events: auto;
    font-family: Roboto, Arial, sans-serif;
}

/* Не блокировать клик по чату скрытым баннером cookie (opacity: 0, но pointer-events остаётся). */
.cookies-modal.cookies-modal--hidden {
    pointer-events: none !important;
}

.astra-chat__toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 999px;
    padding: 14px 18px;
    background: #1f6feb;
    color: #fff;
    box-shadow: 0 12px 30px rgba(31, 111, 235, 0.35);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
}

.astra-chat__toggle-icon {
    font-size: 18px;
    line-height: 1;
}

.astra-chat__panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
    min-height: 0;
}

.astra-chat__panel.is-open {
    display: flex;
}

.astra-chat__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    background: linear-gradient(135deg, #1f6feb, #3b82f6);
    color: #fff;
}

.astra-chat__title {
    font-size: 16px;
    font-weight: 700;
}

.astra-chat__subtitle {
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.85;
}

.astra-chat__header-actions {
    display: flex;
    gap: 8px;
}

.astra-chat__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

.astra-chat__icon-btn#astra-chat-close {
    font-size: 22px;
    padding-bottom: 2px;
}

.astra-chat__messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
}

.astra-chat__message {
    max-width: 88%;
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.astra-chat__message--assistant {
    background: #fff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.astra-chat__message--assistant ol,
.astra-chat__message--assistant ul {
    margin: 8px 0;
    padding-left: 20px;
}

.astra-chat__message--assistant li {
    margin-bottom: 6px;
}

.astra-chat__message--assistant li::marker {
    color: #1f6feb;
    font-weight: 600;
}

.astra-chat__message--user {
    margin-left: auto;
    background: #1f6feb;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.astra-chat__message a {
    color: #1f6feb;
    text-decoration: underline;
    word-break: break-all;
}

.astra-chat__strong {
    color: #0f172a;
    font-weight: 700;
}

.astra-chat__table {
    width: 100%;
    margin: 8px 0;
    border-collapse: collapse;
    font-size: 13px;
}

.astra-chat__table th,
.astra-chat__table td {
    border: 1px solid #e2e8f0;
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
}

.astra-chat__table th {
    background: #f1f5f9;
    color: #1e3a8a;
    font-weight: 600;
}

.astra-chat__backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 99999;
}

.astra-chat.is-expanded .astra-chat__backdrop {
    display: block;
}

.astra-chat.is-expanded .astra-chat__panel {
    position: fixed;
    top: 24px;
    bottom: 24px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(920px, calc(100vw - 48px));
    max-width: none;
    height: auto;
    max-height: none;
    z-index: 100001;
}

.astra-chat.is-expanded .astra-chat__toggle {
    z-index: 100002;
}

.astra-chat__product-image {
    display: block;
    max-width: 100%;
    max-height: 180px;
    margin-top: 8px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    object-fit: contain;
    background: #fff;
}

.astra-chat__message--user a {
    color: #fff;
}

.astra-chat__form {
    display: flex;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}

.astra-chat__input {
    flex: 1;
    resize: none;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    min-height: 44px;
}

.astra-chat__send {
    border: 0;
    border-radius: 12px;
    padding: 0 16px;
    background: #1f6feb;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.astra-chat__send:disabled,
.astra-chat__input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 1279px) {
    .astra-chat {
        right: 12px;
        bottom: calc(12px + var(--tab-nav-height, 72px));
        left: auto;
    }
}

@media (max-width: 640px) {
    .astra-chat {
        right: 12px;
        left: auto;
        bottom: calc(12px + var(--tab-nav-height, 72px));
    }

    .astra-chat__toggle {
        width: auto;
        padding: 10px 14px;
        gap: 8px;
        font-size: 13px;
        box-shadow: 0 8px 20px rgba(31, 111, 235, 0.3);
    }

    .astra-chat__toggle-icon {
        font-size: 16px;
    }

    .astra-chat__panel {
        right: 0;
        left: auto;
        width: calc(100vw - 24px);
        max-width: 380px;
        bottom: 56px;
        height: calc(100vh - 110px);
        max-height: none;
    }
}
