/* Premium Modern CSS for Online Feynman Simulator */

:root {
    /* Color Palette - Solarized Light Mode */
    --bg-main: #fdf6e3;                /* Base3 */
    --bg-sidebar: #eee8d5;             /* Base2 */
    --bg-panel: #eee8d5;               /* Base2 */
    --bg-card: rgba(238, 232, 213, 0.85); /* Base2 transparency */
    --border-color: rgba(147, 161, 161, 0.25); /* Base1 transparency */
    --text-main: #586e75;              /* Base00/01 */
    --text-muted: #93a1a1;             /* Base1 */
    --text-inverse: #fdf6e3;           /* Base3 */
    --bg-input: #fdf6e3;               /* Base3 */
    --bg-bubble-ai: #eee8d5;           /* Base2 */
    --bg-bubble-user: linear-gradient(135deg, #268bd2 0%, #2aa198 100%); /* Blue to Cyan */
    --text-bubble-user: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 8px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 30px -3px rgba(38, 139, 210, 0.08), 0 4px 12px -2px rgba(38, 139, 210, 0.04);
    --accent-primary: #268bd2;         /* Solarized Blue */
    --accent-hover: #1b639e;
    --accent-light: rgba(38, 139, 210, 0.15);
    --preset-bg: #fdf6e3;              /* Base3 */
    --preset-hover: #eae3d0;
}

.dark {
    /* Color Palette - Solarized Dark Mode */
    --bg-main: #002b36;                /* Base03 */
    --bg-sidebar: #073642;             /* Base02 */
    --bg-panel: #073642;               /* Base02 */
    --bg-card: rgba(7, 54, 66, 0.85);  /* Base02 transparency */
    --border-color: rgba(88, 110, 117, 0.35); /* Base01 transparency — increased for visibility */
    --text-main: #93a1a1;              /* Base1 — higher contrast for readability */
    --text-muted: #657b83;             /* Base00 — visible but subdued */
    --text-inverse: #002b36;           /* Base03 */
    --bg-input: #002b36;               /* Base03 */
    --bg-bubble-ai: rgba(7, 54, 66, 0.6); /* Base02 */
    --bg-bubble-user: linear-gradient(135deg, #268bd2 0%, #2aa198 100%); /* Blue to Cyan */
    --text-bubble-user: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 20px -2px rgba(0, 0, 0, 0.3), 0 2px 8px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 30px -3px rgba(38, 139, 210, 0.15), 0 4px 12px -2px rgba(38, 139, 210, 0.05);
    --accent-primary: #268bd2;         /* Solarized Blue */
    --accent-hover: #1b639e;
    --accent-light: rgba(38, 139, 210, 0.15);
    --preset-bg: #073642;              /* Base02 */
    --preset-hover: #002b36;           /* Base03 */
}

/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.font-outfit {
    font-family: 'Outfit', sans-serif;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Header Styles */
header {
    background-color: var(--bg-sidebar);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Main Area */
main {
    background-color: var(--bg-main) !important;
}

/* Welcome Card */
.welcome-card {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.preset-btn {
    background-color: var(--preset-bg) !important;
    border-color: var(--border-color) !important;
    color: var(--text-main) !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.preset-btn:hover {
    background-color: var(--preset-hover) !important;
    border-color: var(--accent-primary) !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Chat Input Footer */
footer {
    background-color: var(--bg-sidebar) !important;
    border-color: var(--border-color) !important;
}

#chat-form {
    background-color: var(--bg-input) !important;
    border-color: var(--border-color) !important;
}

#chat-form:focus-within {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px var(--accent-light) !important;
}

/* Chat Messages Bubble System */
.chat-bubble-container {
    display: flex;
    gap: 12px;
    max-width: 80%;
    align-self: flex-start;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.chat-bubble-container.user {
    align-self: flex-end;
    flex-direction: row-reverse; /* Corrected alignment */
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.chat-bubble-container:hover .avatar {
    transform: scale(1.05);
}

.avatar.ai {
    background-color: var(--accent-light);
    color: var(--accent-primary);
}

.avatar.user {
    background-color: var(--border-color);
    color: var(--text-muted);
}

.bubble {
    border-radius: 16px;
    padding: 12px 16px;
    font-size: 13.5px;
    line-height: 1.6;
    word-break: break-word;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease;
}

.chat-bubble-container.ai .bubble {
    background: var(--bg-bubble-ai);
    color: var(--text-main);
    border-top-left-radius: 4px;
}

.chat-bubble-container.user .bubble {
    background: var(--bg-bubble-user);
    color: var(--text-bubble-user);
    border-top-right-radius: 4px;
    border: none;
}

/* Markdown styling inside bubbles */
.bubble p {
    margin-bottom: 8px;
}
.bubble p:last-child {
    margin-bottom: 0;
}
.bubble strong {
    font-weight: 700;
}
.chat-bubble-container.ai .bubble strong {
    color: var(--accent-primary);
}
.chat-bubble-container.user .bubble strong {
    color: #ffffff;
}
.bubble code {
    font-family: SFMono-Regular, Consolas, Monaco, monospace;
    font-size: 11px;
    background-color: rgba(99, 102, 241, 0.08);
    padding: 2px 5px;
    border-radius: 4px;
    border: 1px solid rgba(99, 102, 241, 0.15);
    color: var(--accent-primary);
}
.chat-bubble-container.user .bubble code {
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
}
.bubble pre {
    background-color: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
    margin: 8px 0;
}
.light .bubble pre {
    background-color: #f1f5f9;
    border-color: #e2e8f0;
}
.bubble pre code {
    background-color: transparent !important;
    border: none !important;
    color: #f8fafc;
    padding: 0;
    font-size: 11.5px;
}
.light .bubble pre code {
    color: #0f172a;
}
.bubble ul, .bubble ol {
    margin-left: 20px;
    margin-bottom: 8px;
    list-style-position: outside;
}
.bubble ul {
    list-style-type: disc; /* Restore bullets */
}
.bubble ol {
    list-style-type: decimal; /* Restore decimal numbers */
}
.bubble li {
    margin-bottom: 3px;
}
.bubble blockquote {
    border-left: 4px solid var(--accent-primary);
    padding-left: 12px;
    color: var(--text-muted);
    margin: 8px 0;
}

/* Floating Actions Buttons styling */
#trigger-test-btn {
    border-color: rgba(99, 102, 241, 0.2);
}

#reset-btn, .btn-header-secondary {
    background-color: var(--bg-main) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    transition: all 0.2s ease;
}
#reset-btn:hover, .btn-header-secondary:hover {
    background-color: var(--bg-sidebar) !important;
    border-color: var(--accent-primary) !important;
    color: var(--accent-primary) !important;
}

/* Typewriter & Loading animations */
.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 18px;
    padding: 0 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Typography styles */
.text-2xs { font-size: 0.75rem; }
.text-3xs { font-size: 0.65rem; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .chat-bubble-container {
        max-width: 90%;
    }
}
