/* ===============================
   CLEO SCREEN (Quick Access)
================================ */

.quick-access-content.qa-content--flush {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.qa-cleo-root .hidden {
    display: none !important;
}

.qa-cleo-root {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: var(--da-text);
}

.qa-cleo-topbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--da-border-strong);
    background: var(--da-surface);
}

.qa-cleo-select {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--da-border-strong);
    border-radius: 3px;
    background: var(--da-surface);
    padding: 4px 6px;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--da-text);
    cursor: pointer;
}

.qa-cleo-select:focus {
    outline: none;
    border-color: #0078d4;
}

.qa-cleo-icon-btn {
    background: transparent;
    border: none;
    color: var(--da-text-secondary);
    padding: 4px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    flex-shrink: 0;
}

.qa-cleo-icon-btn:hover {
    background: var(--da-surface-alt);
    color: #0078d4;
}

.qa-cleo-icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Messages -------------------------------------------------- */
.qa-cleo-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qa-cleo-msg {
    display: flex;
}

.qa-cleo-msg.user {
    justify-content: flex-end;
}

.qa-cleo-msg-content {
    max-width: 85%;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.qa-cleo-msg.user .qa-cleo-msg-content {
    background: #0078d4;
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.qa-cleo-msg.assistant .qa-cleo-msg-content {
    background: var(--da-surface-alt);
    color: var(--da-text);
    border-bottom-left-radius: 2px;
}

.qa-cleo-msg.error .qa-cleo-msg-content {
    background: #fdf3f4;
    color: #a4262c;
    border: 1px solid #f1c6c9;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Summary message ------------------------------------------- */
.qa-cleo-msg-content.qa-cleo-summary {
    max-width: 100%;
    width: 100%;
    background: var(--da-surface-alt);
    border: 1px solid var(--da-border-strong);
    border-radius: 8px;
}

.qa-cleo-summary-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #0078d4;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--da-border-strong);
}

.qa-cleo-summary-meta {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    font-size: 10.5px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--da-text-secondary);
}

.qa-cleo-summary-status {
    color: var(--da-text-secondary);
    font-size: 12px;
}

.qa-cleo-summary-failed {
    color: #a4262c;
    display: flex;
    align-items: center;
    gap: 8px;
}

.qa-inline-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--da-border-strong);
    border-top: 2px solid #0078d4;
    border-radius: 50%;
    animation: qa-spin 0.8s linear infinite;
}

/* --- Markdown --------------------------------------------------- */
.qa-cleo-markdown {
    white-space: normal;
}

.qa-cleo-markdown p {
    margin: 0 0 6px;
}

.qa-cleo-markdown p:last-child {
    margin-bottom: 0;
}

.qa-cleo-markdown h1,
.qa-cleo-markdown h2,
.qa-cleo-markdown h3,
.qa-cleo-markdown h4 {
    font-size: 12.5px;
    font-weight: 600;
    margin: 8px 0 4px;
}

.qa-cleo-markdown ul,
.qa-cleo-markdown ol {
    padding-left: 18px;
    margin: 6px 0;
}

.qa-cleo-markdown li {
    margin-bottom: 3px;
}

.qa-cleo-markdown pre {
    background: var(--da-surface-alt);
    border: 1px solid var(--da-border-strong);
    padding: 6px;
    border-radius: 4px;
    overflow-x: auto;
}

.qa-cleo-markdown table {
    border-collapse: collapse;
    width: 100%;
    font-size: 11.5px;
}

.qa-cleo-markdown th,
.qa-cleo-markdown td {
    border: 1px solid var(--da-border-strong);
    padding: 3px 6px;
    text-align: left;
}

/* --- Status rows ------------------------------------------------ */
.qa-cleo-messages-loading {
    font-size: 12px;
    color: var(--da-text-secondary);
    padding: 10px 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.qa-cleo-error {
    font-size: 12px;
    color: #a4262c;
    padding: 10px 2px;
}

.qa-cleo-retry {
    background: transparent;
    border: 1px solid #a4262c;
    color: #a4262c;
    border-radius: 4px;
    font-size: 11px;
    padding: 1px 6px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.qa-cleo-typing {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--da-text-secondary);
}

.qa-cleo-dots span {
    display: inline-block;
    width: 4px;
    height: 4px;
    margin-right: 2px;
    border-radius: 50%;
    background: var(--da-text-secondary);
    animation: qa-cleo-blink 1.2s infinite ease-in-out;
}

.qa-cleo-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.qa-cleo-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes qa-cleo-blink {

    0%,
    80%,
    100% {
        opacity: 0.2;
    }

    40% {
        opacity: 1;
    }
}

/* --- Suggestion pills ------------------------------------------- */
.qa-cleo-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 8px 12px;
    background: var(--da-surface);
}

.qa-cleo-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--da-surface);
    border: 1px solid var(--da-border-strong);
    color: var(--da-text);
    border-radius: 14px;
    padding: 4px 12px;
    font-size: 12px;
    font-family: inherit;
    line-height: 1.4;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.qa-cleo-pill i {
    font-size: 12px;
}

.qa-cleo-pill:hover:not(:disabled) {
    background: var(--da-surface-alt);
    border-color: #0078d4;
    color: #0078d4;
}

.qa-cleo-pill:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Staged attachments (composer) ------------------------------ */
.qa-cleo-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
    border-top: 1px solid var(--da-border);
    background: var(--da-surface-alt);
}

.qa-cleo-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 180px;
    padding: 2px 4px 2px 7px;
    border: 1px solid var(--da-border-strong);
    border-radius: 12px;
    background: var(--da-surface);
    color: var(--da-text);
    font-size: 11.5px;
}

.qa-cleo-chip i {
    color: var(--da-primary-text);
    font-size: 11px;
    flex-shrink: 0;
}

.qa-cleo-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qa-cleo-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--da-text-secondary);
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.qa-cleo-chip-remove:hover {
    background: var(--da-row-hover);
    color: var(--da-text);
}

/* --- Attachments inside a message bubble ------------------------ */

/* The message row is a flex row that positions the message left or right; this column keeps the
   thumbnails above the bubble instead of alongside it, and inherits that side's alignment. */
.qa-cleo-msg-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 85%;
    min-width: 0;
}

.qa-cleo-msg.user .qa-cleo-msg-stack {
    align-items: flex-end;
}

.qa-cleo-msg.assistant .qa-cleo-msg-stack,
.qa-cleo-msg.error .qa-cleo-msg-stack {
    align-items: flex-start;
}

/* The stack already carries the width cap the bubble would otherwise apply to itself. */
.qa-cleo-msg-stack .qa-cleo-msg-content {
    max-width: 100%;
}

.qa-cleo-attachment-grid {
    display: grid;
    gap: 3px;
    max-width: 240px;
}

/* One image gets the full bubble width; two or three share a row. */
.qa-cleo-attachment-grid.count-1 { grid-template-columns: 1fr; }
.qa-cleo-attachment-grid.count-2 { grid-template-columns: repeat(2, 1fr); }
.qa-cleo-attachment-grid.count-3 { grid-template-columns: repeat(3, 1fr); }

.qa-cleo-attachment-tile {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 1px solid var(--da-border-strong);
    border-radius: 6px;
    overflow: hidden;
    background: var(--da-surface-alt);
    cursor: pointer;
    aspect-ratio: 1 / 1;
}

.qa-cleo-attachment-tile:not(.loaded)::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            var(--da-surface-alt) 25%,
            var(--da-row-hover) 50%,
            var(--da-surface-alt) 75%);
    background-size: 200% 100%;
    animation: qa-cleo-attachment-shimmer 1.2s ease-in-out infinite;
}

@keyframes qa-cleo-attachment-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.qa-cleo-attachment-grid.count-1 .qa-cleo-attachment-tile {
    aspect-ratio: 4 / 3;
    max-height: 220px;
}

.qa-cleo-attachment-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.15s ease-in;
}

.qa-cleo-attachment-tile.loaded img {
    opacity: 1;
}

.qa-cleo-attachment-tile.failed::after {
    content: "\F33A";
    font-family: "bootstrap-icons";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--da-text-disabled);
    font-size: 18px;
}

.qa-cleo-attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border: 1px solid var(--da-border-strong);
    border-radius: 6px;
    background: var(--da-surface-alt);
    color: var(--da-text);
    font-size: 11.5px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Lightbox --------------------------------------------------- */
.qa-cleo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.75);
    cursor: zoom-out;
}

.qa-cleo-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

/* --- Input (always pinned to the bottom) ------------------------ */
.qa-cleo-input-area {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid var(--da-border-strong);
    background: var(--da-surface);
}

.qa-cleo-attach {
    background: transparent;
    border: 1px solid #c8c6c4;
    color: #605e5c;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.qa-cleo-attach:hover {
    background: #f3f2f1;
    color: #0078d4;
    border-color: #0078d4;
}

.qa-cleo-attach:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

textarea.qa-cleo-input {
    flex: 1;
    resize: none;
    border: 1px solid var(--da-border-strong);
    border-radius: 4px;
    padding: 7px 9px;
    font-size: 12.5px;
    font-family: inherit;
    line-height: 1.4;
    max-height: 110px;
    overflow-y: auto;
    background: var(--da-surface);
    color: var(--da-text);
}

textarea.qa-cleo-input:focus {
    outline: none;
    border-color: #0078d4;
}

.qa-cleo-send {
    background: #0078d4;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.qa-cleo-send:hover {
    background: #005a9e;
}

.qa-cleo-send:disabled {
    background: #c8c6c4;
    cursor: not-allowed;
}
