/* ==========================================================
   BETTY AI WIDGETS
   Core Guide and Core Navigate
========================================================== */

/* ----------------------------------------------------------
   CORE GUIDE
---------------------------------------------------------- */

.picc-betty-widget {
    position: fixed;
    right: 24px;
    bottom: 95px;
    z-index: 10000;
}

.picc-betty-launcher {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    min-width: 250px;
    padding: 12px 18px;
    border: 1px solid rgba(65, 176, 255, 0.45);
    border-radius: 999px;
    color: #ffffff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    background: linear-gradient(135deg, #159fff, #0871dd);
    box-shadow:
        0 14px 32px rgba(0, 0, 0, 0.32),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    transition:
        transform 160ms ease,
        box-shadow 160ms ease,
        background 160ms ease;
}

.picc-betty-launcher:hover {
    transform: translateY(-2px);
    box-shadow:
        0 18px 38px rgba(0, 0, 0, 0.38),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.picc-betty-launcher:focus-visible,
.picc-betty-close:focus-visible {
    outline: 3px solid rgba(72, 188, 255, 0.55);
    outline-offset: 3px;
}

.picc-betty-launcher i {
    font-size: 1rem;
}

.picc-betty-widget.is-open .picc-betty-launcher {
    display: none;
}

.picc-betty-panel[hidden] {
    display: none !important;
}

.picc-betty-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(520px, calc(100vw - 48px));
    height: min(690px, calc(100vh - 48px));
    height: min(690px, calc(100dvh - 48px));
    min-width: 0;
    min-height: 0;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    direction: rtl;
    resize: both;
    overflow: hidden;
    border: 1px solid rgba(65, 176, 255, 0.42);
    border-radius: 18px;
    background: #ffffff;
    box-shadow:
        0 26px 70px rgba(0, 0, 0, 0.48),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

/*
 * Core Guide is anchored on the right side of the page. RTL moves
 * its native resize control to the lower-left corner; reset the
 * actual interface to normal left-to-right text direction.
 */
.picc-betty-panel__header,
.picc-betty-panel__body {
    direction: ltr;
}

.picc-betty-panel__header,
.picc-navigate-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 58px;
    padding: 12px 14px 12px 18px;
    border-bottom: 1px solid rgba(57, 153, 235, 0.25);
    color: #ffffff;
    background: linear-gradient(135deg, #062347, #0a396b);
}

.picc-betty-panel__header > div,
.picc-navigate-panel__header > div {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
}

.picc-betty-panel__header > div i,
.picc-navigate-panel__header > div i {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #ffffff;
    background: rgba(25, 157, 255, 0.24);
}

.picc-betty-panel__header strong,
.picc-navigate-panel__header strong {
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.picc-betty-close,
.picc-navigate-close {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    color: #ffffff;
    font: inherit;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    transition:
        background 160ms ease,
        border-color 160ms ease;
}

.picc-betty-close:hover,
.picc-navigate-close:hover {
    border-color: rgba(255, 255, 255, 0.30);
    background: rgba(255, 255, 255, 0.15);
}

.picc-betty-panel__body,
.picc-navigate-panel__body {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: contain;
    background: #ffffff;
    color: #17324d;
}

.picc-betty-panel__body betty-bot,
.picc-navigate-panel__body betty-bot {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    overscroll-behavior: contain;
}

/*
 * Core Guide also uses the surrounding panel body as its only
 * scrolling container. This prevents the custom element from
 * creating a clipped second scrollbar.
 */
.picc-betty-panel__body {
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

.picc-betty-panel__body betty-bot.picc-betty {
    display: block;
    width: 100%;
    height: auto;
    min-height: 100%;
    max-height: none;
    overflow: visible;
}

.picc-betty-welcome {
    padding: 22px;
    color: #17324d !important;
    text-align: center;
}

.picc-betty-welcome h2 {
    margin: 0 0 12px;
    color: #062347 !important;
    font-size: 1.6rem;
}

.picc-betty-welcome p {
    margin: 0 0 22px;
    color: #52677c !important;
    line-height: 1.55;
}

.picc-betty-welcome .static-question {
    display: block;
    margin: 12px 0;
    padding: 15px 18px;
    border: 1px solid #c5d4e3;
    border-radius: 10px;
    color: #12395d !important;
    background: #f4f8fc;
    font-weight: 700;
    line-height: 1.4;
    cursor: pointer;
    transition:
        border-color 160ms ease,
        background 160ms ease,
        transform 160ms ease;
}

.picc-betty-welcome .static-question:hover {
    border-color: #159fff;
    background: #eaf5ff;
    transform: translateY(-1px);
}

/* ----------------------------------------------------------
   CORE NAVIGATE
---------------------------------------------------------- */

.picc-navigate-widget {
    position: fixed;
    left: 24px;
    bottom: 95px;
    z-index: 9998;
    font-family: inherit;
}

.picc-navigate-launcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    min-width: 250px;
    padding: 12px 20px;
    border: 1px solid #238ed8;
    border-radius: 12px;
    color: #ffffff;
    background: #0c3d70;
    box-shadow: 0 10px 28px rgba(0, 20, 45, 0.28);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.picc-navigate-launcher:hover,
.picc-navigate-launcher:focus-visible {
    border-color: #2ea8ff;
    background: #12558f;
}

.picc-navigate-launcher i {
    color: #29a8ff;
    font-size: 1.15rem;
}

.picc-navigate-widget.is-open .picc-navigate-launcher {
    display: none;
}

.picc-navigate-panel[hidden] {
    display: none !important;
}

.picc-navigate-panel {
    position: fixed;
    left: 24px;
    bottom: 24px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(620px, calc(100vw - 48px));
    height: min(650px, calc(100vh - 48px));
    height: min(650px, calc(100dvh - 48px));
    min-width: 0;
    min-height: 0;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    resize: both;
    overflow: hidden;
    border: 1px solid #2675ae;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 18px 50px rgba(0, 20, 45, 0.35);
}

/*
 * Core Navigate uses the surrounding panel body as its only
 * scrolling container. Do not constrain the custom element to
 * 100% height; that creates a second, clipped scroll viewport.
 */
.picc-navigate-panel__body {
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

.picc-navigate-panel__body betty-bot.picc-navigate {
    display: block;
    width: 100%;
    height: auto;
    min-height: 100%;
    max-height: none;
    overflow: visible;
}

/*
 * Give Chromium and Safari a more visible resize handle.
 * Firefox continues to display its native resize indicator.
 */
.picc-betty-panel::-webkit-resizer,
.picc-navigate-panel::-webkit-resizer {
    background:
        linear-gradient(
            135deg,
            transparent 0 42%,
            #198fda 43% 52%,
            transparent 53% 63%,
            #0b5f9b 64% 73%,
            transparent 74%
        );
}

.picc-navigate-close:focus-visible {
    outline: 3px solid rgba(72, 188, 255, 0.55);
    outline-offset: 3px;
}

.picc-navigate-welcome {
    padding: 18px;
    color: #172033 !important;
}

.picc-navigate-welcome h2 {
    margin: 0 0 10px;
    color: #082848 !important;
}

.picc-navigate-welcome p {
    margin: 0 0 16px;
    color: #52677c !important;
    line-height: 1.55;
}

.picc-navigate-welcome .static-question {
    margin-top: 10px;
    padding: 11px 13px;
    border: 1px solid #b9dff5;
    border-radius: 8px;
    color: #08355e !important;
    background: #eef7fd;
    cursor: pointer;
}

.picc-navigate-welcome .static-question:hover {
    border-color: #78c4ed;
    background: #dff1fb;
}

/* Keep the Core Navigate interface readable on New Look pages. */
.picc-navigate,
.picc-navigate * {
    color: #172033 !important;
}

.picc-navigate a {
    color: #087fbd !important;
}

.picc-navigate input,
.picc-navigate textarea {
    color: #172033 !important;
    background-color: #ffffff !important;
}

.picc-navigate input::placeholder,
.picc-navigate textarea::placeholder {
    color: #667085 !important;
    opacity: 1;
}

.picc-navigate .icons,
.picc-navigate button .icons {
    color: #087fbd !important;
}

/* ----------------------------------------------------------
   RESPONSIVE LAYOUT
---------------------------------------------------------- */

@media (max-width: 700px), (max-height: 700px) {
    .picc-betty-widget {
        right: 12px;
        bottom: 65px;
    }

    .picc-navigate-widget {
        left: 12px;
        bottom: 65px;
    }

    .picc-betty-launcher,
    .picc-navigate-launcher {
        min-height: 46px;
        padding: 10px 15px;
    }

    .picc-betty-panel,
    .picc-navigate-panel {
        position: fixed;
        inset: 12px;
        width: auto;
        height: auto;
        min-width: 0;
        min-height: 0;
        max-width: none;
        max-height: none;
        resize: none;
        border-radius: 15px;
    }
}

/* One shared mobile dock; keep the existing widget controls and events. */
@media (max-width: 700px) {
    body:has(.picc-betty-widget, .picc-navigate-widget) {
        padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }

    body:has(.picc-betty-widget, .picc-navigate-widget)::after {
        content: "";
        position: fixed;
        inset: auto 0 0;
        height: calc(72px + env(safe-area-inset-bottom, 0px));
        z-index: 9997;
        background: #03152c;
        border-top: 1px solid rgba(65, 176, 255, 0.35);
        pointer-events: none;
    }

    .picc-betty-widget,
    .picc-navigate-widget {
        width: calc(50% - 12px);
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    .picc-betty-widget { right: 8px; }
    .picc-navigate-widget { left: 8px; }

    .picc-betty-launcher,
    .picc-navigate-launcher {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        height: 56px;
        min-height: 56px;
        padding: 6px 8px;
        justify-content: center;
        gap: 6px;
        border-radius: 10px;
        font-size: 14px;
        line-height: 1.2;
        white-space: normal;
        text-align: center;
        box-shadow: none;
    }

    .picc-betty-launcher span,
    .picc-navigate-launcher span {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .picc-betty-launcher i,
    .picc-navigate-launcher i {
        flex-shrink: 0;
    }

    /* Neither launcher should cover the other widget's open panel. */
    body:has(.picc-betty-widget.is-open, .picc-navigate-widget.is-open)
    :is(.picc-betty-launcher, .picc-navigate-launcher) {
        visibility: hidden;
    }
}

/* Loading and retry controls for the on-demand assistant. */
.picc-widget-loading { padding: 24px; color: #17324d; text-align: center; }
.picc-widget-loading button { min-height: 44px; padding: 10px 18px; border: 0; border-radius: 8px; background: #0871dd; color: white; font: inherit; cursor: pointer; }
.picc-widget-loading button[hidden] { display: none; }
.picc-widget-loading button:focus-visible { outline: 3px solid #17324d; outline-offset: 3px; }
