/* Ask AI — chat module styling (original design; not ported from Smoothin's layout). */

.askai-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
}

.askai-layout {
    flex: 1;
    min-height: 0;
    display: flex;
    position: relative;
}

/* Drawer affordances — hidden on wide screens, shown via the small-screen media query below. */
.askai-sidebar-toggle { display: none; }
.askai-backdrop { display: none; }

/* ---- sidebar ---- */
.askai-sidebar {
    width: 280px;
    flex-shrink: 0;
    border-right: 1px solid var(--border, #e6e8ec);
    background: var(--surface, #fff);
    display: flex;
    flex-direction: column;
    padding: 0.9rem;
    gap: 0.75rem;
}

.askai-newchat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border, #e6e8ec);
    background: var(--surface, #fff);
    color: var(--text, #0f172a);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.askai-newchat:hover { background: var(--surface-2, #f1f5f9); border-color: var(--accent, #4f46e5); }
.askai-newchat span { font-size: 1.1rem; line-height: 1; }

.askai-chatlist { overflow-y: auto; display: flex; flex-direction: column; gap: 0.15rem; }

.askai-empty { color: var(--text-muted, #94a3b8); font-size: 0.85rem; padding: 0.5rem; text-align: center; }

.askai-chatitem {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.65rem;
    border-radius: 9px;
    cursor: pointer;
    color: var(--text, #0f172a);
    font-size: 0.9rem;
}

.askai-chatitem:hover { background: var(--surface-2, #f1f5f9); }
.askai-chatitem.active { background: color-mix(in srgb, var(--accent, #4f46e5) 12%, transparent); }

.askai-chatitem-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.askai-chatitem-actions { display: none; gap: 0.1rem; }
.askai-chatitem:hover .askai-chatitem-actions { display: flex; }
.askai-chatitem-actions button {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.15rem;
    border-radius: 6px;
    opacity: 0.7;
}
.askai-chatitem-actions button:hover { opacity: 1; background: rgba(0,0,0,0.06); }

.askai-rename-input {
    flex: 1;
    border: 1px solid var(--accent, #4f46e5);
    border-radius: 7px;
    padding: 0.3rem 0.45rem;
    font-size: 0.88rem;
    width: 100%;
}

/* ---- main chat pane ---- */
.askai-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg, #f6f7f9);
}

.askai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.askai-welcome {
    margin: auto;
    text-align: center;
    color: var(--text-muted, #64748b);
    max-width: 420px;
}
.askai-welcome-icon {
    font-size: 2rem;
    width: 64px; height: 64px;
    display: grid; place-items: center;
    margin: 0 auto 1rem;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent, #4f46e5), #7c3aed);
    color: #fff;
}
.askai-welcome-title { font-size: 1.25rem; font-weight: 700; color: var(--text, #0f172a); margin-bottom: 0.4rem; }
.askai-welcome-sub { font-size: 0.95rem; }

.askai-row { display: flex; }
.askai-row-user { justify-content: flex-end; }
.askai-row-assistant { justify-content: flex-start; }

.askai-bubble {
    max-width: min(680px, 80%);
    padding: 0.7rem 1rem;
    border-radius: 14px;
    font-size: 0.95rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.askai-bubble-user {
    background: var(--accent, #4f46e5);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.askai-bubble-assistant {
    background: var(--surface, #fff);
    color: var(--text, #0f172a);
    border: 1px solid var(--border, #e6e8ec);
    border-bottom-left-radius: 4px;
}

.askai-bubble-assistant p { margin: 0 0 0.5rem; }
.askai-bubble-assistant p:last-child { margin-bottom: 0; }
.askai-bubble-assistant ul, .askai-bubble-assistant ol { margin: 0.3rem 0 0.5rem; padding-left: 1.3rem; }
.askai-bubble-assistant code {
    background: var(--surface-2, #f1f5f9);
    padding: 0.1rem 0.35rem;
    border-radius: 5px;
    font-size: 0.88em;
}
.askai-bubble-assistant pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    overflow-x: auto;
}
.askai-bubble-assistant pre code { background: transparent; padding: 0; color: inherit; }
.askai-h { display: block; margin: 0.4rem 0; font-size: 1.02em; }

/* download button for exported PDF reports */
.askai-download {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
    padding: 0.45rem 0.85rem;
    border-radius: 9px;
    border: 1px solid var(--accent, #4f46e5);
    background: color-mix(in srgb, var(--accent, #4f46e5) 8%, #fff);
    color: var(--accent-strong, #4338ca);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease;
}
.askai-download:hover { background: color-mix(in srgb, var(--accent, #4f46e5) 16%, #fff); }

/* thinking dots */
.askai-thinking { display: flex; gap: 0.25rem; align-items: center; }
.askai-thinking span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--text-muted, #94a3b8);
    animation: askai-bounce 1.2s infinite ease-in-out;
}
.askai-thinking span:nth-child(2) { animation-delay: 0.15s; }
.askai-thinking span:nth-child(3) { animation-delay: 0.3s; }
@keyframes askai-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* ---- input bar ---- */
.askai-inputbar {
    display: flex;
    gap: 0.6rem;
    align-items: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border, #e6e8ec);
    background: var(--surface, #fff);
}

.askai-input {
    flex: 1;
    resize: none;
    border: 1px solid var(--border, #e6e8ec);
    border-radius: 12px;
    padding: 0.7rem 0.9rem;
    font: inherit;
    font-size: 0.95rem;
    line-height: 1.4;
    max-height: 200px;
    outline: none;
}
.askai-input:focus { border-color: var(--accent, #4f46e5); }

.askai-send {
    padding: 0.7rem 1.3rem;
    border-radius: 12px;
    border: none;
    background: var(--accent, #4f46e5);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
}
.askai-send:hover { background: var(--accent-strong, #4338ca); }
.askai-send:disabled { opacity: 0.55; cursor: default; }

/* ---- small screens: the sidebar becomes a collapsible off-canvas drawer ---- */
@media (max-width: 720px) {
    .askai-layout { overflow: hidden; } /* keep the off-canvas drawer from causing horizontal scroll */

    .askai-sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 280px;
        max-width: 84%;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        z-index: 30;
        box-shadow: 2px 0 14px rgba(15, 23, 42, 0.18);
    }

    .askai-layout.sidebar-open .askai-sidebar { transform: translateX(0); }

    .askai-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(15, 23, 42, 0.35);
        z-index: 20;
    }
    .askai-layout.sidebar-open .askai-backdrop { display: block; }

    .askai-sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 0.6rem;
        left: 0.6rem;
        z-index: 40;
        width: 38px;
        height: 38px;
        border-radius: 10px;
        border: 1px solid var(--border, #e6e8ec);
        background: var(--surface, #fff);
        color: var(--text, #0f172a);
        font-size: 1.05rem;
        line-height: 1;
        cursor: pointer;
        box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
    }

    /* Push content clear of the floating toggle so it never overlaps the first message or New chat button. */
    .askai-messages { padding-top: 3.3rem; }
    .askai-sidebar { padding-top: 3.3rem; }
}
