/* AskInteq AI — chat page styles. Global (not scoped) to match project convention. */

/* ── Layout grid (sidebar + main) ── */
.atc-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    height: calc(100vh - 80px - var(--activity-top-height, 0px));
}

/* ── Sidebar ── */
.atc-sidebar { background:#f9f9f9; border-right:1px solid #e0e0e0; display:flex; flex-direction:column; overflow:hidden; transition:width .2s ease; }
.atc-sidebar-open { width:260px; }
.atc-sidebar-collapsed { width:48px; }
.atc-sidebar-header { display:flex; align-items:center; justify-content:space-between; padding:.5rem; border-bottom:1px solid #e8e8e8; flex-shrink:0; gap:.25rem; }
.atc-session-list { flex:1; overflow-y:auto; padding:.25rem 0; }
.atc-session-group-label { font-size:.68rem; font-weight:600; color:#999; text-transform:uppercase; padding:.5rem .75rem .25rem; letter-spacing:.03em; }
.atc-session-item { display:flex; align-items:center; justify-content:space-between; padding:.45rem .75rem; cursor:pointer; border-radius:6px; margin:1px .35rem; transition:background .1s; }
.atc-session-item:hover { background:#eee; }
.atc-session-active { background:#e4e4e4; }
.atc-session-active:hover { background:#ddd; }
.atc-session-title { font-size:.8rem; color:#333; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex:1; min-width:0; }
.atc-session-actions { display:none; gap:.2rem; flex-shrink:0; margin-left:.25rem; }
.atc-session-item:hover .atc-session-actions { display:flex; }
.atc-session-action-btn { color:#999; cursor:pointer; padding:.15rem .25rem; font-size:.7rem; border-radius:3px; transition:all .1s; }
.atc-session-action-btn:hover { color:#333; background:#ddd; }
.atc-session-delete:hover { color:#c33; background:#fee; }
.atc-session-empty { padding:1.5rem .75rem; text-align:center; font-size:.75rem; color:#999; }
.atc-rename-wrapper { display:flex; align-items:center; gap:.25rem; padding:.25rem .5rem; margin:1px .35rem; }
.atc-rename-input { border:1px solid #999; border-radius:4px; padding:.3rem .5rem; font-size:.8rem; flex:1; min-width:0; outline:none; }
.atc-rename-input:focus { border-color:#555; }
.atc-loading-overlay { display:flex; align-items:center; justify-content:center; height:100%; color:#999; font-size:.85rem; }

/* ── Feedback ── */
.atc-feedback { display:flex; align-items:center; gap:.35rem; margin-top:.4rem; padding-top:.3rem; }
.atc-feedback-btn { cursor:pointer; color:#bbb; font-size:.75rem; padding:.15rem .3rem; border-radius:3px; transition:color .15s; }
.atc-feedback-btn:hover { color:#555; }
.atc-feedback-form { display:flex; align-items:center; gap:.3rem; }
.atc-feedback-input { border:1px solid #ddd; border-radius:4px; padding:.2rem .4rem; font-size:.72rem; width:220px; outline:none; }
.atc-feedback-input:focus { border-color:#999; }
.atc-feedback-submit { color:#28a745; }
.atc-feedback-thanks { font-size:.7rem; color:#999; display:flex; align-items:center; gap:.3rem; }
.atc-feedback-selected { color:#555; }

@media (max-width: 768px) {
    .atc-sidebar-open { position:absolute; z-index:100; height:calc(100vh - 80px); box-shadow:2px 0 8px rgba(0,0,0,.1); }
}

.atc-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding: 0 1rem;
}

/* ── Header ── */
.atc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.atc-header-left {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.atc-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--inteq-text-primary, #1a1a1a);
}

.atc-subtitle {
    font-size: 0.8rem;
    color: var(--inteq-text-secondary, #666);
}

/* ── Chat area ── */
.atc-chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

/* ── Empty state ── */
.atc-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 0.75rem;
    color: #666;
    text-align: center;
}

.atc-empty-icon {
    color: #ccc;
    margin-bottom: 0.5rem;
}

.atc-empty-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.atc-empty-subtitle {
    font-size: 0.85rem;
    margin: 0;
}

.atc-example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    justify-content: center;
    max-width: 600px;
}

.atc-chip {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    color: #333;
    font-family: inherit;
}

.atc-chip:hover:not([disabled]) {
    background: var(--inteq-yellow-light, #fef9e7);
    border-color: var(--inteq-yellow, #f2c200);
}

.atc-chip[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Messages ── */
.atc-message {
    display: flex;
    margin-bottom: 0.75rem;
    padding: 0 0.25rem;
}

.atc-message-user {
    justify-content: flex-end;
}

.atc-message-assistant {
    justify-content: flex-start;
}

.atc-bubble {
    max-width: 85%;
    border-radius: 12px;
    padding: 0.65rem 0.85rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.atc-bubble-user {
    background: #000;
    color: #fff;
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}

.atc-bubble-assistant {
    background: #f8f8f8;
    border: 1px solid #e8e8e8;
    color: var(--inteq-text-primary, #1a1a1a);
    border-bottom-left-radius: 4px;
}

/* ── Markdown rendering inside assistant bubbles ── */
.atc-markdown-body {
    overflow-x: auto;
}

.atc-markdown-body pre {
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 6px;
    padding: 0.75rem;
    overflow-x: auto;
    font-size: 0.8rem;
    margin: 0.5rem 0;
}

.atc-markdown-body code {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.82rem;
}

.atc-markdown-body :not(pre) > code {
    background: #eee;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    font-size: 0.82rem;
}

.atc-markdown-body p {
    margin: 0.35rem 0;
}

.atc-markdown-body h1,
.atc-markdown-body h2,
.atc-markdown-body h3 {
    margin: 0.6rem 0 0.3rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.atc-markdown-body ul,
.atc-markdown-body ol {
    margin: 0.25rem 0;
    padding-left: 1.25rem;
}

.atc-markdown-body a {
    color: var(--inteq-yellow-dark, #b8960a);
    text-decoration: none;
}

.atc-markdown-body a:hover {
    text-decoration: underline;
}

/* ── Typing indicator ── */
.atc-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.25rem 0;
}

.atc-typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #999;
    animation: atc-bounce 1.2s infinite;
}

.atc-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.atc-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes atc-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ── Error ── */
.atc-error {
    background: #fff5f5;
    border: 1px solid #fcc;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
    font-size: 0.8rem;
    color: var(--inteq-status-red, #c33);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Input area ── */
.atc-input-area {
    flex-shrink: 0;
    border-top: 1px solid #e0e0e0;
    padding: 0.75rem 0 0.25rem;
}

.atc-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.atc-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.55rem 0.8rem;
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.15s;
    min-height: 44px;
}

.atc-input:focus {
    border-color: var(--inteq-yellow, #f2c200);
}

.atc-input:disabled {
    background: #f8f8f8;
    color: #999;
}

.atc-input-hint {
    font-size: 0.7rem;
    color: #999;
    margin-top: 0.25rem;
    text-align: right;
}

/* ── Brand the Send button (override Telerik default primary pink) ── */
.atc-send-btn,
.atc-send-btn.k-button-solid-base,
.atc-send-btn.k-button-solid-primary {
    background: var(--inteq-yellow, #f2c200) !important;
    border-color: var(--inteq-yellow, #f2c200) !important;
    color: var(--inteq-black, #1a1a1a) !important;
    font-weight: 600;
    padding: 0.55rem 1rem !important;
}

.atc-send-btn:hover:not(:disabled),
.atc-send-btn.k-button-solid-base:hover:not(:disabled) {
    background: var(--inteq-yellow-dark, #b8960a) !important;
    border-color: var(--inteq-yellow-dark, #b8960a) !important;
}

.atc-send-btn:disabled,
.atc-send-btn.k-button-solid-base:disabled {
    background: #e0e0e0 !important;
    border-color: #e0e0e0 !important;
    color: #999 !important;
}

/* ── Export dialog ── */
.atc-export-list { display:flex; flex-direction:column; gap:.4rem; max-height:400px; overflow-y:auto; }
.atc-export-item { display:flex; align-items:flex-start; gap:.5rem; padding:.4rem .5rem; border:1px solid #eee; border-radius:4px; cursor:pointer; font-size:.82rem; }
.atc-export-item:hover { background:#f8f8f8; }
.atc-export-item input[type="checkbox"] { margin-top:2px; flex-shrink:0; }
.atc-export-question { line-height:1.4; color:#333; }
.atc-export-actions { display:flex; justify-content:flex-end; gap:.5rem; margin-top:1rem; padding-top:.75rem; border-top:1px solid #eee; }
