/* ChatWidget component styles — loaded as a plain static asset rather than Blazor CSS isolation.
   chat-widget.js builds the button/panel markup itself (see ChatWidget.razor's thin data-* shell),
   and isolation's b-xxxxx scope attribute is only ever applied to Razor-compiled markup - JS-built
   DOM would render completely unstyled under the old ChatWidget.razor.css. Moved here verbatim
   (no ::deep selectors existed to strip). */

.cw-container {
    position: fixed;
    bottom: 24px;
    bottom: calc(24px + env(safe-area-inset-bottom));
    right: 24px;
    /* Must sit BELOW modal dialogs. MudBlazor's scale is appbar 1100 / drawer 1200 / popover 1300 /
       dialog 1400 / snackbar 1500, so 1250 keeps the bubble above ordinary page content and app
       chrome while letting any dialog, popover or snackbar win. At the previous 9999 it floated over
       everything: harmless on desktop, where a centred dialog never reaches the bottom-right corner,
       but on a phone a full-width dialog puts its action buttons directly under the bubble and the
       bubble silently ate the taps. Measured on vrp 2026-08-04 — the chat button intercepted pointer
       events on a dialog's "Save" at 390px, which no visibility assertion would ever have caught. */
    z-index: 1250;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
}

/* Docked mode: the button lives in a host WidgetDockSlot; this container only hosts the panel
   (still fixed, positioned by widget-dock.js placePanelNear). Zero footprint when closed. */
.cw-container.cw-container--docked {
    bottom: 0;
    right: 0;
    left: auto;
    width: 0;
    height: 0;
    overflow: visible;
}

.cw-container.cw-container--docked .cw-panel {
    position: fixed;
}

.cw-button {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    border: none;
    cursor: pointer;
    touch-action: manipulation; /* eliminates 300ms tap delay on mobile */
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(37,99,235,0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cw-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.cw-button:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 18px rgba(37,99,235,0.5);
}

/* SVG and its children must not intercept pointer events — let the button element handle them */
.cw-button svg,
.cw-button svg * {
    pointer-events: none;
}

.cw-panel {
    width: 320px;
    height: 420px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Mobile: fill more of the screen, respect safe areas */
@media (max-width: 480px) {
    .cw-container {
        right: 16px;
        bottom: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .cw-panel {
        width: calc(100vw - 32px);
        height: min(480px, calc(100dvh - 120px));
        border-bottom-right-radius: 0;
        border-bottom-left-radius: 0;
    }
}

.cw-header {
    background: #2563eb;
    color: #fff;
    padding: 13px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.cw-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 15px;
    padding: 0 2px;
    opacity: 0.75;
    line-height: 1;
}

.cw-close:hover { opacity: 1; }

.cw-messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f9fafb;
}

.cw-empty {
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
    line-height: 1.55;
    margin: 24px 8px 0;
}

.cw-msg {
    max-width: 84%;
    border-radius: 10px;
    padding: 8px 12px;
    word-break: break-word;
}

.cw-msg-user {
    align-self: flex-end;
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 3px;
}

.cw-msg-assistant {
    align-self: flex-start;
    background: #fff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 3px;
}

.cw-msg-text {
    font-size: 13.5px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.cw-msg-time {
    font-size: 11px;
    margin-top: 3px;
    opacity: 0.6;
}

.cw-sending {
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
    align-self: center;
}

.cw-input-row {
    border-top: 1px solid #e5e7eb;
    padding: 10px 12px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: #fff;
    flex-shrink: 0;
}

.cw-input-row textarea {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    resize: none;
    outline: none;
    font-family: inherit;
    line-height: 1.4;
    background: #f9fafb;
    transition: border-color 0.15s;
}

.cw-input-row textarea:focus {
    border-color: #2563eb;
    background: #fff;
}

.cw-input-row button {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    align-self: flex-end;
    height: 34px;
}

.cw-input-row button:hover:not(:disabled) {
    background: #1d4ed8;
}

.cw-input-row button:disabled {
    background: #93c5fd;
    cursor: not-allowed;
}
