/* Custom scrollbar */
.sidebar-scroll::-webkit-scrollbar,
#chat-messages::-webkit-scrollbar {
    width: 4px;
}
.sidebar-scroll::-webkit-scrollbar-track,
#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-scroll::-webkit-scrollbar-thumb,
#chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover,
#chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Prose dark theme for markdown */
.prose-dark {
    color: #d1d5db;
    line-height: 1.75;
}
.prose-dark h1, .prose-dark h2, .prose-dark h3, .prose-dark h4 {
    color: #f3f4f6;
    font-weight: 600;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    scroll-margin-top: 80px;
}
.prose-dark h1 { font-size: 1.875rem; }
.prose-dark h2 { font-size: 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 0.3em; }
.prose-dark h3 { font-size: 1.25rem; }
.prose-dark h4 { font-size: 1.1rem; }
.prose-dark p { margin-bottom: 1em; }
.prose-dark a { color: #60a5fa; text-decoration: underline; text-underline-offset: 2px; }
.prose-dark a:hover { color: #93bbfd; }
.prose-dark strong { color: #f3f4f6; font-weight: 600; }
.prose-dark ul, .prose-dark ol { margin-bottom: 1em; padding-left: 1.5em; }
.prose-dark li { margin-bottom: 0.25em; }
.prose-dark ul { list-style-type: disc; }
.prose-dark ol { list-style-type: decimal; }
.prose-dark blockquote {
    border-left: 3px solid #3b82f6;
    padding: 0.5em 1em;
    margin: 1em 0;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 0 8px 8px 0;
    color: #9ca3af;
}
.prose-dark code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.875em;
    color: #f9a8d4;
}
.prose-dark pre {
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1em;
    overflow-x: auto;
    margin: 1em 0;
}
.prose-dark pre code {
    background: none;
    padding: 0;
    color: #d1d5db;
}
.prose-dark table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.875rem;
}
.prose-dark th {
    text-align: left;
    padding: 0.5em 0.75em;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
    font-weight: 600;
}
.prose-dark td {
    padding: 0.5em 0.75em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.prose-dark tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}
.prose-dark hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 2em 0;
}
.prose-dark img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1em 0;
}

/* Obsidian callouts → styled blockquotes */
.prose-dark blockquote p:first-child {
    font-weight: 500;
}
.prose-dark blockquote {
    position: relative;
}

/* Copy button wrapper for blockquotes */
.group\/quote {
    position: relative;
}
.group\/quote:hover > button {
    opacity: 1;
}
.group\/quote > button {
    opacity: 0;
}

/* Chat background — subtle mesh gradient */
.chat-bg {
    background: #0a0a0a;
    position: relative;
}
.chat-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(59, 130, 246, 0.04) 0%, transparent 70%),
        radial-gradient(ellipse 60% 60% at 80% 20%, rgba(139, 92, 246, 0.03) 0%, transparent 70%),
        radial-gradient(ellipse 50% 80% at 60% 80%, rgba(16, 185, 129, 0.025) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* Subtle grid pattern overlay */
.chat-grid-pattern {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.012) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
    mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 30%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 30%, transparent 100%);
}

/* Chat message markdown */
.chat-markdown {
    font-size: 0.875rem;
    line-height: 1.7;
    color: #e5e7eb;
}
.chat-markdown p { margin-bottom: 0.6em; }
.chat-markdown p:last-child { margin-bottom: 0; }
.chat-markdown ul, .chat-markdown ol { margin-bottom: 0.6em; padding-left: 1.25em; }
.chat-markdown li { margin-bottom: 0.15em; }
.chat-markdown pre { font-size: 0.8rem; }
.chat-markdown strong { color: #f9fafb; }
.chat-markdown h3, .chat-markdown h4 { font-size: 0.9rem; margin-top: 1em; }
.chat-markdown table { font-size: 0.8rem; }
.chat-markdown table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.chat-markdown blockquote {
    border-left-width: 2px;
    font-size: 0.8rem;
    padding: 0.4em 0.8em;
    margin: 0.5em 0;
}

/* User message bubble gradient */
.user-bubble {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* Assistant message container */
.assistant-msg {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    border-top-left-radius: 4px;
    padding: 12px 16px;
}

/* Typing indicator shimmer */
@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}
.typing-shimmer {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Safe area padding for iOS */
.pb-safe {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Quick action cards hover */
.quick-action {
    backdrop-filter: blur(8px);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fadeIn 0.2s ease-out; }

@keyframes pulse-dot {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}
.typing-dot { animation: pulse-dot 1.4s infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* Toast */
.toast {
    animation: fadeIn 0.2s ease-out;
    transition: opacity 0.3s;
}

/* Line clamp */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mobile bottom nav spacing */
@media (max-width: 1023px) {
    main { padding-bottom: 3.5rem !important; }
}

/* Textarea auto-resize */
#chat-input {
    field-sizing: content;
}
