/* AI Assistant chat — styles for the chat pane inside #feedbackModal.
   The .modal-ai-tall class is toggled on the modal element by feedback_button.html
   when the AI tab is active so the transcript can fill the viewport. */

#feedbackModal.modal-ai-tall .modal-dialog {
    max-width: min(900px, 95vw);
    height: calc(100vh - 1rem);
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}
#feedbackModal.modal-ai-tall .modal-content {
    height: 100%;
}
#feedbackModal.modal-ai-tall .ai-chat-window {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
#feedbackModal.modal-ai-tall .ai-chat-messages {
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
}
#feedbackModal.modal-ai-tall #ai-pane {
    display: flex;
    flex-direction: column;
    height: 100%;
}
#feedbackModal.modal-ai-tall .modal-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#feedbackModal.modal-ai-tall .tab-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.ai-chat-window {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #eef1f5;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}
.ai-chat-window__header {
    background: #dee4ec;
    color: #495057;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid #ced4da;
}
.ai-chat-messages {
    height: 60vh;
    min-height: 320px;
    overflow-y: auto;
    padding: 0.75rem;
    cursor: default;
    user-select: text;
}
.ai-chat-messages:empty::before {
    content: "Hi — I'm Chip AI. I can look up your jobs, clients, invoices and revenue. Type a question below to start.";
    color: #6c757d;
    font-style: italic;
    display: block;
    text-align: center;
    padding: 0.5rem 1rem 2rem;
}
.ai-chat-messages:empty {
    background: #eef1f5 url("/static/images/Louie.png") no-repeat center 1.5rem / 96px 96px;
    padding-top: 7rem;
}

.ai-mascot {
    object-fit: contain;
}
.ai-mascot--header { width: 32px; height: 32px; }
.ai-mascot--tab    { width: 18px; height: 18px; }
.ai-chat-messages .chat-msg {
    margin-bottom: 0.75rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.ai-chat-messages .chat-msg--user {
    background: #e7f1ff;
    border-radius: 10px 10px 2px 10px;
    padding: 0.5rem 0.75rem;
    margin-left: 2rem;
}
.ai-chat-messages .chat-msg--assistant {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px 10px 10px 2px;
    padding: 0.5rem 0.75rem;
    margin-right: 2rem;
    white-space: normal;
}
.ai-chat-messages .chat-msg--assistant .chat-md-list {
    margin: 0.25rem 0;
    padding-left: 1.25rem;
}
.ai-chat-messages .chat-msg--assistant .chat-md-list li {
    margin-bottom: 0.15rem;
}
/* `.chat-md-step` items render their own "1." / "2." prefix via .chat-md-num
   (the browser-supplied <ol> marker would double up otherwise — and on some
   clients the markers regress to "1." for every item). */
.ai-chat-messages .chat-msg--assistant .chat-md-list .chat-md-step {
    list-style: none;
    margin-left: -0.5rem;
}
.ai-chat-messages .chat-msg--assistant .chat-md-num {
    font-weight: 600;
    margin-right: 0.25rem;
    color: #495057;
}
.ai-chat-messages .chat-msg--assistant .chat-md-heading {
    margin: 0.4rem 0 0.2rem;
    font-weight: 600;
    line-height: 1.25;
}
.ai-chat-messages .chat-msg--assistant .chat-md-heading:first-child {
    margin-top: 0;
}
.ai-chat-messages .chat-msg--assistant code {
    background: #f1f3f5;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    font-size: 0.9em;
}
.ai-chat-messages .chat-msg--assistant .chat-code {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    margin: 0.4rem 0;
    overflow-x: auto;
    font-size: 0.85em;
}
.ai-chat-messages .chat-msg--tool {
    margin-right: 2rem;
    padding-left: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #6c757d;
    font-size: 0.85em;
    font-style: italic;
}
.ai-chat-messages .chat-tool__spinner {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #ced4da;
    border-top-color: #0d6efd;
    animation: chat-tool-spin 0.7s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}
.ai-chat-messages .chat-tool__check {
    color: #198754;
    font-style: normal;
    flex-shrink: 0;
}
.ai-chat-messages .chat-tool__label {
    flex: 1 1 auto;
    min-width: 0;
}
.ai-chat-messages .chat-tool__deferred {
    background: #fff3cd;
    color: #8a6d00;
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    font-size: 0.85em;
    font-style: normal;
    flex-shrink: 0;
}
.ai-chat-messages .chat-tool--running {
    animation: chat-tool-fadein 0.18s ease-out;
}
@keyframes chat-tool-spin {
    to { transform: rotate(360deg); }
}
@keyframes chat-tool-fadein {
    from { opacity: 0; transform: translateY(-2px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ai-chat-messages .chat-caret {
    display: inline-block;
    width: 6px;
    height: 1em;
    vertical-align: text-bottom;
    margin-left: 1px;
    background: #495057;
    animation: chat-caret-blink 0.9s step-end infinite;
}
@keyframes chat-caret-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}
.ai-chat-messages .chat-typing {
    display: inline-flex;
    gap: 4px;
    padding: 0.5rem 0.75rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px 10px 10px 2px;
    margin-right: 2rem;
}
.ai-chat-messages .chat-typing span {
    width: 6px; height: 6px; border-radius: 50%; background: #6c757d;
    animation: chat-typing-bounce 1.2s infinite ease-in-out;
}
.ai-chat-messages .chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-chat-messages .chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-typing-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-4px); opacity: 1; }
}
.ai-chat-messages .chat-write-prompt {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-left: 4px solid #f9a825;
    border-radius: 6px;
    padding: 0.75rem;
    margin-right: 2rem;
}
.ai-chat-messages .chat-write-prompt__title {
    font-weight: 600;
    color: #8a6d00;
    margin-bottom: 0.25rem;
}
.ai-chat-messages .chat-write-prompt__body {
    margin-bottom: 0.5rem;
    white-space: pre-wrap;
}
.ai-chat-messages .chat-write-prompt__actions {
    display: flex;
    gap: 0.5rem;
}
.ai-chat-messages .chat-upgrade-prompt {
    background: #eaf3ff;
    border: 1px solid #b6d4fe;
    border-left: 4px solid #0d6efd;
    border-radius: 6px;
    padding: 0.75rem;
    margin-right: 2rem;
}
.ai-chat-messages .chat-upgrade-prompt__title {
    font-weight: 600;
    color: #0a58ca;
    margin-bottom: 0.25rem;
}
.ai-chat-messages .chat-upgrade-prompt__body {
    color: #0a3a78;
    font-size: 0.92em;
}
