:root {
    --bg-dark: #121212;
    --bg-sidebar: #1a1a1a;
    --bg-surface: #242424;
    --bg-bubble-ai: #242424;
    --bg-bubble-user: #007aff;
    --text-primary: #f5f5f7;
    --text-muted: #86868b;
    --border-color: #333336;
    --primary-color: #007aff;
    --primary-hover: #006add;
    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "SF Mono", Menlo, Monaco, Consolas, "JetBrains Mono", monospace;
}

body.dark-theme {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
    margin: 0;
}

.app-container {
    height: 100vh;
}

.history-item:hover .btn-delete-history {
    opacity: 1;
}

.btn-delete-history {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    opacity: 0.6;
    transition: all 0.2s;

    padding: 4px 8px;
    z-index: 5;
}

.btn-delete-history:hover {
    color: #ef4444;
}

/* Sidebar Footer */
.sidebar-footer {
    background-color: var(--bg-sidebar);
}

/* Sidebar Styling */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
}

.brand-title {
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.version-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    border-radius: 12px;
    display: inline-block;
    font-family: var(--font-mono);
}

.btn-new-chat {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: all 0.2s;
    font-family: var(--font-sans);
    font-weight: 500;
}

.btn-new-chat:hover {
    background-color: var(--bg-surface);
    border-color: var(--text-muted);
}

.nav-pills .nav-link {
    color: var(--text-muted);
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 5px;
    transition: all 0.2s;
}

.nav-pills .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-pills .nav-link.active {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--primary-color);
}

.avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
}

/* Main Chat Area */
.chat-main {
    background-color: var(--bg-dark);
    position: relative;
}

.chat-header {
    background-color: rgba(15, 17, 21, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: pulse 2s infinite;
}

.pulse-dot.bg-success {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: pulse-green 2s infinite;
}

.pulse-dot.bg-danger {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: pulse-red 2s infinite;
}

.pulse-dot.bg-secondary {
    box-shadow: 0 0 0 0 rgba(148, 163, 184, 0.7);
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}


/* Chat Bubbles */
.chat-window {
    scroll-behavior: smooth;
}

.chat-window::-webkit-scrollbar {
    width: 6px;
}

.chat-window::-webkit-scrollbar-track {
    background: transparent;
}

.chat-window::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.chat-window::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.message-bubble {
    max-width: 85%;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.6;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ai-message .message-bubble {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .avatar-container {
    margin-right: 0 !important;
    margin-left: 1rem;
}

.user-message .message-bubble {
    background-color: var(--primary-color);
    color: white;
}

/* Input Area */
.chat-input-area {
    background: linear-gradient(to top, var(--bg-dark) 80%, transparent);
}

.bg-dark-eval {
    background-color: var(--bg-surface);
}

#inputWrapper {
    transition: all 0.3s ease;
}

#inputWrapper:focus-within {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.resize-none {
    resize: none;
    font-family: var(--font-mono);
}

textarea#messageInput::placeholder {
    color: #64748b;
}

textarea#messageInput:focus {
    box-shadow: none;
    color: white;
}

.btn-send {
    transition: transform 0.2s, background-color 0.2s;
}

.btn-send:hover {
    transform: scale(1.05);
    background-color: var(--primary-hover);
}

.btn-send:active {
    transform: scale(0.95);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 24px;
}

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

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Markdown parsing wrappers */
.message-bubble pre {
    background-color: #0b0c0f;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    overflow-x: auto;
    border: 1px solid #1e293b;
}

.message-bubble code {
    font-family: var(--font-mono);
    color: #38bdf8;
    background-color: rgba(15, 23, 42, 0.5);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

.message-bubble pre code {
    color: #e2e8f0;
    background-color: transparent;
    padding: 0;
}

.message-bubble p {
    margin-bottom: 0.5rem;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

/* Login Overlay */
.login-mode .app-container {
    filter: blur(10px);
    pointer-events: none;
}

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: rgba(15, 17, 21, 0.8);
    backdrop-filter: blur(8px);
}

.login-card {
    background-color: var(--bg-sidebar);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.8s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.login-card input:focus {
    background-color: var(--bg-surface);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}