/* Agent paneli - analitika səhifəsi və ana səhifə üçün ortaq (2026-11-21-də
   analytics.html-dən ayrıldı). Rəng dəyişənləri styles.css-dədir. */

/* ===== Agent: floating button, bottom right, and its panel ===== */
.agent-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 900;
    width: 56px;
    height: 56px;
    padding: 8px;
    border: none;
    border-radius: 16px;
    background: var(--a-surface-deep);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    transition: transform 0.15s;
}

.agent-fab:hover {
    transform: translateY(-2px);
}

.agent-fab svg {
    width: 100%;
    height: 100%;
    display: block;
}

.agent-fab.open {
    opacity: 0.55;
}

/* An author `display` beats the browser's own `[hidden] { display: none }`,
   so without this the panel below would stay on screen for ever - the
   close button set the attribute and nothing happened. */
.agent-panel[hidden],
.agent-fab[hidden] {
    display: none;
}

.agent-panel {
    position: fixed;
    right: 22px;
    bottom: 90px;
    z-index: 901;
    display: flex;
    flex-direction: column;
    width: 440px;
    max-width: calc(100vw - 44px);
    /* Tall enough for a few exchanges, never taller than the window. */
    height: 600px;
    max-height: calc(100vh - 130px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--a-surface-slate);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.ag-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    background: var(--a-surface-deep);
}

.ag-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary, #e5e7eb);
}

.ag-new {
    margin-left: auto;
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--a-surface);
    color: var(--a-txt-soft);
    font-size: 12px;
    cursor: pointer;
}

.ag-new:hover {
    color: var(--a-txt-hi);
    border-color: rgba(102, 126, 234, 0.6);
}

.ag-help {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.ag-help li {
    margin-bottom: 7px;
}

.ag-help b {
    color: var(--a-txt-strong);
    font-weight: 600;
}

.ag-notes {
    margin: 10px 0 0;
    padding: 8px 10px;
    border-left: 2px solid rgba(102, 126, 234, 0.5);
    background: rgba(102, 126, 234, 0.06);
    border-radius: 0 6px 6px 0;
    list-style: none;
    font-size: 12px;
}

.ag-notes li + li {
    margin-top: 4px;
}

.ag-ex-h {
    margin-top: 12px;
    font-weight: 600;
    color: var(--a-txt-soft);
    font-size: 12px;
}

.ag-close {
    border: none;
    background: transparent;
    color: var(--a-txt-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.ag-close:hover {
    color: var(--a-txt-hi);
}

.ag-log {
    flex: 1 1 auto;
    padding: 14px;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ag-intro {
    color: var(--a-txt-muted);
    font-size: 12.5px;
    line-height: 1.65;
}

.ag-intro-h {
    font-weight: 600;
    color: var(--a-txt-strong);
    font-size: 13.5px;
    margin-bottom: 6px;
}

.ag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.ag-chip {
    padding: 6px 11px;
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.12);
    color: var(--a-accent-txt);
    font-size: 12px;
    cursor: pointer;
    text-align: left;
}

.ag-chip:hover {
    background: rgba(102, 126, 234, 0.3);
    color: var(--a-txt-hi);
}

.ag-msg {
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* The question sits right, the answer left - the usual chat reading. */
.ag-q {
    align-self: flex-end;
    max-width: 85%;
    background: #667eea;
    color: var(--a-on-color);
}

.ag-range {
    display: block;
    margin-top: 3px;
    font-size: 10.5px;
    opacity: 0.75;
}

.ag-a {
    align-self: flex-start;
    max-width: 92%;
    background: var(--a-surface);
    color: var(--a-txt-strong);
}

.ag-err {
    align-self: flex-start;
    max-width: 92%;
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: var(--a-bad-txt);
}

.ag-dots {
    display: inline-flex;
    gap: 4px;
    padding: 2px 0;
}

.ag-dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--a-txt-muted);
    animation: ag-dot 1.1s ease-in-out infinite;
}

.ag-dots i:nth-child(2) {
    animation-delay: 0.18s;
}

.ag-dots i:nth-child(3) {
    animation-delay: 0.36s;
}

@keyframes ag-dot {

    0%,
    100% {
        opacity: 0.25;
    }

    50% {
        opacity: 1;
    }
}

.ag-facts {
    margin-top: 9px;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
    /* .ag-msg is pre-wrap so a multi-line answer keeps its shape. That
       would also turn this block's own markup indentation into blank
       lines, so the table opts back out. */
    white-space: normal;
}

.ag-facts summary {
    cursor: pointer;
    font-size: 11.5px;
    color: var(--a-txt-muted);
}

.ag-facts summary:hover {
    color: var(--a-accent-txt);
}

.ag-facts table {
    width: 100%;
    margin-top: 8px;
    border-collapse: collapse;
    font-size: 11.5px;
}

.ag-facts th {
    text-align: left;
    padding: 3px 8px 3px 0;
    color: var(--a-txt-muted);
    font-weight: 500;
    white-space: nowrap;
    vertical-align: top;
}

.ag-facts td {
    padding: 3px 0;
    color: var(--a-txt-soft);
}

.ag-facts-h {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--a-txt-muted);
}

.ag-facts-p {
    font-size: 11.5px;
    line-height: 1.55;
    color: var(--a-txt-soft);
}

/* Listed videos, under the answer and outside it: the answer bubble is
   pre-wrap escaped text and cannot hold a link. */
.ag-vids {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ag-vids li {
    font-size: 12px;
    line-height: 1.45;
    padding-left: 10px;
    border-left: 2px solid var(--a-border-mid);
}

.ag-vids a {
    color: var(--a-accent-txt-dim);
    text-decoration: none;
}

.ag-vids a:hover {
    text-decoration: underline;
}

.ag-vid-meta {
    display: block;
    font-size: 10.5px;
    color: var(--a-txt-faint);
    margin-top: 1px;
}

.ag-facts ul {
    margin: 4px 0 0;
    padding-left: 18px;
    font-size: 11.5px;
    color: var(--a-txt-soft);
}

.ag-foot {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: var(--a-surface-deep);
}

.ag-input {
    flex: 1 1 auto;
    min-width: 0;
    /* Two lines' worth; the browser scrolls beyond that. */
    max-height: 92px;
    padding: 9px 11px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: var(--a-surface);
    color: var(--a-txt-strong);
    font-family: inherit;
    font-size: 13px;
    resize: none;
}

.ag-input:focus {
    outline: none;
    border-color: var(--a-brand-txt);
}

.ag-send {
    flex: 0 0 auto;
    padding: 0 16px;
    border: none;
    border-radius: 9px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--a-on-color);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.ag-send:disabled {
    opacity: 0.5;
    cursor: default;
}

@media (max-width: 520px) {

    /* Nearly full screen - a 400px panel on a 375px phone would hang
       off the edge, and a chat needs the room anyway. */
    .agent-panel {
        right: 10px;
        left: 10px;
        bottom: 84px;
        width: auto;
        max-width: none;
        height: calc(100vh - 120px);
    }

    .agent-fab {
        right: 14px;
        bottom: 14px;
        width: 50px;
        height: 50px;
    }
}

/* Kömək düyməsi (başlıqda) */
.ag-help-btn {
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--a-surface);
    color: var(--a-txt-soft);
    font-size: 12px;
    cursor: pointer;
}

.ag-help-btn:hover,
.ag-help-btn.on {
    color: var(--a-txt-hi);
    border-color: rgba(102, 126, 234, 0.6);
}

/* Cavab yazılarkən: nə axtarıldığı */
.ag-status {
    color: var(--a-txt-muted);
    font-size: 12px;
    font-style: italic;
}

.ag-status:empty {
    display: none;
}

/* Uzun video siyahısı: ilk bir neçəsi, qalanı düymə ilə */
.ag-vids li.ag-hidden {
    display: none;
}

.ag-vids.ag-open li.ag-hidden {
    display: list-item;
}

.ag-more {
    margin-top: 4px;
    padding: 3px 10px;
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--a-accent-txt);
    font-size: 12px;
    cursor: pointer;
}

.ag-more:hover {
    background: rgba(102, 126, 234, 0.25);
}

/* Hesabat faylı - yükləmə düyməsi */
.ag-files {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.ag-file {
    text-align: left;
    padding: 7px 11px;
    border: 1px solid rgba(16, 185, 129, 0.45);
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--a-txt-hi);
    font-size: 12.5px;
    cursor: pointer;
}

.ag-file:hover {
    background: rgba(16, 185, 129, 0.22);
}

/* «Kömək» cavab baloncuğunun içindəki izah */
.ag-helpbox .ag-intro {
    color: inherit;
}

.ag-helpbox {
    white-space: normal;
}
