/* AI Assistant Demo — page-specific styles
 * Extends public.css palette and typography conventions.
 */

/* ─── Hero ──────────────────────────────────────────────────────────────── */

.ai-demo-hero {
    text-align: center;
}

.ai-demo-hero__badge {
    display: inline-block;
    padding: 0.3rem 0.9rem;
    border-radius: 9999px;
    background: rgba(37, 99, 235, 0.08);
    color: rgb(37 99 235);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}

.ai-demo-hero__title {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 700;
    color: rgb(15 20 25);
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.ai-demo-hero__sub {
    font-size: 1rem;
    line-height: 1.7;
    color: rgb(100 120 150);
    max-width: 38rem;
    margin: 0 auto;
}

/* ─── Error banner ───────────────────────────────────────────────────────── */

.ai-demo-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.ai-demo-banner--error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.ai-demo-banner__retry {
    margin-left: auto;
    background: none;
    border: 1px solid currentColor;
    border-radius: 0.5rem;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    color: inherit;
    white-space: nowrap;
    transition: background 0.15s;
}

.ai-demo-banner__retry:hover {
    background: rgba(185, 28, 28, 0.08);
}

/* ─── Chat shell ─────────────────────────────────────────────────────────── */

.ai-demo-shell {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid rgb(226 232 240);
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 4px 24px rgba(15, 20, 25, 0.06);
    overflow: hidden;
}

/* ─── Messages ───────────────────────────────────────────────────────────── */

.ai-demo-messages {
    min-height: 280px;
    max-height: 420px;
    overflow-y: auto;
    padding: 1.25rem 1.25rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    scroll-behavior: smooth;
}

.ai-demo-bubble {
    max-width: 82%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    word-break: break-word;
}

.ai-demo-bubble--assistant {
    align-self: flex-start;
    background: rgb(246 247 249);
    color: rgb(15 20 25);
    border-bottom-left-radius: 0.25rem;
}

/* Paragraphs and lists inside assistant bubble */
.ai-demo-bubble--assistant .bubble-para {
    display: block;
}

.ai-demo-bubble--assistant .bubble-para + .bubble-para,
.ai-demo-bubble--assistant .bubble-para + .bubble-list,
.ai-demo-bubble--assistant .bubble-list + .bubble-para,
.ai-demo-bubble--assistant .bubble-list + .bubble-list {
    margin-top: 0.5rem;
}

.ai-demo-bubble--assistant .bubble-spacer {
    display: block;
    height: 0.25rem;
}

.ai-demo-bubble--assistant .bubble-list {
    margin: 0.5rem 0 0 0;
    padding-left: 1.25rem;
    list-style: disc;
}

.ai-demo-bubble--assistant .bubble-list li {
    margin-top: 0.25rem;
    line-height: 1.55;
}

.ai-demo-bubble--user {
    align-self: flex-end;
    background: rgb(37 99 235);
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

/* ─── Typing indicator ───────────────────────────────────────────────────── */

.ai-demo-typing {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.55rem 0.875rem;
    background: rgb(246 247 249);
    border-radius: 1rem;
    border-bottom-left-radius: 0.25rem;
}

.ai-demo-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgb(148 163 184);
    animation: ai-demo-bounce 1.2s infinite ease-in-out;
}

.ai-demo-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-demo-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ai-demo-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* ─── Quick replies ──────────────────────────────────────────────────────── */

.ai-demo-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgb(241 245 249);
}

.ai-demo-qr-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 1rem;
    border-radius: 9999px;
    border: 1.5px solid rgb(37 99 235);
    background: transparent;
    color: rgb(37 99 235);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.ai-demo-qr-btn:hover {
    background: rgb(37 99 235);
    color: #fff;
}

/* ─── Product cards ──────────────────────────────────────────────────────── */

.ai-demo-products {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgb(241 245 249);
}

.ai-demo-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.ai-demo-product-card {
    display: block;
    text-decoration: none;
    padding: 0.875rem 1rem;
    border-radius: 0.875rem;
    border: 1px solid rgb(226 232 240);
    background: rgb(248 250 252);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ai-demo-product-card:hover {
    border-color: rgb(37 99 235);
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.12);
}

.ai-demo-product-card__name {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgb(15 20 25);
    margin-bottom: 0.375rem;
    line-height: 1.35;
}

.ai-demo-product-card__price {
    font-size: 0.9375rem;
    font-weight: 700;
    color: rgb(37 99 235);
    margin-bottom: 0.5rem;
}

.ai-demo-product-card__specs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.4rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.35;
    color: rgb(100 116 139);
}

.ai-demo-product-card__sep {
    color: rgb(203 213 225);
    user-select: none;
}

.ai-demo-product-card__link {
    font-size: 0.8125rem;
    color: rgb(100 116 139);
}

/* ─── Lead form ──────────────────────────────────────────────────────────── */

.ai-demo-lead-form-wrap {
    padding: 1.25rem;
    border-top: 1px solid rgb(241 245 249);
    background: rgb(248 250 252);
}

.ai-demo-lead-form-title {
    font-size: 1rem;
    font-weight: 600;
    color: rgb(15 20 25);
    margin-bottom: 1rem;
}

.ai-demo-lead-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ai-demo-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 480px) {
    .ai-demo-field-row {
        grid-template-columns: 1fr;
    }
}

.ai-demo-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.ai-demo-field label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgb(61 74 92);
}

.ai-demo-field label span {
    color: rgb(185 28 28);
}

.ai-demo-field input,
.ai-demo-field textarea {
    padding: 0.6rem 0.875rem;
    border-radius: 0.6rem;
    border: 1px solid rgb(203 213 225);
    background: #fff;
    font-size: 0.9375rem;
    color: rgb(15 20 25);
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    resize: vertical;
}

.ai-demo-field input::placeholder,
.ai-demo-field textarea::placeholder {
    color: rgb(148 163 184);
}

.ai-demo-field input:focus,
.ai-demo-field textarea:focus {
    outline: none;
    border-color: rgb(37 99 235);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ai-demo-field-error {
    font-size: 0.8125rem;
    color: rgb(185 28 28);
    padding: 0.4rem 0;
}

.ai-demo-lead-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.5rem;
    border-radius: 9999px;
    border: none;
    background: rgb(37 99 235);
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
    align-self: flex-start;
}

.ai-demo-lead-submit:hover:not(:disabled) {
    background: rgb(29 78 216);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.ai-demo-lead-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ─── Manager summary ────────────────────────────────────────────────────── */

.ai-demo-manager-summary {
    margin: 0;
    padding: 1.25rem;
    border-top: 1px solid rgb(241 245 249);
    background: linear-gradient(135deg, rgb(240 253 244), rgb(248 250 252));
}

.ai-demo-manager-summary__label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgb(22 163 74);
    margin-bottom: 0.75rem;
}

.ai-demo-manager-summary__body {
    font-size: 0.875rem;
    line-height: 1.55;
    color: rgb(30 41 59);
    margin: 0;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 0.625rem;
    border: 1px solid rgb(187 247 208);
}

.ai-demo-summary-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 1rem;
    row-gap: 0.4rem;
    margin: 0;
}

.ai-demo-summary-key {
    margin: 0;
    font-weight: 500;
    color: rgb(71 85 105);
}

.ai-demo-summary-val {
    margin: 0;
    font-weight: 600;
    color: rgb(15 23 42);
    word-break: break-word;
}

.ai-demo-summary-empty {
    color: rgb(100 116 139);
    font-style: italic;
}

.ai-demo-summary-raw {
    white-space: pre-wrap;
    font-family: "SF Mono", "Fira Mono", "Cascadia Code", monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    margin: 0;
    color: rgb(30 41 59);
}

@media (max-width: 480px) {
    .ai-demo-summary-list {
        grid-template-columns: 1fr;
        row-gap: 0.15rem;
    }
    .ai-demo-summary-key {
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: rgb(22 163 74);
        margin-top: 0.5rem;
    }
    .ai-demo-summary-list .ai-demo-summary-key:first-of-type {
        margin-top: 0;
    }
}

/* ─── Composer ───────────────────────────────────────────────────────────── */

.ai-demo-composer {
    border-top: 1px solid rgb(226 232 240);
    padding: 0.875rem 1rem;
}

.ai-demo-composer__form {
    display: flex;
    gap: 0.625rem;
    align-items: center;
}

.ai-demo-composer__input {
    flex: 1;
    padding: 0.65rem 1rem;
    border-radius: 9999px;
    border: 1.5px solid rgb(203 213 225);
    background: rgb(248 250 252);
    font-size: 0.9375rem;
    color: rgb(15 20 25);
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ai-demo-composer__input::placeholder {
    color: rgb(148 163 184);
}

.ai-demo-composer__input:focus {
    outline: none;
    border-color: rgb(37 99 235);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    background: #fff;
}

.ai-demo-composer__input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-demo-composer__send {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background: rgb(37 99 235);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}

.ai-demo-composer__send:hover:not(:disabled) {
    background: rgb(29 78 216);
    transform: scale(1.07);
}

.ai-demo-composer__send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ─── Disclaimer ─────────────────────────────────────────────────────────── */

.ai-demo-disclaimer {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.8125rem;
    color: rgb(148 163 184);
    line-height: 1.6;
}
