.shopai-storefront,
.shopai-storefront * {
    box-sizing: border-box;
}

.shopai-storefront {
    color: #20352d;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shopai-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 52px;
    padding: 6px 15px 6px 6px;
    color: #ffffff;
    background: #267a58;
    border: 0;
    border-radius: 28px;
    box-shadow: 0 8px 24px rgba(31, 68, 52, .22);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 650;
}

.shopai-launcher:hover {
    background: #1d6045;
}

.shopai-launcher-mark,
.shopai-panel-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #d9f2e5;
}

.shopai-launcher-mark {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.shopai-panel-mark {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 8px;
}

.shopai-wave {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 16px;
}

.shopai-wave i {
    display: block;
    width: 2px;
    height: 8px;
    background: #267a58;
    animation: shopai-wave 1s ease-in-out infinite alternate;
}

.shopai-wave i:nth-child(2) { animation-delay: -.15s; }
.shopai-wave i:nth-child(3) { animation-delay: -.3s; }
.shopai-wave i:nth-child(4) { animation-delay: -.45s; }
.shopai-wave i:nth-child(5) { animation-delay: -.6s; }

@keyframes shopai-wave {
    from { transform: scaleY(.55); }
    to { transform: scaleY(1.45); }
}

.shopai-assistant-panel {
    position: fixed;
    right: 24px;
    bottom: 88px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    width: min(520px, calc(100vw - 32px));
    height: min(720px, calc(100vh - 120px));
    min-height: 520px;
    overflow: hidden;
    color: #20352d;
    background: #ffffff;
    border: 1px solid #d7e5de;
    border-radius: 12px;
    box-shadow: 0 18px 50px rgba(31, 68, 52, .2);
}

.shopai-assistant-panel.is-open {
    animation: shopai-panel-in .18s ease-out;
}

@keyframes shopai-panel-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shopai-spin {
    to { transform: rotate(360deg); }
}

.shopai-assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 16px;
    border-bottom: 1px solid #e6eeea;
}

.shopai-assistant-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.shopai-assistant-heading strong,
.shopai-assistant-heading small {
    display: block;
}

.shopai-assistant-heading strong {
    font-size: 14px;
    line-height: 1.25;
}

.shopai-assistant-heading small {
    margin-top: 2px;
    color: #708079;
    font-size: 11px;
}

.shopai-icon-button,
.shopai-round-button,
.shopai-send-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    cursor: pointer;
    font: inherit;
}

.shopai-icon-button {
    width: 28px;
    height: 28px;
    color: #687972;
    background: transparent;
    font-size: 22px;
    line-height: 1;
}

.shopai-assistant-status {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    color: #708079;
    background: #f5faf7;
    font-size: 11px;
}

.shopai-speaking-wave {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 18px;
    margin-left: auto;
    padding: 0 3px;
}

.shopai-speaking-wave[hidden] {
    display: none;
}

.shopai-speaking-wave i {
    display: block;
    width: 3px;
    height: 7px;
    border-radius: 3px;
    background: #267a58;
    animation: shopai-speaking-wave 850ms ease-in-out infinite alternate;
}

.shopai-speaking-wave i:nth-child(2) { animation-delay: -120ms; }
.shopai-speaking-wave i:nth-child(3) { animation-delay: -240ms; }
.shopai-speaking-wave i:nth-child(4) { animation-delay: -360ms; }
.shopai-speaking-wave i:nth-child(5) { animation-delay: -480ms; }
.shopai-speaking-wave i:nth-child(6) { animation-delay: -600ms; }
.shopai-speaking-wave i:nth-child(7) { animation-delay: -720ms; }

@keyframes shopai-speaking-wave {
    from { height: 5px; }
    to { height: 17px; }
}

.shopai-status-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #c29539;
}

.shopai-messages {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    padding: 18px 16px;
    overflow-y: auto;
    background: #fbfdfc;
}

.shopai-message {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
}

.shopai-message p {
    margin: 4px 0 0;
}

.shopai-message-label {
    color: #6c7b74;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.shopai-message-assistant {
    align-self: flex-start;
    background: #eaf5ee;
}

.shopai-message-user {
    align-self: flex-end;
    color: #ffffff;
    background: #267a58;
}

.shopai-message-user .shopai-message-label {
    color: #d9f2e5;
}

.shopai-loading-message {
    display: flex;
    align-items: center;
    align-self: flex-start;
    gap: 9px;
    color: #708079;
    font-size: 12px;
}

.shopai-loading-spinner {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border: 2px solid #cfe3d7;
    border-top-color: #267a58;
    border-radius: 50%;
    animation: shopai-spin .75s linear infinite;
}

.shopai-product-message {
    width: 100%;
    padding: 14px;
    background: #f7fbf8;
    border: 1px solid #d7e5de;
}

.shopai-product-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.shopai-product-heading strong {
    color: #20352d;
    font-size: 13px;
}

.shopai-product-heading span {
    color: #708079;
    font-size: 11px;
}

.shopai-product-grid {
    display: flex;
    gap: 10px;
    padding-bottom: 5px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.shopai-product-card {
    display: flex;
    width: 214px;
    min-width: 214px;
    flex-direction: column;
    gap: 10px;
    padding: 9px;
    background: #ffffff;
    border: 1px solid #d7e5de;
}

.shopai-product-card.is-featured {
    border-color: #267a58;
}

.shopai-product-card img {
    width: 100%;
    height: 132px;
    object-fit: contain;
    background: #ffffff;
}

.shopai-product-details {
    min-width: 0;
}

.shopai-product-details strong {
    display: block;
    overflow: hidden;
    color: #20352d;
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
}

.shopai-product-price {
    display: block;
    margin-top: 4px;
    color: #267a58;
    font-size: 12px;
    font-weight: 700;
}

.shopai-product-details p {
    margin: 6px 0;
    color: #708079;
    font-size: 11px;
    line-height: 1.35;
}

.shopai-product-details a {
    color: #267a58;
    font-size: 11px;
    font-weight: 700;
}

.shopai-product-empty {
    margin: 0;
    color: #708079;
    font-size: 12px;
    line-height: 1.45;
}

.shopai-product-modal[hidden] {
    display: none;
}

.shopai-product-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.shopai-product-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 32, 27, .42);
}

.shopai-product-modal-dialog {
    position: relative;
    display: flex;
    width: min(760px, calc(100vw - 32px));
    height: min(72vh, 720px);
    min-height: 420px;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 18px 55px rgba(20, 32, 27, .28);
}

.shopai-product-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    color: #20352d;
    border-bottom: 1px solid #e6eeea;
}

.shopai-product-modal-header strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shopai-product-modal-body {
    position: relative;
    min-height: 0;
    flex: 1 1 auto;
    background: #f7fbf8;
}

.shopai-product-modal-body iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #ffffff;
}

.shopai-product-modal-error {
    margin: 32px;
    color: #52635b;
    font-size: 13px;
    line-height: 1.5;
}

body.shopai-modal-open {
    overflow: hidden;
}

.shopai-composer {
    padding: 12px 14px 14px;
    border-top: 1px solid #e6eeea;
    background: #ffffff;
}

.shopai-text-entry {
    display: flex;
    gap: 7px;
    margin-bottom: 10px;
}

.shopai-text-entry[hidden],
.shopai-assistant-panel[hidden] {
    display: none;
}

.shopai-text-entry input {
    min-width: 0;
    flex: 1;
    height: 36px;
    padding: 8px 10px;
    border: 1px solid #cbdcd2;
    border-radius: 6px;
    color: #20352d;
    font: inherit;
    font-size: 13px;
}

.shopai-send-button {
    width: 36px;
    height: 36px;
    color: #ffffff;
    background: #267a58;
    border-radius: 6px;
    font-size: 20px;
}

.shopai-composer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shopai-round-button {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    color: #52655c;
    background: #f0f6f2;
    border-radius: 50%;
    font-size: 17px;
}

.shopai-round-button:hover,
.shopai-round-button.is-active {
    color: #ffffff;
    background: #267a58;
}

.shopai-round-button:disabled,
.shopai-send-button:disabled,
.shopai-launcher:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.shopai-listening-label {
    min-width: 0;
    flex: 1;
    color: #77877f;
    font-size: 11px;
    line-height: 1.3;
}

.shopai-disconnect-button {
    color: #a24646;
    background: #fbefef;
}

@media (max-width: 520px) {
    .shopai-launcher {
        right: 16px;
        bottom: 16px;
    }

    .shopai-assistant-panel {
        right: 16px;
        bottom: 80px;
        width: calc(100vw - 32px);
        height: min(680px, calc(100vh - 104px));
        min-height: 480px;
    }

    .shopai-product-modal {
        padding: 12px;
    }

    .shopai-product-modal-dialog {
        width: calc(100vw - 24px);
        height: min(82vh, 680px);
        min-height: 360px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .shopai-wave i,
    .shopai-speaking-wave i,
    .shopai-assistant-panel.is-open {
        animation: none;
    }
}
