/*
 * Shares the bottom-left(RTL: inset-inline-end) corner with the site's own
 * .scroll-to-top button (partials/scroll-to-top.blade.php), which only
 * appears past scrollY 400. Idle, we sit in its resting spot since it's
 * invisible; assistant-widget.js toggles .is-raised (via a MutationObserver
 * on .scroll-to-top's "is-visible" class) to hop above it exactly when it
 * appears, and back down when it hides. On mobile the idle spot already
 * clears .mobile-bottom-nav, matching .scroll-to-top's own mobile position.
 */
.assistant-widget-bubble {
    position: fixed;
    bottom: 1.25rem;
    inset-inline-end: 1.25rem;
    z-index: 1050;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #0d6efd;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
    cursor: pointer;
    border: none;
    font-size: 24px;
    transition: bottom .2s ease;
}

.assistant-widget-bubble.is-raised { bottom: 5.5rem; } /* clears .scroll-to-top (bottom 1.25rem + 3rem tall) */

.assistant-widget-bubble:hover { background: #0b5ed7; }

.assistant-widget-panel {
    position: fixed;
    bottom: calc(1.25rem + 56px + .75rem);
    inset-inline-end: 1.25rem;
    z-index: 1050;
    width: 340px;
    max-height: min(480px, 70vh);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    direction: rtl;
    font-family: inherit;
    transition: bottom .2s ease;
}

.assistant-widget-panel.is-raised { bottom: calc(5.5rem + 56px + .75rem); }

.assistant-widget-panel.is-open { display: flex; }

.assistant-widget-header {
    background: #0d6efd;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
}

.assistant-widget-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.assistant-widget-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}

.assistant-widget-header button:hover { opacity: .8; }

.assistant-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8f9fa;
    min-height: 220px;
}

.assistant-widget-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.assistant-widget-msg.user {
    align-self: flex-end;
    background: #0d6efd;
    color: #fff;
    border-bottom-right-radius: 2px;
}

.assistant-widget-msg.assistant {
    align-self: flex-start;
    background: #e9ecef;
    color: #212529;
    border-bottom-left-radius: 2px;
}

.assistant-widget-msg.pending { opacity: .6; }

.assistant-widget-form {
    display: flex;
    border-top: 1px solid #e9ecef;
    padding: 8px;
    gap: 6px;
}

.assistant-widget-form input {
    flex: 1;
    border: 1px solid #ced4da;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
}

.assistant-widget-form button {
    background: #0d6efd;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
}

.assistant-widget-form button:disabled { opacity: .6; cursor: default; }

/* .scroll-to-top's own resting spot moves to bottom:5.25rem/inset-inline-end:.75rem here (above .mobile-bottom-nav) */
@media (max-width: 768px) {
    .assistant-widget-bubble,
    .assistant-widget-bubble.is-raised {
        inset-inline-end: .75rem;
    }
    .assistant-widget-bubble { bottom: 5.25rem; }
    .assistant-widget-bubble.is-raised { bottom: calc(5.25rem + 3rem + .75rem); }

    .assistant-widget-panel,
    .assistant-widget-panel.is-raised {
        inset-inline-end: .75rem;
    }
    .assistant-widget-panel { bottom: calc(5.25rem + 56px + .75rem); }
    .assistant-widget-panel.is-raised { bottom: calc(5.25rem + 3rem + .75rem + 56px + .75rem); }
}

@media (max-width: 480px) {
    .assistant-widget-panel {
        inset-inline-start: 12px;
        inset-inline-end: 12px;
        width: auto;
    }
}
