/* Everything is prefixed .produp- so the host theme is untouched. --produp-accent
   and --produp-icon are set inline from the shop's branding and have fallbacks. */

.produp-typeahead {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    max-height: 60vh;
    overflow-y: auto;
}

.produp-typeahead__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f1f1f1;
}
.produp-typeahead__row:last-child { border-bottom: none; }
.produp-typeahead__row:hover { background: #f7f7f7; }

.produp-typeahead__row img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.produp-typeahead__meta { display: flex; flex-direction: column; min-width: 0; }
.produp-typeahead__name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.produp-typeahead__price {
    font-size: 0.85em;
    color: #555;
}
.produp-typeahead__price del { opacity: 0.5; margin-right: 4px; }

/* A product found by its exact SKU or EAN can be sold out; say so on the result. */
.produp-soldout {
    display: inline-block;
    align-self: flex-start;
    margin: 4px 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f1f1;
    color: #555;
    font-size: 0.75em;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.02em;
}
.product:has(> a .produp-soldout--on-image),
.product:has(> .produp-soldout--on-image) { position: relative; }
.produp-soldout--on-image {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 1;
    margin: 0;
    background: rgba(255, 255, 255, 0.92);
    color: #333;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.produp-fab {
    --produp-accent: #111;
    --produp-icon: #fff;
    /* Read by produp.js to detect a stale optimizer-bundled copy; must equal
       REQUIRED_CSS_VERSION and the plugin version. */
    --produp-css-version: "0.12.0";
    position: fixed;
    right: 20px;
    /* --produp-bottom-inset is the height of a theme bar pinned to the viewport bottom, set by produp.js. */
    bottom: calc(20px + var(--produp-bottom-inset, 0px));
    width: 56px;
    height: 56px;
    /* Full reset: theme button padding in em (Flatsome) at 24px font-size
       leaves a zero-width content box and a blank launcher. */
    padding: 0;
    margin: 0;
    min-width: 0;
    min-height: 0;
    max-width: none;
    border-radius: 50%;
    border: none;
    background: var(--produp-accent);
    color: var(--produp-icon);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    transition: transform 120ms ease, box-shadow 120ms ease, bottom 200ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Theme svg rules beat the width/height attributes, and flex would shrink it. */
.produp-fab svg {
    display: block;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}
/* The labelled launcher: the icon plus a short line, anchored at the corner so it grows leftward.
   Folded it is the 56px circle again (15 + 26 + 15), so the teaser's tail meets it either way. */
.produp-fab--pill {
    width: auto;
    min-width: 56px;
    max-width: calc(100vw - 40px);
    padding: 0 22px 0 15px;
    gap: 8px;
    border-radius: 28px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    white-space: nowrap;
    transition: transform 120ms ease, box-shadow 120ms ease, padding 220ms ease, gap 220ms ease;
}
.produp-fab__label {
    display: block;
    max-width: 14em;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 1;
    transition: max-width 220ms ease, opacity 160ms ease;
}
.produp-fab--folded {
    padding: 0 15px;
    gap: 0;
}
.produp-fab--folded .produp-fab__label {
    max-width: 0;
    opacity: 0;
}
.produp-fab:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25); }
.produp-fab:focus-visible {
    outline: 2px solid var(--produp-accent);
    outline-offset: 3px;
}

/* The launcher teaser: a speech bubble above the launcher, its tail on the launcher. */
.produp-teaser {
    --produp-accent: #111;
    position: fixed;
    right: 20px;
    bottom: calc(88px + var(--produp-bottom-inset, 0px));
    z-index: 9998;
    display: flex;
    align-items: stretch;
    max-width: min(280px, calc(100vw - 40px));
    background: #fff;
    color: #111;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.04);
    font-size: 14px;
    line-height: 1.35;
    opacity: 0;
    transform: translateY(6px) scale(0.96);
    transform-origin: 100% 100%;
    transition: opacity 200ms ease, transform 200ms ease, bottom 200ms ease;
}
.produp-teaser--in {
    opacity: 1;
    transform: none;
}
.produp-teaser::after {
    content: "";
    position: absolute;
    right: 20px;
    bottom: -6px;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: 3px 3px 4px rgba(0, 0, 0, 0.06);
}
/* Full button reset: themes restyle every button (uppercase, padding, min-height). */
.produp-teaser__line,
.produp-teaser__close {
    position: relative;
    z-index: 1;
    margin: 0;
    border: 0;
    min-width: 0;
    min-height: 0;
    background: none;
    box-shadow: none;
    color: inherit;
    font: inherit;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
}
.produp-teaser__line {
    flex: 1;
    padding: 12px 4px 12px 16px;
    text-align: left;
    font-weight: 500;
    line-height: inherit;
}
.produp-teaser__close {
    flex-shrink: 0;
    width: 36px;
    padding: 0;
    color: #888;
    font-size: 20px;
    line-height: 1;
    border-radius: 0 16px 4px 0;
}
.produp-teaser__line:hover { color: var(--produp-accent); }
.produp-teaser__close:hover { color: #111; }
.produp-teaser__line:focus-visible,
.produp-teaser__close:focus-visible {
    outline: 2px solid var(--produp-accent);
    outline-offset: -2px;
    border-radius: 12px;
}

.produp-chat {
    --produp-accent: #111;
    position: fixed;
    right: 20px;
    bottom: calc(88px + var(--produp-bottom-inset, 0px));
    width: min(380px, calc(100vw - 40px));
    height: min(560px, calc(100vh - 120px - var(--produp-bottom-inset, 0px)));
    background: #fff;
    color: #111;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-size: 14px;
    line-height: 1.45;
}

.produp-chat__header {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.produp-chat__header strong { font-size: 14px; }

/* The ask block under Add to cart: rendered by the server, so its height is in the first paint. */
.produp-ask {
    --produp-accent: #111;
    clear: both;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin: 16px 0 20px;
    font-size: 14px;
    line-height: 1.3;
}
.produp-ask__main,
.produp-ask__chip {
    font: inherit;
    font-size: inherit;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    margin: 0;
    min-height: 0;
    box-shadow: none;
    background: transparent;
    transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.produp-ask__main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    min-height: 44px;
    border: 1.5px solid var(--produp-accent);
    border-radius: 999px;
    color: var(--produp-accent);
    font-weight: 600;
}
.produp-ask__main svg { flex-shrink: 0; }
.produp-ask__main:hover,
.produp-ask__main:focus,
.produp-ask__main:active {
    background: rgba(0, 0, 0, 0.04);
    color: var(--produp-accent);
}
.produp-ask__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.produp-ask__chip {
    padding: 7px 12px;
    min-height: 36px;
    border: 1px solid #d8d8d8;
    border-radius: 18px;
    color: #222;
    font-weight: 400;
}
.produp-ask__chip:hover,
.produp-ask__chip:focus,
.produp-ask__chip:active {
    background: transparent;
    border-color: var(--produp-accent);
    color: var(--produp-accent);
}
.produp-ask__main:focus-visible,
.produp-ask__chip:focus-visible {
    outline: 2px solid var(--produp-accent);
    outline-offset: 2px;
}
@media (max-width: 600px) {
    .produp-ask__main { width: 100%; justify-content: center; }
}

.produp-chat__close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #888;
    padding: 4px 8px;
    line-height: 1;
    min-width: 32px;
    min-height: 32px;
}
.produp-chat__close:hover { color: #111; }
.produp-chat__close:focus-visible {
    outline: 2px solid var(--produp-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.produp-chat__log {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.produp-chat__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.produp-chat__bubble {
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 85%;
    line-height: 1.45;
    word-wrap: break-word;
}
/* Host theme margins on paragraphs and lists dwarf the bubble's padding. */
.produp-chat__bubble .produp-chat__p {
    margin: 0;
}
.produp-chat__bubble .produp-chat__p + .produp-chat__p,
.produp-chat__bubble .produp-chat__p + .produp-chat__list,
.produp-chat__bubble .produp-chat__list + .produp-chat__p {
    margin-top: 8px;
}
.produp-chat__bubble .produp-chat__list {
    margin: 4px 0 0;
    padding-left: 18px;
}
.produp-chat__bubble .produp-chat__list li {
    margin: 2px 0;
}
/* Scroll wide tables instead of stretching the narrow bubble. */
.produp-chat__table-wrap {
    margin-top: 8px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.produp-chat__table {
    border-collapse: collapse;
    font-size: 0.92em;
    min-width: 100%;
}
.produp-chat__table th,
.produp-chat__table td {
    border: 1px solid #e0e0e0;
    padding: 4px 8px;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}
.produp-chat__table th {
    background: #f5f5f5;
    font-weight: 600;
}
.produp-chat__bubble strong { font-weight: 600; }
.produp-chat__bubble--user {
    background: var(--produp-accent);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.produp-chat__bubble--assistant {
    background: #f1f1f1;
    color: #111;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.produp-chat__bubble--greeting { font-style: italic; opacity: 0.85; }
.produp-chat__bubble--error {
    background: #fff4f4;
    color: #8a1f1f;
    border: 1px solid #f3c4c4;
}

/* Starter prompts are outlined so they read as tappable, not as sent messages. */
.produp-chat__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-self: flex-start;
    margin-top: 4px;
}
.produp-chat__suggestion {
    font: inherit;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid #d8d8d8;
    background: #fff;
    color: #222;
    line-height: 1.3;
    transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.produp-chat__suggestion:hover {
    border-color: var(--produp-accent);
    color: var(--produp-accent);
}
.produp-chat__suggestion:focus-visible {
    outline: 2px solid var(--produp-accent);
    outline-offset: 2px;
}

.produp-chat__assistant {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

/* Typing indicator until the first token. */
.produp-chat__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f1f1f1;
    border-radius: 12px;
    color: #666;
    font-size: 12px;
}
.produp-chat__dots {
    display: inline-flex;
    gap: 3px;
}
.produp-chat__dots span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: produp-pulse 1.2s infinite ease-in-out;
}
.produp-chat__dots span:nth-child(2) { animation-delay: 0.15s; }
.produp-chat__dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes produp-pulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}
.produp-chat__picking {
    font-weight: 500;
    color: var(--produp-accent);
    font-size: 12px;
    padding: 2px 4px;
    margin-bottom: 2px;
}

.produp-chat__cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.produp-chat__card {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.produp-chat__card:hover {
    border-color: var(--produp-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}
.produp-chat__card:focus-visible {
    outline: 2px solid var(--produp-accent);
    outline-offset: 2px;
}

.produp-chat__card-img {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    background: #f5f5f5;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 11px;
    font-weight: 500;
    color: #999;
    letter-spacing: 0.5px;
}
.produp-chat__card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.produp-chat__card-body {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.produp-chat__card-name {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.produp-chat__card-reason {
    font-size: 12px;
    color: #444;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.produp-chat__card-meta {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: 11px;
    color: #666;
}
.produp-chat__card-brand {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.produp-chat__card-price {
    font-weight: 600;
    color: #111;
    white-space: nowrap;
}
.produp-chat__card-price del { opacity: 0.5; margin-right: 4px; font-weight: 400; }

.produp-chat__card--skeleton {
    background: linear-gradient(90deg, #f3f3f3 25%, #ececec 50%, #f3f3f3 75%);
    background-size: 200% 100%;
    animation: produp-shimmer 1.4s infinite;
    border-color: transparent;
    min-height: 84px;
}
@keyframes produp-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.produp-chat__form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}
.produp-chat__form input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font: inherit;
    background: #fff;
    color: #111;
}
.produp-chat__form input:focus-visible {
    outline: 2px solid var(--produp-accent);
    outline-offset: 1px;
    border-color: var(--produp-accent);
}
.produp-chat__form button {
    padding: 9px 14px;
    background: var(--produp-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.produp-chat__form button:focus-visible {
    outline: 2px solid var(--produp-accent);
    outline-offset: 2px;
}
.produp-chat__form button:disabled,
.produp-chat__form input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* #6b6b6b keeps 4.5:1 on white; small text gets no AA large-text leeway. */
.produp-chat__footer {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 0 12px 10px;
    font-size: 11px;
    line-height: 1.4;
    color: #6b6b6b;
    text-align: center;
    flex-shrink: 0;
}
.produp-chat__footer a {
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}
.produp-chat__footer a:hover,
.produp-chat__footer a:focus-visible {
    text-decoration: underline;
}
.produp-chat__footer a:focus-visible {
    outline: 2px solid var(--produp-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Mobile: fullscreen sheet. The desktop fixed-corner panel is unusable
   at phone widths — most storefront traffic lives there. */
@media (max-width: 600px) {
    .produp-chat {
        right: 0;
        bottom: 0;
        left: 0;
        top: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh; /* iOS Safari URL-bar collapse */
        max-height: 100dvh;
        border-radius: 0;
    }
    .produp-fab {
        right: 16px;
        bottom: calc(16px + var(--produp-bottom-inset, 0px));
    }
    .produp-teaser {
        right: 16px;
        bottom: calc(82px + var(--produp-bottom-inset, 0px));
        max-width: min(220px, calc(100vw - 32px));
        font-size: 13px;
    }
    .produp-teaser__line { padding: 10px 2px 10px 14px; }
    /* Touch targets must clear 44×44 on mobile (WCAG 2.5.5). */
    .produp-chat__close,
    .produp-chat__form button {
        min-width: 44px;
        min-height: 44px;
    }
    /* The footer is bottom-most, so it absorbs the home-indicator safe area. */
    .produp-chat__footer {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    .produp-fab,
    .produp-fab__label,
    .produp-teaser,
    .produp-chat__card,
    .produp-chat__dots span {
        transition: none;
        animation: none;
    }
    /* Animation off leaves the gradient stuck at its starting position
       (a dark band). Flatten to a plain block instead. */
    .produp-chat__card--skeleton {
        background: #f3f3f3;
        animation: none;
    }
}
