/* Окно чат-бота Healthycom (Views/Shared/_ChatWidget.cshtml). Цвета — из палитры сайта (переменные в site.css) */
.hc-chat {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1080;
    font-size: 16px;
    color: #2b3a4a;
}

/* ===== Кнопка-«пузырь» с подписью ===== */
.hc-chat-launcher {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.hc-chat-open .hc-chat-launcher {
    display: none;
}

.hc-chat-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--hc-primary) 0%, var(--hc-accent) 100%);
    color: #fff;
    font-size: 30px;
    box-shadow: 0 8px 24px rgba(27, 110, 194, 0.4);
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}

    /* мягкая пульсация вокруг кнопки */
    .hc-chat-toggle::before {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: 50%;
        box-shadow: 0 0 0 0 rgba(25, 190, 255, 0.45);
        animation: hc-chat-pulse 2.6s ease-out infinite;
    }

    .hc-chat-toggle:hover {
        transform: scale(1.06);
        box-shadow: 0 10px 28px rgba(27, 110, 194, 0.5);
    }

.hc-chat-label {
    position: relative;
    padding: .55rem 1rem;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: var(--hc-primary);
    font-size: .95rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: var(--hc-shadow);
    cursor: pointer;
    animation: hc-chat-label-in .7s cubic-bezier(0.2, 0.9, 0.3, 1.2) 1s both;
}

    .hc-chat-label::after {
        content: "";
        position: absolute;
        top: 50%;
        right: -6px;
        width: 12px;
        height: 12px;
        background: #fff;
        transform: translateY(-50%) rotate(45deg);
    }

/* «искорки» у иконки робота */
.hc-chat-spark {
    position: absolute;
    top: -2px;
    right: -2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #ffc107;
    color: #fff;
    font-size: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    animation: hc-chat-spark 3s ease-in-out infinite;
}

@keyframes hc-chat-spark {
    0%, 100% { transform: scale(1) rotate(0); }
    50% { transform: scale(1.15) rotate(15deg); }
}

/* ===== Окно ===== */
.hc-chat-panel {
    display: flex;
    flex-direction: column;
    width: 460px;
    height: 720px;
    max-height: calc(100vh - 48px);
    overflow: hidden;
    border-radius: var(--hc-radius);
    background: #fff;
    box-shadow: 0 16px 48px rgba(27, 110, 194, 0.28);
    animation: hc-chat-open .25s ease-out;
}

    .hc-chat-panel[hidden] {
        display: none;
    }

.hc-chat-header {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .9rem 1rem;
    color: #fff;
    background: linear-gradient(120deg, var(--hc-primary) 0%, #3b8de0 55%, var(--hc-sky) 100%);
}

.hc-chat-avatar {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    overflow: hidden;
    border-radius: 50%;
    background: #fff;
}

    .hc-chat-avatar img {
        width: 38px;
        height: 38px;
        object-fit: contain;
    }

.hc-chat-title {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

    .hc-chat-title strong {
        font-size: 1.05rem;
    }

.hc-chat-status {
    font-size: .76rem;
    line-height: 1.3;
    opacity: .9;
}

    .hc-chat-status::before {
        content: "";
        display: inline-block;
        width: 8px;
        height: 8px;
        margin-right: .35rem;
        border-radius: 50%;
        background: #ffc107;
        vertical-align: 1px;
    }

.hc-chat-icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

    .hc-chat-icon:hover {
        background: rgba(255, 255, 255, 0.3);
    }

/* ===== Сообщения ===== */
.hc-chat-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: .6rem;
    overflow-y: auto;
    padding: 1rem;
    background:
        radial-gradient(circle, #e3edf9 1px, transparent 1px) 0 0 / 20px 20px,
        #f7faff;
}

.hc-msg {
    max-width: 85%;
    padding: .65rem .9rem;
    border-radius: 16px;
    line-height: 1.5;
    word-wrap: break-word;
}

    .hc-msg a {
        color: var(--hc-link, #0077cc);
        font-weight: 600;
        text-decoration: none;
    }

        .hc-msg a:hover {
            text-decoration: underline;
        }

.hc-chat-cart {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin: .15rem 0 .15rem .5rem;
    padding: .15rem .65rem;
    border: 1.5px solid var(--hc-primary);
    border-radius: 999px;
    background: #fff;
    color: var(--hc-primary);
    font-size: .82rem;
    font-weight: 600;
    vertical-align: middle;
    cursor: pointer;
}

    .hc-chat-cart:hover {
        background: var(--hc-primary);
        color: #fff;
    }

.hc-chat-cart-done,
.hc-chat-cart-done:hover {
    border-color: #28a745;
    background: #28a745;
    color: #fff;
    cursor: default;
}

.hc-msg-error {
    border: 1px solid #f5c2c7;
    background: #fff5f5;
    color: #842029;
}

.hc-msg-typing {
    color: #6c7a89;
    font-size: .9rem;
}

.hc-typing-dots {
    display: inline-flex;
    gap: 3px;
    margin-right: .25rem;
    vertical-align: middle;
}

    .hc-typing-dots i {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--hc-sky);
        animation: hc-chat-dot 1.2s infinite ease-in-out;
    }

        .hc-typing-dots i:nth-child(2) { animation-delay: .15s; }
        .hc-typing-dots i:nth-child(3) { animation-delay: .3s; }

@keyframes hc-chat-dot {
    0%, 80%, 100% { opacity: .3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-4px); }
}

.hc-msg-bot {
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(62, 116, 149, 0.12);
}

/* ответ специалиста из Telegram */
.hc-msg-staff {
    align-self: flex-start;
    border: 1px solid #b7dfc3;
    border-bottom-left-radius: 4px;
    background: #f1fbf4;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.12);
}

.hc-msg-staff-label {
    margin-bottom: .25rem;
    color: #1e7e34;
    font-size: .8rem;
    font-weight: 700;
}

.hc-msg-user {
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    background: var(--hc-primary);
    color: #fff;
}

/* бот работает — зелёная точка статуса */
.hc-chat-live .hc-chat-status::before {
    background: #4cd964;
}

/* непрочитанный ответ при закрытом окне */
.hc-chat-badge {
    position: absolute;
    bottom: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #dc3545;
}

    .hc-chat-badge[hidden] {
        display: none;
    }

/* ===== «Передать dotaz» и форма контактов ===== */
.hc-chat-confirm,
.hc-chat-contact {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .75rem 1rem;
    border-top: 1px solid #e8f0fa;
    background: #f0f6fe;
    font-size: .92rem;
}

    .hc-chat-confirm[hidden],
    .hc-chat-contact[hidden] {
        display: none;
    }

    .hc-chat-confirm button,
    .hc-chat-contact button {
        align-self: flex-start;
        padding: .45rem 1rem;
        border: 0;
        border-radius: 999px;
        background: var(--hc-primary);
        color: #fff;
        font-weight: 600;
        cursor: pointer;
    }

        .hc-chat-confirm button:hover,
        .hc-chat-contact button:hover {
            background: var(--hc-primary-dark);
        }

.hc-chat-contact-title {
    font-weight: 600;
}

.hc-chat-contact input {
    padding: .5rem .75rem;
    border: 2px solid #dbe8f7;
    border-radius: 10px;
    outline: none;
    font-size: 1rem;
}

    .hc-chat-contact input:focus {
        border-color: var(--hc-sky);
    }

.hc-chat-contact-consent {
    color: #6c7a89;
    font-size: .78rem;
}

.hc-chat-disclaimer {
    padding: 0 .9rem .6rem;
    background: #fff;
    color: #8a97a6;
    font-size: .72rem;
    line-height: 1.35;
    text-align: center;
}

.hc-chat-busy .hc-chat-input button {
    opacity: .6;
    cursor: wait;
}

/* ===== Ввод ===== */
.hc-chat-input {
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    padding: .75rem;
    border-top: 1px solid #e8f0fa;
    background: #fff;
}

    .hc-chat-input textarea {
        flex: 1;
        max-height: 140px;
        overflow-y: hidden;
        padding: .6rem .9rem;
        border: 2px solid #dbe8f7;
        border-radius: 14px;
        outline: none;
        font-family: inherit;
        font-size: 1rem;
        resize: none;
    }

        .hc-chat-input textarea:focus {
            border-color: var(--hc-sky);
            box-shadow: 0 0 0 4px rgba(117, 175, 245, 0.2);
        }

    .hc-chat-input button {
        display: flex;
        flex-shrink: 0;
        align-items: center;
        justify-content: center;
        width: 46px;
        height: 46px;
        border: 0;
        border-radius: 50%;
        background: var(--hc-primary);
        color: #fff;
        font-size: 1.1rem;
        cursor: pointer;
    }

        .hc-chat-input button:hover {
            background: var(--hc-primary-dark);
        }

/* ===== Анимации ===== */
@keyframes hc-chat-pulse {
    0% { box-shadow: 0 0 0 0 rgba(25, 190, 255, 0.45); }
    70% { box-shadow: 0 0 0 16px rgba(25, 190, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(25, 190, 255, 0); }
}

@keyframes hc-chat-label-in {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: none; }
}

@keyframes hc-chat-open {
    from { opacity: 0; transform: translateY(16px) scale(.98); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .hc-chat-toggle::before,
    .hc-chat-label,
    .hc-chat-panel {
        animation: none;
    }
}

/* ===== Телефон: окно на весь экран ===== */
@media (max-width: 480px) {
    .hc-chat {
        right: 14px;
        bottom: 14px;
    }

    .hc-chat-label {
        display: none;
    }

    .hc-chat-open {
        inset: 0;
    }

        .hc-chat-open .hc-chat-panel {
            width: 100%;
            height: 100%;
            max-height: none;
            border-radius: 0;
        }
}
