/* Aurify AI Router — the shop assistant's conversation, above the bar.
   Bubbles are dark, blurred glass so the text stays readable over the bright
   animated background; the cards in a cart proposal reuse the router's glass
   product cards. */

.aurify-assistant {
    --aurify-assistant-line: rgba(255, 255, 255, 0.1);
    --aurify-assistant-soft: rgba(8, 10, 14, 0.66);
    --aurify-assistant-user: rgba(34, 38, 46, 0.8);
    --aurify-assistant-muted: rgba(255, 255, 255, 0.7);
    --aurify-assistant-blur: blur(14px) saturate(140%);

    margin: 0 0 12px;
    overflow: hidden;
    color: var(--aurify-router-text, #fff);
    text-align: left;
}

.aurify-assistant[hidden] {
    display: none;
}

.aurify-assistant__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 4px 8px;
}

.aurify-assistant__title,
.aurify-assistant__new {
    padding: 4px 10px;
    color: rgba(255, 255, 255, .82);
    background: var(--aurify-assistant-soft);
    border-radius: 999px;
    -webkit-backdrop-filter: var(--aurify-assistant-blur);
    backdrop-filter: var(--aurify-assistant-blur);
}

.aurify-assistant__title {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.aurify-assistant__new {
    border: 0;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: color 160ms ease;
}

.aurify-assistant__new:hover {
    color: #fff;
}

.aurify-assistant__log {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: min(56vh, 560px);
    padding: 2px 4px 4px 2px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

.aurify-assistant__msg {
    box-sizing: border-box; /* a full-width answer (beat cards) stays inside the log */
    max-width: 86%;
    min-width: 0;
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    -webkit-backdrop-filter: var(--aurify-assistant-blur);
    backdrop-filter: var(--aurify-assistant-blur);
}

.aurify-assistant__msg--user {
    align-self: flex-end;
    background: var(--aurify-assistant-user);
    border-bottom-right-radius: 5px;
}

.aurify-assistant__msg--assistant {
    align-self: flex-start;
    width: fit-content;
    max-width: 100%;
    background: var(--aurify-assistant-soft);
    border: 1px solid var(--aurify-assistant-line);
    border-bottom-left-radius: 5px;
}

.aurify-assistant__msg--error {
    align-self: flex-start;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    color: #ffc2c2;
    background: rgba(48, 10, 12, .74);
    border: 1px solid rgba(255, 120, 120, .26);
    border-bottom-left-radius: 5px;
}

.aurify-assistant__text,
.aurify-assistant__text p {
    margin: 0;
}

.aurify-assistant__text p + p {
    margin-top: 6px;
}

/* Beats it means: a row of compact cards, each with its licenses to pick. */
.aurify-assistant__beats {
    display: flex;
    gap: 8px;
    margin: 10px -14px 0;
    padding: 0 14px 4px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.aurify-assistant__beats::-webkit-scrollbar {
    display: none;
}

/* The row fades out at its edges instead of cutting the cards off. */
.aurify-assistant__beats {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 24px), transparent);
}

.aurify-assistant__beat {
    flex: 0 0 min(280px, 78vw);
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 8px 10px;
    padding: 8px;
    background: rgba(0, 0, 0, .3);
    border: 1px solid var(--aurify-assistant-line);
    border-radius: 13px;
    scroll-snap-align: start;
}

.aurify-assistant__beat-image {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}

.aurify-assistant__beat-body {
    min-width: 0;
    align-self: center;
}

/* A beat without artwork: its details take the whole row. */
.aurify-assistant__beat-body:first-child {
    grid-column: 1 / -1;
}

.aurify-assistant__beat-title {
    display: block;
    overflow: hidden;
    color: #fff;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.aurify-assistant__beat-title:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.aurify-assistant__beat-facts {
    margin-top: 2px;
    color: var(--aurify-assistant-muted);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.aurify-assistant__beat-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

.aurify-assistant__beat-tags span {
    padding: 1px 7px;
    color: rgba(255, 255, 255, .8);
    background: rgba(255, 255, 255, .07);
    border-radius: 999px;
    font-size: 11.5px;
    line-height: 18px;
}

.aurify-assistant__beat-licenses {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 6px;
}

.aurify-assistant__license {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    min-height: 44px;
    padding: 5px 6px;
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 9px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.aurify-assistant__license:hover {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .34);
    transform: translateY(-1px);
}

.aurify-assistant__license-price {
    color: var(--aurify-assistant-muted);
    font-size: 12px;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

/* What would go in the cart, to confirm. */
.aurify-assistant__proposal {
    margin-top: 10px;
}

.aurify-assistant__items {
    display: grid;
    gap: 8px;
}

.aurify-assistant__item .aurify-ai-router__product-meta {
    min-width: 0;
}

.aurify-assistant__item-blank {
    background: rgba(255, 255, 255, .08);
}

.aurify-assistant__remove {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    padding: 10px 12px;
    border: 1px dashed rgba(255, 255, 255, .22);
    border-radius: var(--aurify-router-radius, 15px);
}

.aurify-assistant__remove-label {
    color: #ffc2c2;
    font-weight: 600;
}

.aurify-assistant__actions,
.aurify-assistant__links,
.aurify-assistant__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.aurify-assistant__actions:empty,
.aurify-assistant__links:empty {
    display: none;
}

.aurify-assistant__actions .aurify-ai-router__choice,
.aurify-assistant__links .aurify-ai-router__choice {
    min-height: 42px;
}

.aurify-assistant__note {
    margin: 8px 2px 0;
    color: var(--aurify-assistant-muted);
    font-size: 13px;
}

.aurify-assistant__note:empty {
    display: none;
}

.aurify-assistant__proposal.is-done .aurify-assistant__note {
    color: #b9f5c9;
}

.aurify-assistant__proposal.is-dismissed .aurify-assistant__items {
    opacity: .5;
}

/* The add-on form under an answer that asked for a service's details: the
   number of songs, each song's length and vocal tracks, stems or not, each
   with what it costs, and the price as it's set. Inputs are scoped under
   .aurify-assistant to win over themes' input[type="text"] rules. */
.aurify-assistant__setup {
    width: 420px;
    max-width: 100%;
}

.aurify-assistant__form {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 10px 12px 12px;
    background: rgba(0, 0, 0, .3);
    border: 1px solid var(--aurify-assistant-line);
    border-radius: 13px;
}

.aurify-assistant__form-head {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

/* No artwork: the name takes its place. */
.aurify-assistant__form-title:first-child {
    grid-column: 1 / 3;
}

.aurify-assistant__form-image {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    object-fit: cover;
}

.aurify-assistant__form-title {
    min-width: 0;
}

.aurify-assistant__form-name {
    display: block;
    font-weight: 700;
    line-height: 1.25;
}

.aurify-assistant__form-hint,
.aurify-assistant__form-notes {
    color: var(--aurify-assistant-muted);
    font-size: 12.5px;
    line-height: 1.4;
}

.aurify-assistant__form-hint {
    display: block;
    margin-top: 2px;
}

.aurify-assistant__form-notes p {
    margin: 0;
}

.aurify-assistant__form-total {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.aurify-assistant__form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
}

.aurify-assistant__form-label {
    min-width: 0;
    color: rgba(255, 255, 255, .86);
    font-size: 13.5px;
    font-weight: 600;
}

/* Song rows line up under their column names. */
.aurify-assistant__form-songs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 10px;
}

.aurify-assistant__form-songs.has-tracks {
    grid-template-columns: minmax(0, 1fr) auto auto;
}

.aurify-assistant__form-song {
    display: contents;
}

.aurify-assistant__form-song--head span {
    color: var(--aurify-assistant-muted);
    font-size: 12px;
    text-align: center;
}

.aurify-assistant__time,
.aurify-assistant__stepper {
    display: inline-flex;
    align-items: center;
}

.aurify-assistant__time {
    gap: 4px;
}

.aurify-assistant__time-colon {
    color: var(--aurify-assistant-muted);
    font-weight: 600;
}

.aurify-assistant input.aurify-assistant__field {
    box-sizing: border-box;
    width: 42px;
    height: 36px;
    min-height: 0;
    margin: 0;
    padding: 0 4px;
    color: #fff;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 9px;
    box-shadow: none;
    font: inherit;
    font-size: 16px; /* smaller text makes iPhones zoom in on focus */
    font-variant-numeric: tabular-nums;
    line-height: 1;
    text-align: center;
}

.aurify-assistant input.aurify-assistant__field::placeholder {
    color: rgba(255, 255, 255, .35);
    opacity: 1;
}

.aurify-assistant input.aurify-assistant__field:focus {
    outline: none;
    box-shadow: none;
}

.aurify-assistant input.aurify-assistant__field:disabled {
    color: var(--aurify-assistant-muted);
    opacity: .7;
}

.aurify-assistant .aurify-assistant__stepper input.aurify-assistant__field {
    width: 38px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
}

.aurify-assistant__step {
    width: 34px;
    height: 36px;
    margin: 0;
    padding: 0;
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .18);
    font: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background 160ms ease;
}

.aurify-assistant__step:first-child {
    border-radius: 9px 0 0 9px;
}

.aurify-assistant__step:last-child {
    border-radius: 0 9px 9px 0;
}

.aurify-assistant__step:hover {
    background: rgba(255, 255, 255, .08);
}

/* Stems or not: two choices, the picked one lit. */
.aurify-assistant__form-options {
    display: grid;
    flex: 1 1 220px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.aurify-assistant__form-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-height: 44px;
    padding: 5px 8px;
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 9px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease;
}

.aurify-assistant__form-option:hover {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .34);
}

.aurify-assistant__form-option.is-selected {
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .72);
}

.aurify-assistant__form-lines {
    margin-top: 0;
    padding-top: 8px;
    border-top: 1px solid var(--aurify-assistant-line);
}

.aurify-assistant__form-error {
    color: #ffc2c2;
}

@media (max-width: 360px) {
    .aurify-assistant input.aurify-assistant__field {
        width: 36px;
    }

    .aurify-assistant .aurify-assistant__stepper input.aurify-assistant__field {
        width: 32px;
    }

    .aurify-assistant__step {
        width: 30px;
    }
}

/* Quick replies under the latest answer. */
.aurify-assistant__chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 13px;
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
    font: inherit;
    font-size: 14px;
    line-height: 1.2;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease;
}

.aurify-assistant__chip:hover {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .34);
}

.aurify-assistant button:focus,
.aurify-assistant button:focus-visible,
.aurify-assistant a:focus,
.aurify-assistant a:focus-visible {
    outline: none;
    box-shadow: none;
}

.aurify-assistant button:disabled {
    cursor: default;
    opacity: .55;
    transform: none;
}

/* Typing dots while the answer comes. */
.aurify-assistant__typing {
    display: flex;
    gap: 5px;
    padding: 14px 16px;
}

.aurify-assistant__dot {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, .7);
    border-radius: 50%;
    animation: aurify-assistant-dot 1.1s ease-in-out infinite;
}

.aurify-assistant__dot:nth-child(2) {
    animation-delay: .15s;
}

.aurify-assistant__dot:nth-child(3) {
    animation-delay: .3s;
}

@keyframes aurify-assistant-dot {
    0%, 70%, 100% { opacity: .3; transform: translateY(0); }
    35% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
    .aurify-assistant__dot {
        animation: none;
    }
}

/* In a conversation the bar takes replies: a plain placeholder instead of the cycling examples. */
.aurify-ai-router.is-chatting .aurify-ai-router__typewriter {
    display: none !important;
}

.aurify-ai-router.is-chatting .aurify-ai-router__input::placeholder {
    color: rgba(255, 255, 255, .45);
    opacity: 1;
}

/* No backdrop blur: a more solid dark keeps the text readable anyway. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .aurify-assistant {
        --aurify-assistant-soft: rgba(8, 10, 14, .9);
        --aurify-assistant-user: rgba(34, 38, 46, .94);
    }
}

/* The one-shot router's own status line and steps have nothing to say here. */
.aurify-ai-router.has-assistant .aurify-ai-router__stage {
    display: none;
}

@media (max-width: 600px) {
    .aurify-assistant__log {
        max-height: min(52vh, 480px);
    }

    .aurify-assistant__msg {
        max-width: 92%;
    }

    .aurify-assistant__msg--assistant {
        max-width: 100%;
    }
}

/* While chatting, the hero is exactly one screen tall and starts below the
   fixed header (top 18px + 68px) instead of centring on the whole screen, so
   the heading never slides under the header. The conversation gives way, not
   the page: the log shrinks and scrolls, and the bar stays on screen. A short
   conversation still sits in the middle. Browsers without :has() keep the
   capped log above. */
@supports selector(:has(*)) {
    .wp-block-uagb-container:has(> .wp-block-uagb-container > .aurify-ai-router.is-chatting) {
        box-sizing: border-box;
        height: 100vh;
        height: 100svh;
        min-height: 0;
        padding-top: 92px;
        padding-bottom: 12px;
        flex-wrap: nowrap; /* Spectra wraps on phones: items would move into a second column instead of shrinking */
    }

    .wp-block-uagb-container:has(> .wp-block-uagb-container > .aurify-ai-router.is-chatting) > .wp-block-uagb-container {
        flex-shrink: 0;
    }

    .wp-block-uagb-container:has(> .wp-block-uagb-container > .aurify-ai-router.is-chatting) > .wp-block-uagb-container:has(> .aurify-ai-router) {
        flex-shrink: 1;
        flex-wrap: nowrap;
        min-height: 0;
    }

    .aurify-ai-router.is-chatting {
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    .aurify-ai-router.is-chatting > * {
        flex-shrink: 0;
    }

    .aurify-ai-router.is-chatting > .aurify-assistant {
        display: flex;
        flex-direction: column;
        flex-shrink: 1;
        min-height: 0;
    }

    .aurify-ai-router.is-chatting .aurify-assistant__head {
        flex-shrink: 0;
    }

    .aurify-ai-router.is-chatting .aurify-assistant__log {
        flex-shrink: 1;
        min-height: 96px;
        max-height: none;
    }
}
