/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* Textarea auto-height */
textarea { field-sizing: content; }

/* Typing dots */
.typing-dot { animation: bounceDot 1.4s infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounceDot {
    0%, 60%, 100% { opacity: 0.3; transform: scale(1); }
    30% { opacity: 1; transform: scale(1.3); }
}

/* ── LEXi icon glass effect ── */
.lexi-icon-glass {
    position: relative;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(13, 115, 119, 0.12) 100%);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-bottom-color: rgba(13, 115, 119, 0.18);
    border-right-color: rgba(13, 115, 119, 0.18);
    box-shadow:
        0 1px 3px rgba(13, 115, 119, 0.12),
        0 4px 12px rgba(13, 115, 119, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        inset 0 -1px 0 rgba(13, 115, 119, 0.06);
    backdrop-filter: blur(12px) saturate(1.4);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    color: #0B6164;
    overflow: hidden;
}

/* Static specular highlight */
.lexi-icon-glass::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        120deg,
        rgba(255, 255, 255, 0.45) 0%,
        rgba(255, 255, 255, 0) 40%
    );
    border-radius: inherit;
    pointer-events: none;
}

/* Animated light sweep */
.lexi-icon-glass::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -75%;
    width: 50%;
    height: 200%;
    background: linear-gradient(
        105deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0) 35%,
        rgba(255, 255, 255, 0.5) 45%,
        rgba(255, 255, 255, 0.65) 50%,
        rgba(255, 255, 255, 0.5) 55%,
        rgba(255, 255, 255, 0) 65%,
        rgba(255, 255, 255, 0) 100%
    );
    border-radius: inherit;
    pointer-events: none;
    animation: glassSheen 3s ease-in-out infinite;
}

@keyframes glassSheen {
    0%   { transform: translateX(0); opacity: 0; }
    15%  { opacity: 1; }
    50%  { transform: translateX(350%); opacity: 1; }
    65%  { opacity: 0; }
    100% { transform: translateX(350%); opacity: 0; }
}

/* ── Markdown prose inside assistant messages ── */
.prose-chat h1 { font-size: 1.25rem; font-weight: 700; margin: 1rem 0 0.5rem; }
.prose-chat h2 { font-size: 1.1rem; font-weight: 700; margin: 0.875rem 0 0.375rem; }
.prose-chat h3 { font-size: 0.95rem; font-weight: 600; margin: 0.75rem 0 0.25rem; color: #374151; }

.prose-chat p { margin-bottom: 0.5rem; line-height: 1.75; }
.prose-chat p:last-child { margin-bottom: 0; }

.prose-chat ul, .prose-chat ol { padding-left: 1.25rem; margin-bottom: 0.5rem; }
.prose-chat li { margin-bottom: 0.25rem; line-height: 1.7; }

.prose-chat strong { font-weight: 600; color: #111827; }
.prose-chat em { font-style: italic; color: #4B5563; }

.prose-chat a {
    color: #0D7377;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.prose-chat code:not(pre code) {
    background: #F3F4F6;
    color: #0F4F53;
    padding: 0.15em 0.4em;
    border-radius: 0.3rem;
    font-size: 0.85em;
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
    font-weight: 500;
}

.prose-chat pre {
    background: #1a1b26;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin: 0.75rem 0;
    overflow-x: auto;
    border: 1px solid rgba(255,255,255,0.06);
}

.prose-chat pre code {
    background: none !important;
    color: #c0caf5;
    padding: 0 !important;
    font-size: 0.8rem;
    line-height: 1.6;
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
}

.prose-chat table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.8rem;
}

.prose-chat thead th {
    background: #F9FAFB;
    font-weight: 600;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border: 1px solid #E5E7EB;
    color: #374151;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.prose-chat tbody td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #E5E7EB;
    color: #4B5563;
}

.prose-chat tbody tr:hover td { background: #F9FAFB; }

.prose-chat blockquote {
    border-left: 3px solid #0D7377;
    padding-left: 0.875rem;
    color: #6B7280;
    margin: 0.75rem 0;
    font-style: italic;
}

.prose-chat hr {
    border: none;
    border-top: 1px solid #E5E7EB;
    margin: 1rem 0;
}

/* ── Copy button on code blocks ── */
.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #9CA3AF;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    line-height: 1.5;
}
.copy-btn:hover {
    color: #E5E7EB;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}
.copy-btn.copied {
    color: #34D399;
    border-color: rgba(52, 211, 153, 0.3);
    background: rgba(52, 211, 153, 0.1);
}

/* ── Send button active glow ── */
#sendBtn:not(:disabled) {
    box-shadow: 0 4px 12px rgba(13, 115, 119, 0.35);
}
#sendBtn:not(:disabled):hover {
    box-shadow: 0 6px 16px rgba(13, 115, 119, 0.45);
}

/* ── Debug panel ── */
.debug-panel {
    background: #111827;
    border-bottom: 1px solid #374151;
    max-height: 45vh;
    display: flex;
    flex-direction: column;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}
.debug-panel.hidden {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    border-bottom: none;
}
.debug-content {
    flex: 1;
    min-height: 0;
    max-height: 40vh;
}

.debug-step {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    padding: 0.375rem 0;
    border-bottom: 1px solid rgba(55, 65, 81, 0.4);
}
.debug-step:last-child { border-bottom: none; }

.debug-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}
.debug-badge.user    { background: #1e3a5f; color: #60a5fa; }
.debug-badge.tool    { background: #14532d; color: #4ade80; }
.debug-badge.response { background: #134044; color: #44C7CE; }
.debug-badge.error   { background: #450a0a; color: #f87171; }

.debug-duration {
    font-size: 0.6rem;
    color: #6b7280;
    white-space: nowrap;
    flex-shrink: 0;
}

.debug-detail {
    color: #9ca3af;
    word-break: break-word;
    flex: 1;
    min-width: 0;
}
.debug-detail-toggle {
    color: #6b7280;
    cursor: pointer;
    font-size: 0.625rem;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.debug-detail-toggle:hover { color: #9ca3af; }
.debug-detail-body {
    display: none;
    margin-top: 0.25rem;
    padding: 0.375rem 0.5rem;
    background: rgba(0,0,0,0.25);
    border-radius: 0.375rem;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    color: #d1d5db;
}
.debug-detail-body.open { display: block; }

#debugToggleBtn.active {
    border-color: #f59e0b;
    color: #f59e0b;
    background: #fffbeb;
}

/* ── Quick-prompt rotation fade ── */
#quickPrompts {
    transition: opacity 0.45s ease, transform 0.45s ease;
    opacity: 1;
    transform: translateY(0);
}
#quickPrompts.prompts-fade-out {
    opacity: 0;
    transform: translateY(8px);
}
#quickPrompts.prompts-fade-in {
    opacity: 0;
    transform: translateY(-8px);
}
#quickPrompts.prompts-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Responsive adjustments ── */
@media (max-width: 640px) {
    .user-bubble-wrap {
        max-width: 85% !important;
    }
}
