/* Чат-бот DIACOM (Views/Shared/_ChatWidget.cshtml) */
.dc-chat {
    --dc-accent: #0d6efd;
    --dc-accent-dark: #0a58ca;
    --dc-bg: #ffffff;
    --dc-bot: #f1f3f5;
    --dc-text: #212529;
    --dc-muted: #6c757d;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1080;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    color: var(--dc-text);
}

.dc-chat-toggle {
    width: 68px;
    height: 68px;
    border: none;
    border-radius: 50%;
    background: var(--dc-accent);
    color: #fff;
    font-size: 30px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

    .dc-chat-toggle:hover {
        background: var(--dc-accent-dark);
        transform: scale(1.06);
    }

.dc-chat-open .dc-chat-toggle {
    display: none;
}

.dc-chat-panel {
    width: 460px;
    height: 700px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    background: var(--dc-bg);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

    .dc-chat-panel[hidden] {
        display: none;
    }

.dc-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    font-size: 17px;
    background: var(--dc-accent);
    color: #fff;
    font-weight: 600;
}

.dc-chat-title i {
    margin-right: 6px;
}

.dc-chat-icon {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 20px;
    padding: 2px 8px;
    cursor: pointer;
    opacity: 0.85;
}

    .dc-chat-icon:hover {
        opacity: 1;
    }

.dc-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dc-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.dc-msg-bot {
    align-self: flex-start;
    background: var(--dc-bot);
    border-bottom-left-radius: 4px;
}

    .dc-msg-bot a {
        color: var(--dc-accent);
        text-decoration: underline;
    }

.dc-msg-user {
    align-self: flex-end;
    background: var(--dc-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.dc-msg-typing {
    color: var(--dc-muted);
    font-style: italic;
}

.dc-msg-error {
    background: #fff3cd;
}

.dc-chat-contact {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

    .dc-chat-contact[hidden] {
        display: none;
    }

.dc-chat-contact-title {
    font-weight: 600;
    font-size: 15px;
}

.dc-chat-contact input {
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 9px 10px;
    font-size: 16px;
}

.dc-chat-contact button {
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-size: 16px;
    background: var(--dc-accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.dc-chat-consent {
    font-size: 13px;
    color: var(--dc-muted);
}

.dc-chat-input {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 10px 12px 4px;
    border-top: 1px solid #e9ecef;
}

    .dc-chat-input textarea {
        flex: 1;
        resize: none;
        border: 1px solid #ced4da;
        border-radius: 8px;
        padding: 10px 12px;
        font-size: 16px;
        font-family: inherit;
        max-height: 140px;
    }

    .dc-chat-input button {
        width: 48px;
        height: 46px;
        font-size: 18px;
        border: none;
        border-radius: 8px;
        background: var(--dc-accent);
        color: #fff;
        cursor: pointer;
    }

.dc-chat-disclaimer {
    padding: 0 12px 8px;
    font-size: 12px;
    color: var(--dc-muted);
    text-align: center;
}

/* Телефон: окно на весь экран */
@media (max-width: 480px) {
    .dc-chat {
        right: 12px;
        bottom: 12px;
    }

    .dc-chat-open {
        right: 0;
        bottom: 0;
        left: 0;
        top: 0;
    }

        .dc-chat-open .dc-chat-panel {
            width: 100%;
            height: 100%;
            max-height: none;
            border-radius: 0;
        }
}

/* Ответ специалиста из Telegram */
.dc-msg-staff {
    align-self: flex-start;
    background: #e7f5ec;
    border: 1px solid #b7e2c6;
    border-bottom-left-radius: 4px;
}

    .dc-msg-staff a {
        color: var(--dc-accent);
        text-decoration: underline;
    }

.dc-msg-staff-label {
    font-size: 13px;
    font-weight: 600;
    color: #1e7b45;
    margin-bottom: 4px;
}

/* Новый ответ, пока чат закрыт */
.dc-chat-toggle {
    position: relative;
}

.dc-chat-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #dc3545;
    border: 2px solid #fff;
}

    .dc-chat-badge[hidden] {
        display: none;
    }

/* Кнопка «Передать вопрос» (контакты известны, вопросы копятся) */
.dc-chat-confirm {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

    .dc-chat-confirm[hidden] {
        display: none;
    }

.dc-chat-confirm-send {
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-size: 16px;
    font-weight: 600;
    background: var(--dc-accent);
    color: #fff;
    cursor: pointer;
}

/* Кнопка чата выделяется на странице: волна вокруг кнопки и покачивание значка */
.dc-chat-toggle::before,
.dc-chat-toggle::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--dc-accent);
    z-index: -1;
    animation: dc-chat-pulse 2.4s ease-out infinite;
}

.dc-chat-toggle::after {
    animation-delay: 1.2s;
}

.dc-chat-toggle > .bi {
    display: inline-block;
    animation: dc-chat-wiggle 6s ease-in-out infinite;
}

.dc-chat-toggle:hover::before,
.dc-chat-toggle:hover::after,
.dc-chat-toggle:hover > .bi {
    animation: none;
}

@keyframes dc-chat-pulse {
    0% { transform: scale(1); opacity: 0.45; }
    100% { transform: scale(1.7); opacity: 0; }
}

@keyframes dc-chat-wiggle {
    0%, 80%, 100% { transform: rotate(0); }
    84% { transform: rotate(-14deg); }
    88% { transform: rotate(12deg); }
    92% { transform: rotate(-8deg); }
    96% { transform: rotate(4deg); }
}

@media (prefers-reduced-motion: reduce) {
    .dc-chat-toggle::before,
    .dc-chat-toggle::after,
    .dc-chat-toggle > .bi {
        animation: none;
    }
}
