/* Setup Guide hero assistant — neo-branded */

.setup-chat {
    --setup-chat-red: var(--tapus-red, #9a1b24);
    --setup-chat-red-dark: var(--tapus-red-dark, #70070e);
    --setup-chat-blue: var(--tapus-blue, #1d38be);
    --setup-chat-ease: var(--neo-ease, cubic-bezier(0.22, 1, 0.36, 1));
    --setup-chat-duration: var(--neo-duration-slow, 0.35s);
    --setup-chat-fast: var(--neo-duration-fast, 0.18s);

    max-width: 42rem;
    margin: 0 auto;
    background: #fff;
    text-align: left;
    overflow: hidden;
    color: #1e1e1e;
    animation: setup-chat-rise 0.55s var(--setup-chat-ease) both;
}

@keyframes setup-chat-rise {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.setup-chat__header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1.1rem 1.25rem;
    background: linear-gradient(135deg, var(--setup-chat-red) 0%, var(--setup-chat-red-dark) 100%);
    color: #fff;
    border-bottom: var(--neo-border-width-thick, 3px) solid #1e1e1e;
}

.setup-chat__avatar {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 9999px;
    background: #fff;
    border: 2px solid #1e1e1e;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
}

.setup-chat__logo {
    width: 1.85rem;
    height: 1.85rem;
    object-fit: contain;
}

.setup-chat__header-text {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.setup-chat__title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
    margin: 0;
    line-height: 1.2;
}

.setup-chat__subtitle {
    font-family: 'Quiapo', 'Poppins', sans-serif;
    font-size: 0.8125rem;
    margin: 0.15rem 0 0;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.35;
}

.setup-chat__pulse {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 9999px;
    background: #4ade80;
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55);
    animation: setup-chat-pulse 1.8s ease-out infinite;
    flex-shrink: 0;
}

.setup-chat[data-enabled="0"] .setup-chat__pulse {
    background: #94a3b8;
    animation: none;
    box-shadow: none;
}

@keyframes setup-chat-pulse {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
    70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.setup-chat__log {
    padding: 1.1rem 1.15rem;
    max-height: 22rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background:
        radial-gradient(circle at top right, rgba(157, 27, 36, 0.04), transparent 40%),
        radial-gradient(circle at bottom left, rgba(29, 56, 190, 0.05), transparent 42%),
        #fafafa;
    scroll-behavior: smooth;
}

.setup-chat__msg {
    display: flex;
    max-width: 88%;
    opacity: 0;
    transform: translateY(10px);
    animation: setup-msg-in var(--setup-chat-duration) var(--setup-chat-ease) forwards;
}

.setup-chat__msg--bot {
    align-self: flex-start;
}

.setup-chat__msg--user {
    align-self: flex-end;
}

.setup-chat__msg--error {
    align-self: flex-start;
}

.setup-chat__msg--welcome {
    animation-delay: 0.12s;
}

@keyframes setup-msg-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.setup-chat__bubble {
    padding: 0.8rem 1rem;
    border-radius: 1.1rem;
    font-size: 0.9375rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
    border: 2px solid #1e1e1e;
    box-shadow: 3px 3px 0 rgba(30, 30, 30, 0.18);
}

.setup-chat__msg--bot .setup-chat__bubble {
    background: #fff;
    color: #1e1e1e;
    border-bottom-left-radius: 0.35rem;
}

.setup-chat__msg--user .setup-chat__bubble {
    background: var(--setup-chat-blue);
    color: #fff;
    border-bottom-right-radius: 0.35rem;
}

.setup-chat__msg--error .setup-chat__bubble {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
    box-shadow: 3px 3px 0 rgba(153, 27, 27, 0.12);
}

/* Markdown-ish reply formatting */
.setup-chat__bubble p {
    margin: 0 0 0.55rem;
}

.setup-chat__bubble p:last-child {
    margin-bottom: 0;
}

.setup-chat__bubble strong {
    font-weight: 700;
    color: inherit;
}

.setup-chat__msg--bot .setup-chat__bubble strong {
    color: var(--setup-chat-red);
}

.setup-chat__bubble em {
    font-style: italic;
}

.setup-chat__bubble code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.84em;
    background: rgba(29, 56, 190, 0.08);
    border: 1px solid rgba(29, 56, 190, 0.18);
    border-radius: 0.35rem;
    padding: 0.1rem 0.35rem;
}

.setup-chat__msg--user .setup-chat__bubble code {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.28);
}

.setup-chat__bubble ul,
.setup-chat__bubble ol {
    margin: 0.35rem 0 0.55rem;
    padding-left: 1.2rem;
}

.setup-chat__bubble li {
    margin: 0.25rem 0;
}

.setup-chat__bubble li::marker {
    color: var(--setup-chat-red);
}

.setup-chat__msg--user .setup-chat__bubble li::marker {
    color: #ffd85f;
}

.setup-chat__bubble a {
    color: var(--setup-chat-blue);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.setup-chat__msg--user .setup-chat__bubble a {
    color: #ffd85f;
}

/* Typing indicator */
.setup-chat__typing {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 1.25rem;
}

.setup-chat__typing-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 9999px;
    background: var(--setup-chat-red);
    animation: setup-typing-bounce 1.05s ease-in-out infinite;
}

.setup-chat__typing-dot:nth-child(2) { animation-delay: 0.15s; }
.setup-chat__typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes setup-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.setup-chat__form {
    display: flex;
    gap: 0.55rem;
    padding: 0.9rem 1.15rem;
    border-top: var(--neo-border-width-thick, 3px) solid #1e1e1e;
    background: #fff;
}

.setup-chat__input {
    flex: 1;
    border: 2px solid #1e1e1e;
    border-radius: 9999px;
    padding: 0.72rem 1.1rem;
    font-size: 0.9375rem;
    font-family: 'Poppins', sans-serif;
    color: #1e1e1e;
    background: #fff;
    box-shadow: 2px 2px 0 rgba(30, 30, 30, 0.12);
    transition:
        border-color var(--setup-chat-fast) ease,
        box-shadow var(--setup-chat-fast) ease,
        transform var(--setup-chat-fast) ease;
}

.setup-chat__input:focus {
    outline: none;
    border-color: var(--setup-chat-blue);
    box-shadow: 3px 3px 0 rgba(29, 56, 190, 0.22);
}

.setup-chat__input:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

.setup-chat__send {
    width: 2.95rem;
    height: 2.95rem;
    border-radius: 9999px;
    background: var(--setup-chat-red);
    color: #fff;
    border: 2px solid #1e1e1e;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 3px 3px 0 #1e1e1e;
    transition:
        transform var(--setup-chat-fast) ease,
        box-shadow var(--setup-chat-fast) ease,
        background var(--setup-chat-fast) ease;
}

.setup-chat__send:hover:not(:disabled) {
    background: var(--setup-chat-red-dark);
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 #1e1e1e;
}

.setup-chat__send:active:not(:disabled) {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #1e1e1e;
}

.setup-chat__send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.setup-chat__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1.15rem 1.15rem;
    background: #fff;
}

.setup-chat__chip {
    border: 2px solid #1e1e1e;
    background: #fff;
    color: #1e1e1e;
    border-radius: 9999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    box-shadow: 2px 2px 0 rgba(30, 30, 30, 0.15);
    transition:
        transform var(--setup-chat-fast) ease,
        box-shadow var(--setup-chat-fast) ease,
        background var(--setup-chat-fast) ease,
        color var(--setup-chat-fast) ease;
}

.setup-chat__chip:hover {
    background: var(--setup-chat-blue);
    color: #fff;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 #1e1e1e;
}

.setup-chat__chip:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #1e1e1e;
}

.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;
}

@media (max-width: 640px) {
    .setup-chat__log {
        max-height: 16rem;
    }

    .setup-chat__msg {
        max-width: 94%;
    }

    .setup-chat__subtitle {
        font-size: 0.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .setup-chat,
    .setup-chat__msg,
    .setup-chat__pulse,
    .setup-chat__typing-dot,
    .setup-chat__send,
    .setup-chat__chip,
    .setup-chat__input {
        animation: none !important;
        transition: none !important;
    }

    .setup-chat__msg {
        opacity: 1;
        transform: none;
    }
}
