/*!
 * H.V.D.S floating chat widget (embedded chatbot app).
 * All classes are prefixed with `hvds-chat-` to avoid clashing with the theme.
 */

.hvds-chat-widget {
    position: fixed;
    inset-inline-end: 24px;
    bottom: 24px;
    z-index: 2000;
    font-family: inherit;
}

.hvds-chat-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 56px;
    padding: 0 20px;
    border: 0;
    border-radius: 999px;
    background: #4f46e5;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.hvds-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(79, 70, 229, 0.45);
    background: #4338ca;
}

.hvds-chat-toggle:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.4);
    outline-offset: 2px;
}

.hvds-chat-toggle svg {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
}

.hvds-chat-toggle-label {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.hvds-chat-toggle::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 999px;
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.45);
    animation: hvds-chat-ring 2.4s ease-out infinite;
    pointer-events: none;
}

@keyframes hvds-chat-ring {
    0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.45); }
    70% { box-shadow: 0 0 0 15px rgba(79, 70, 229, 0); }
    100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

.hvds-chat-panel {
    position: absolute;
    bottom: calc(100% + 16px);
    inset-inline-end: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: 0 24px 55px rgba(15, 23, 42, 0.28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.98);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.hvds-chat-widget.is-open .hvds-chat-panel {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.hvds-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: #4f46e5;
    color: #fff;
}

.hvds-chat-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.hvds-chat-title svg {
    width: 18px;
    height: 18px;
}

.hvds-chat-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
}

.hvds-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.hvds-chat-close svg {
    width: 16px;
    height: 16px;
}

.hvds-chat-frame {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

@media (max-width: 480px) {
    .hvds-chat-widget {
        inset-inline-end: 16px;
        bottom: 16px;
    }

    .hvds-chat-toggle-label {
        display: none;
    }

    .hvds-chat-toggle {
        width: 56px;
        padding: 0;
        justify-content: center;
    }

    .hvds-chat-panel {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border: 0;
        border-radius: 0;
    }

    .hvds-chat-widget.is-open .hvds-chat-toggle {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hvds-chat-toggle::after {
        animation: none;
    }

    .hvds-chat-panel,
    .hvds-chat-toggle {
        transition: none;
    }
}
