/* ============================================
   Emylia - Custom Styles
   Extends Tailwind with animations, prose, 
   and component-specific styles.
   ============================================ */

/* Custom Scrollbar */
#scroll-area::-webkit-scrollbar {
    width: 6px;
}

#scroll-area::-webkit-scrollbar-track {
    background: transparent;
}

#scroll-area::-webkit-scrollbar-thumb {
    background: oklch(0.85 0 0);
    border-radius: 3px;
}

#scroll-area::-webkit-scrollbar-thumb:hover {
    background: oklch(0.75 0 0);
}

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

/* Prose overrides for markdown content in model messages */
.msg-prose {
    line-height: 1.7;
}

.msg-prose h1,
.msg-prose h2,
.msg-prose h3,
.msg-prose h4 {
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-top: 1.25em;
    margin-bottom: 0.5em;
}

.msg-prose h1 { font-size: 1.5em; }
.msg-prose h2 { font-size: 1.25em; }
.msg-prose h3 { font-size: 1.1em; }

.msg-prose p {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    line-height: 1.65;
}

.msg-prose a {
    color: #665df0;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity 0.15s;
}

.msg-prose a:hover {
    opacity: 0.8;
}

.msg-prose code {
    background: oklch(0.97 0 0);
    padding: 0.15em 0.35em;
    border-radius: 0.25em;
    font-size: 0.88em;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.msg-prose pre {
    background: oklch(0.97 0 0);
    border: 1px solid oklch(0.922 0 0);
    border-radius: 0.5em;
    padding: 0.875em 1em;
    overflow-x: auto;
    margin: 0.75em 0;
}

.msg-prose pre code {
    background: none;
    padding: 0;
    font-size: 0.85em;
}

.msg-prose ul,
.msg-prose ol {
    padding-left: 1.5em;
    margin: 0.5em 0;
}

.msg-prose li {
    margin: 0.25em 0;
    line-height: 1.6;
}

.msg-prose ul li {
    list-style-type: disc;
}

.msg-prose ol li {
    list-style-type: decimal;
}

.msg-prose blockquote {
    border-left: 3px solid oklch(0.85 0 0);
    padding-left: 1em;
    margin: 0.75em 0;
    color: oklch(0.45 0 0);
    font-style: italic;
}

.msg-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75em 0;
    font-size: 0.9em;
}

.msg-prose th,
.msg-prose td {
    border: 1px solid oklch(0.922 0 0);
    padding: 0.5em 0.75em;
    text-align: left;
}

.msg-prose th {
    background: oklch(0.97 0 0);
    font-weight: 600;
}

.msg-prose hr {
    border: none;
    border-top: 1px solid oklch(0.922 0 0);
    margin: 1em 0;
}

.msg-prose img {
    max-width: 100%;
    border-radius: 0.5em;
    margin: 0.5em 0;
}

/* Loader spin animation for thinking indicator */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner {
    animation: spin 1s linear infinite;
}

/* Smooth transition for messages appearing */
.msg-enter {
    animation: fade-in 0.3s ease-out forwards;
}

@keyframes fade-in {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus styles */
*:focus-visible {
    outline: 2px solid oklch(0.708 0 0);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
    .msg-prose h1 { font-size: 1.3em; }
    .msg-prose h2 { font-size: 1.15em; }
    .msg-prose pre {
        font-size: 0.8em;
        padding: 0.625em 0.75em;
    }
}
