/* Chat assistant widget (resources/views/chat-assistant/*). Brand: ink #22282C, teal #2F8077, sand #F2B544. */
.zd-chat {
    --zd-ink: #22282C;
    --zd-ink-2: #3A4247;
    --zd-teal: #2F8077;
    --zd-teal-dark: #256860;
    --zd-teal-soft: #E6F1EF;
    --zd-sand: #F2B544;
    --zd-sand-soft: #FDF3DD;
    --zd-line: #E4E8E6;
    --zd-muted: #69726F;
    --zd-bg: #F6F7F5;
    --zd-chat-bottom: 22px;
    color: var(--zd-ink);
    font-family: inherit;
}

.zd-chat button { font-family: inherit; }
/* The theme gives every svg a negative bottom margin, which pushes icons off-centre. */
.zd-chat svg { flex-shrink: 0; margin: 0; }

/* Launcher */
.zd-chat__launcher {
    position: fixed;
    right: 22px;
    bottom: var(--zd-chat-bottom);
    z-index: 1036;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 54px;
    min-width: 54px;
    padding: 0 20px 0 16px;
    border: 0;
    border-radius: 27px;
    background: var(--zd-ink);
    color: #fff;
    box-shadow: 0 10px 28px rgba(34, 40, 44, .28), 0 2px 6px rgba(34, 40, 44, .14);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.zd-chat__launcher::after {
    content: "";
    position: absolute;
    top: 9px;
    left: 34px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--zd-ink);
    border-radius: 50%;
    background: var(--zd-sand);
}

.zd-chat__launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(34, 40, 44, .32), 0 2px 6px rgba(34, 40, 44, .14); }
.zd-chat__launcher:active { transform: scale(.97); }
.zd-chat__launcher:focus-visible { outline: 3px solid var(--zd-sand); outline-offset: 3px; }
.zd-chat__launcher-label { font-size: 15px; font-weight: 600; line-height: 1; letter-spacing: .01em; white-space: nowrap; }
.zd-chat.is-seen .zd-chat__launcher { justify-content: center; width: 54px; padding: 0; }
.zd-chat.is-seen .zd-chat__launcher-label,
.zd-chat.is-seen .zd-chat__launcher::after { display: none; }
.zd-chat.is-open .zd-chat__launcher,
.zd-chat.is-open .zd-chat__teaser { display: none; }

/* Teaser bubble above the launcher */
.zd-chat__teaser {
    position: fixed;
    right: 22px;
    bottom: calc(var(--zd-chat-bottom) + 66px);
    z-index: 1036;
    display: flex;
    align-items: flex-start;
    max-width: 290px;
    animation: zd-chat-pop .35s cubic-bezier(.2, .9, .3, 1.2) both;
}

.zd-chat__teaser[hidden] { display: none; }

.zd-chat__teaser-body {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 12px 12px;
    border: 1px solid var(--zd-line);
    border-radius: 16px 16px 4px 16px;
    background: #fff;
    color: var(--zd-ink);
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
    box-shadow: 0 12px 30px rgba(34, 40, 44, .16);
    cursor: pointer;
}

.zd-chat__teaser-body img { flex: 0 0 28px; border-radius: 8px; }

.zd-chat__teaser-close {
    position: absolute;
    top: -9px;
    left: -9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--zd-line);
    border-radius: 50%;
    background: #fff;
    color: var(--zd-muted);
    cursor: pointer;
}

@keyframes zd-chat-pop {
    from { opacity: 0; transform: translateY(10px) scale(.96); }
    to { opacity: 1; transform: none; }
}

/* Keep the theme's go-to-top button above the launcher. */
.u-go-to { bottom: 88px !important; }

/* Panel */
.zd-chat__panel {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1055;
    display: flex;
    flex-direction: column;
    width: 400px;
    height: min(680px, calc(100vh - 44px));
    overflow: hidden;
    background: var(--zd-bg);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(34, 40, 44, .24), 0 4px 12px rgba(34, 40, 44, .1);
    animation: zd-chat-pop .25s ease-out both;
}

.zd-chat__panel[hidden] { display: none; }

.zd-chat__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px 14px 16px;
    background: var(--zd-ink);
    color: #fff;
}

.zd-chat__header-avatar {
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #fff;
}

.zd-chat__header-text { flex: 1 1 auto; min-width: 0; }
.zd-chat__title { margin: 0; color: #fff; font-size: 16px; font-weight: 700; line-height: 1.25; }
.zd-chat__subtitle { white-space: nowrap; display: flex; align-items: center; gap: 6px; margin: 2px 0 0; color: rgba(255, 255, 255, .72); font-size: 12.5px; line-height: 1.3; }
.zd-chat__status { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: #5BD19A; box-shadow: 0 0 0 3px rgba(91, 209, 154, .2); }

.zd-chat__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.zd-chat__close:hover { background: rgba(255, 255, 255, .1); }

.zd-chat__new {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 18px;
    background: transparent;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.zd-chat__new[hidden] { display: none; }
.zd-chat__new:hover { background: rgba(255, 255, 255, .1); }

@media (max-width: 767.98px) {
    .zd-chat__new { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 12px; }
    .zd-chat__new span { display: none; }
}

/* Tool recommendation card */
.zd-chat-toolcard {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    padding: 14px;
    border: 1px solid #CFE3DF;
    border-radius: 16px;
    background: #fff;
    color: var(--zd-ink) !important;
    text-decoration: none !important;
    box-shadow: 0 1px 3px rgba(34, 40, 44, .06);
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.zd-chat-toolcard:hover { border-color: var(--zd-teal); transform: translateY(-1px); box-shadow: 0 8px 18px rgba(34, 40, 44, .1); }

.zd-chat-toolcard__icon {
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--zd-teal);
    color: #fff;
    font-size: 18px;
}

.zd-chat-toolcard__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.zd-chat-toolcard__body strong { color: var(--zd-ink); font-size: 14.5px; line-height: 1.3; }
.zd-chat-toolcard__body > span:not([class]) { color: var(--zd-muted); font-size: 13px; line-height: 1.4; }

.zd-chat-toolcard__badge {
    align-self: flex-start;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--zd-sand-soft);
    color: #8A5D07;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
}

.zd-chat-toolcard__cta { margin-top: 3px; color: var(--zd-teal); font-size: 13.5px; font-weight: 700; }

.zd-chat__log {
    position: relative;
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 14px 8px;
    -webkit-overflow-scrolling: touch;
}

/* Messages */
.zd-chat__msg { display: flex; gap: 8px; margin: 0 0 14px; animation: zd-chat-in .22s ease-out both; }
.zd-chat__avatar { flex: 0 0 28px; width: 28px; height: 28px; margin-top: 2px; padding: 3px; border-radius: 9px; background: #fff; box-shadow: 0 1px 3px rgba(34, 40, 44, .12); }
.zd-chat__content { flex: 1 1 auto; min-width: 0; }

.zd-chat__bubble {
    display: inline-block;
    max-width: 100%;
    padding: 10px 14px;
    border-radius: 4px 18px 18px 18px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(34, 40, 44, .06);
}

.zd-chat__text { color: var(--zd-ink); font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.zd-chat__text p { margin: 0 0 6px; color: inherit; }
.zd-chat__text p:last-child { margin-bottom: 0; }
.zd-chat__text ul { margin: 4px 0 6px; padding-left: 18px; }
.zd-chat__text li { margin: 3px 0; color: inherit; }
.zd-chat__text a { color: var(--zd-teal); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.zd-chat__text strong { color: var(--zd-ink); font-weight: 700; }

.zd-chat__msg--user { justify-content: flex-end; }
.zd-chat__msg--user .zd-chat__bubble { max-width: 82%; border-radius: 18px 18px 4px 18px; background: var(--zd-teal); box-shadow: none; }
.zd-chat__msg--user .zd-chat__text { color: #fff; }
.zd-chat__msg--notice .zd-chat__bubble { background: var(--zd-sand-soft); }

@keyframes zd-chat-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* Welcome */
.zd-chat__welcome-label { margin: 18px 0 10px 2px; color: var(--zd-muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.zd-chat__topics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.zd-chat__topic {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-height: 84px;
    padding: 12px;
    border: 1px solid var(--zd-line);
    border-radius: 14px;
    background: #fff;
    color: var(--zd-ink);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.zd-chat__topic:hover { border-color: var(--zd-teal); transform: translateY(-1px); box-shadow: 0 6px 14px rgba(34, 40, 44, .08); }

.zd-chat__topic-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--zd-teal-soft);
    color: var(--zd-teal);
    font-size: 15px;
}

.zd-chat__topic:nth-child(3n+2) .zd-chat__topic-icon { background: var(--zd-sand-soft); color: #B07A12; }
.zd-chat__topic:nth-child(3n) .zd-chat__topic-icon { background: #ECEEF0; color: var(--zd-ink-2); }

.zd-chat__chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.zd-chat__chips--reply { margin: 10px 0 0; }

.zd-chat__chip {
    padding: 8px 13px;
    border: 1px solid #CFE3DF;
    border-radius: 999px;
    background: #fff;
    color: var(--zd-teal-dark);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

.zd-chat__chip:hover { border-color: var(--zd-teal); background: var(--zd-teal-soft); }

/* Typing */
.zd-chat__typing { display: inline-flex; align-items: center; gap: 10px; color: var(--zd-muted); font-size: 13.5px; }
.zd-chat__dots { display: inline-flex; gap: 4px; }
.zd-chat__dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--zd-teal); animation: zd-chat-dot 1.1s infinite ease-in-out; }
.zd-chat__dots span:nth-child(2) { animation-delay: .15s; }
.zd-chat__dots span:nth-child(3) { animation-delay: .3s; }

@keyframes zd-chat-dot {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
    .zd-chat *, .zd-chat *::before, .zd-chat *::after { animation: none !important; transition: none !important; }
}

/* Product carousel */
.zd-chat-carousel {
    display: flex;
    gap: 10px;
    margin: 10px -14px 0 -36px;
    padding: 2px 14px 10px 36px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 36px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.zd-chat-carousel::-webkit-scrollbar { display: none; }
.zd-chat-carousel:focus-visible { outline: 2px solid var(--zd-teal); outline-offset: -2px; }

.zd-chat-tile {
    flex: 0 0 176px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(34, 40, 44, .08), 0 6px 16px rgba(34, 40, 44, .06);
    scroll-snap-align: start;
}

.zd-chat-tile__media { position: relative; display: block; height: 150px; padding: 10px; background: #fff; }
.zd-chat-tile__media img { width: 100%; height: 100%; object-fit: contain; }

.zd-chat-tile__badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--zd-sand);
    color: var(--zd-ink);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.3;
}

.zd-chat-tile__body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 4px; padding: 10px 12px 12px; border-top: 1px solid #F0F2F1; }
.zd-chat-tile__shop { display: flex; align-items: center; gap: 5px; overflow: hidden; color: var(--zd-muted, #69726F); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.zd-chat-tile__shop img { flex: 0 0 14px; width: 14px; height: 14px; object-fit: contain; border-radius: 3px; }
.zd-chat-tile__shop span { overflow: hidden; text-overflow: ellipsis; }

.zd-chat-tile__title {
    display: -webkit-box;
    min-height: 2.6em;
    overflow: hidden;
    color: #22282C !important;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.zd-chat-tile__title:hover { color: #2F8077 !important; }
.zd-chat-tile__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
.zd-chat-tile__price strong { color: #22282C; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.zd-chat-tile__price s { color: #8A928F; font-size: 12.5px; }
.zd-chat-tile__ship { display: flex; align-items: center; gap: 5px; color: #2F8077; font-size: 11.5px; font-weight: 600; line-height: 1.3; }
.zd-chat-tile__ship svg { flex: 0 0 14px; }

.zd-chat-tile__buy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: auto;
    padding: 9px 10px;
    border-radius: 10px;
    background: #22282C;
    color: #fff !important;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none !important;
    transition: background-color .15s ease;
}

.zd-chat-tile__body .zd-chat-tile__buy { margin-top: 8px; }
.zd-chat-tile__buy:hover { background: #2F8077; }

.zd-chat-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    color: var(--zd-teal) !important;
    font-size: 13.5px;
    font-weight: 700;
}

/* Shipping cards */
.zd-chat-ship {
    margin-top: 10px;
    padding: 14px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(34, 40, 44, .08), 0 6px 16px rgba(34, 40, 44, .05);
}

.zd-chat-ship__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.zd-chat-ship__head img { flex: 0 0 32px; width: 32px; height: 32px; object-fit: contain; padding: 3px; border: 1px solid var(--zd-line); border-radius: 9px; }
.zd-chat-ship__head strong { display: block; color: var(--zd-ink); font-size: 14.5px; line-height: 1.3; }
.zd-chat-ship__head span { display: block; color: var(--zd-muted); font-size: 12px; }

.zd-chat-ship__rows { margin: 0; }
.zd-chat-ship__rows div { display: grid; grid-template-columns: 84px 1fr; gap: 8px; padding: 7px 0; border-top: 1px solid #F0F2F1; }
.zd-chat-ship__rows dt { color: var(--zd-muted); font-size: 12.5px; font-weight: 600; }
.zd-chat-ship__rows dd { margin: 0; color: var(--zd-ink); font-size: 13.5px; line-height: 1.4; }

.zd-chat-ship__free {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--zd-teal-soft);
    color: var(--zd-teal-dark);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.35;
}

.zd-chat-ship__note { margin: 8px 0 0; color: var(--zd-muted); font-size: 12.5px; line-height: 1.4; }
.zd-chat-ship__link { display: inline-block; margin-top: 8px; color: var(--zd-teal) !important; font-size: 13px; font-weight: 700; }

.zd-chat-ship__list { margin: 0; padding: 0; list-style: none; }
.zd-chat-ship__list li { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 9px 0; border-top: 1px solid #F0F2F1; }
.zd-chat-ship__shop { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--zd-ink) !important; font-size: 13.5px; font-weight: 600; }
.zd-chat-ship__shop img { flex: 0 0 20px; width: 20px; height: 20px; object-fit: contain; border-radius: 5px; }
.zd-chat-ship__shop span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zd-chat-ship__cost { padding-left: 28px; color: var(--zd-ink); font-size: 12.5px; line-height: 1.4; }

/* Composer */
.zd-chat__form { margin: 0; padding: 10px 12px 0; background: var(--zd-bg); }

.zd-chat__field {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 5px 5px 5px 14px;
    border: 1px solid var(--zd-line);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(34, 40, 44, .06);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.zd-chat__field:focus-within { border-color: var(--zd-teal); box-shadow: 0 0 0 3px rgba(47, 128, 119, .14); }

.zd-chat__input {
    flex: 1 1 auto;
    min-height: 36px;
    max-height: 120px;
    padding: 8px 0;
    border: 0;
    background: transparent;
    color: var(--zd-ink);
    font: inherit;
    font-size: 16px; /* prevents iOS zoom on focus */
    line-height: 1.35;
    resize: none;
}

.zd-chat__input:focus { outline: none; }
.zd-chat__input::placeholder { color: #9AA29F; }

.zd-chat__send {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--zd-teal);
    color: #fff;
    cursor: pointer;
    transition: background-color .15s ease, transform .15s ease;
}

.zd-chat__send:not(:disabled):hover { background: var(--zd-teal-dark); transform: scale(1.05); }
.zd-chat__send:disabled { background: #D5DBD8; cursor: default; }

.zd-chat__note { margin: 0; padding: 7px 4px 10px; color: #8A928F; font-size: 11px; line-height: 1.35; text-align: center; }
.zd-chat__note a { color: inherit; text-decoration: underline; }

/* Mobile: launcher above the bottom dock / sticky CTA, panel as a full-screen sheet. */
@media (max-width: 767.98px) {
    .zd-chat { --zd-chat-bottom: calc(var(--mobile-app-nav-height, 0px) + env(safe-area-inset-bottom) + 12px); }
    body:has(.product-sticky-cta) .zd-chat { --zd-chat-bottom: calc(var(--mobile-app-nav-height, 0px) + env(safe-area-inset-bottom) + 84px); }

    .zd-chat__launcher { right: 14px; height: 50px; min-width: 50px; padding: 0 18px 0 14px; border-radius: 25px; }
    .zd-chat__launcher::after { left: 31px; top: 8px; }
    .zd-chat.is-seen .zd-chat__launcher { width: 50px; padding: 0; }
    .zd-chat__teaser { right: 14px; bottom: calc(var(--zd-chat-bottom) + 60px); max-width: calc(100vw - 40px); }
    .u-go-to { display: none !important; }

    .zd-chat__panel {
        inset: 0;
        right: 0;
        bottom: auto;
        width: 100%;
        height: var(--zd-chat-vh, 100dvh);
        border-radius: 0;
        box-shadow: none;
        animation: zd-chat-sheet .25s ease-out both;
    }

    .zd-chat__header { padding-top: calc(12px + env(safe-area-inset-top)); }
    .zd-chat__note { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
    .zd-chat__topics { grid-template-columns: repeat(3, 1fr); }
    .zd-chat__topic { min-height: 80px; padding: 10px; font-size: 13px; }

    html.zd-chat-locked, html.zd-chat-locked body { overflow: hidden; }
}

@keyframes zd-chat-sheet {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@media print {
    .zd-chat { display: none; }
}
