/* Front pages chatbot (Components/ChatbotPublic/ChatbotPublicWidget.razor).
   Loaded only by MainLayout. All classes start with cbp- so nothing else on the site is affected. */

/* ---------- launcher (collapsed) ---------- */

/* z-index below the offcanvas menu (1045), so the open mobile menu covers it */
.cbp-launcher {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1040;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cbp-launcher-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background-image: linear-gradient(135deg, #03a9f4 0%, #1e4f6b 100%);
    box-shadow: 0 6px 18px rgba(3, 169, 244, 0.45);
    cursor: pointer;
    transition: transform 0.2s;
}

.cbp-launcher-btn:hover,
.cbp-launcher-btn:focus-visible {
    transform: scale(1.08);
}

/* expanding ring around the collapsed button */
.cbp-launcher .cbp-launcher-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid #03a9f4;
    opacity: 0;
    animation: cbp-pulse 2.6s ease-out infinite;
    pointer-events: none;
}

.cbp-online-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #aed368;
    border: 2px solid #fff;
}

/* greeting bubble: slides in after 3s, stays about 12s, then goes away */
.cbp-bubble {
    max-width: 230px;
    padding: 0.6rem 0.9rem;
    border-radius: 15px 15px 4px 15px;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translateX(10px);
    pointer-events: none;
    animation: cbp-bubble 15s ease 3s 1 forwards;
}

/* the round button under the open panel closes it */
.cbp-launcher-close {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1040;
}

/* ---------- panel (expanded) ---------- */

.cbp-panel {
    position: fixed;
    right: 1.25rem;
    bottom: calc(1.25rem + 62px + 0.75rem);
    z-index: 1040;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 2.5rem - 62px - 0.75rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 15px;
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.28);
    font-family: "Montserrat", sans-serif;
}

.cbp-header {
    flex: 0 0 auto;
    height: 72px;
    padding: 0 0.75rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    background-image: linear-gradient(90deg, #000 0%, #1e4f6b 90%);
}

.cbp-avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: linear-gradient(135deg, #03a9f4 0%, #1e4f6b 100%);
}

.cbp-header-text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cbp-title {
    font-size: 15px;
    font-weight: 700;
}

.cbp-status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cbp-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #aed368;
}

.cbp-close {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.cbp-close:hover,
.cbp-close:focus-visible {
    background-color: rgba(255, 255, 255, 0.12);
}

/* column-reverse keeps the scroll at the newest message */
.cbp-body {
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
}

.cbp-messages {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cbp-msg {
    max-width: 85%;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.cbp-msg-bot {
    align-self: flex-start;
    border-radius: 15px 15px 15px 4px;
    background-color: var(--bs-tertiary-bg);
}

.cbp-msg-bot p:last-child {
    margin-bottom: 0;
}

.cbp-msg-visitor {
    align-self: flex-end;
    max-width: 80%;
    border-radius: 15px 15px 4px 15px;
    color: #fff;
    background-color: #000;
}

.cbp-plain {
    white-space: pre-line;
}

.cbp-thinking {
    font-style: italic;
    color: var(--bs-secondary-color);
}

.cbp-readmore {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
}

.cbp-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cbp-option {
    min-height: 40px;
    padding: 8px 14px;
    border-radius: 15px;
    border: 2px solid #3ea3dc;
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cbp-option:hover,
.cbp-option:focus-visible {
    background-color: var(--bs-tertiary-bg);
}

.cbp-option-secondary {
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
}

.cbp-contact {
    align-self: stretch;
    padding: 14px;
    border: 2px solid #3ea3dc;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cbp-contact-title {
    font-size: 14px;
    font-weight: 700;
}

.cbp-contact-link {
    min-height: 44px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    font-size: 13px;
    color: var(--bs-body-color);
    text-decoration: none;
}

.cbp-contact-link:hover,
.cbp-contact-link:focus-visible {
    background-color: var(--bs-tertiary-bg);
}

.cbp-footer {
    flex: 0 0 auto;
    padding: 12px 16px 10px 16px;
    border-top: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cbp-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.cbp-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--bs-border-color);
    border-radius: 15px;
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    font-family: inherit;
    font-size: 13px;
}

.cbp-input:focus {
    outline: none;
    border-color: #03a9f4;
}

.cbp-send {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background-image: linear-gradient(135deg, #03a9f4 0%, #1e4f6b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.cbp-send:disabled,
.cbp-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cbp-counter {
    font-size: 11px;
    color: var(--bs-secondary-color);
}

.cbp-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- phones: the panel fills the screen ---------- */

@media (max-width: 575.98px) {
    .cbp-panel {
        inset: 0;
        width: auto;
        height: auto;
        max-height: none;
        border-radius: 0;
    }

    .cbp-launcher-close {
        display: none;
    }
}

/* ---------- animations ---------- */

@keyframes cbp-pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

@keyframes cbp-bubble {
    0% {
        opacity: 0;
        transform: translateX(10px);
    }

    5%,
    85% {
        opacity: 1;
        transform: translateX(0);
    }

    100% {
        opacity: 0;
        transform: translateX(10px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cbp-launcher .cbp-launcher-btn::before {
        animation: none;
    }

    .cbp-bubble {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .cbp-launcher-btn {
        transition: none;
    }
}
