:root {
    --bg-dark: #0b0f19;
    --surface: #111827;
    --surface-hover: #1f2937;
    --border: rgba(255, 255, 255, 0.08);
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.25);
    --text: #f3f4f6;
    --text-muted: #9ca3af;
    --accent-green: #10b981;
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 290px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.brand-title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.badge-qlora {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
}

.btn-primary-ghost {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary-ghost:hover {
    background: var(--surface-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.settings-group textarea {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 8px 10px;
    font-size: 0.82rem;
    resize: vertical;
    font-family: inherit;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

input[type="range"] {
    accent-color: var(--primary);
    cursor: pointer;
}

.sidebar-footer {
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.status-dot.green {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

/* Chat Main Area */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
}

.chat-header {
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(8px);
}

.chat-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
}

.chat-header .subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-icon:hover {
    color: var(--text);
    background: var(--surface-hover);
}

/* Messages */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.welcome-card {
    margin: auto;
    max-width: 580px;
    text-align: center;
    padding: 36px 24px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.welcome-icon {
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.welcome-card h3 {
    font-size: 1.35rem;
    margin-bottom: 8px;
}

.welcome-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.prompt-chips {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chip {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 8px;
    text-align: left;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.message-row {
    display: flex;
    gap: 14px;
    max-width: 820px;
    width: 100%;
}

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

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.message-row.user .avatar {
    background: #4f46e5;
    color: white;
}

.message-row.assistant .avatar {
    background: #059669;
    color: white;
}

.bubble {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 0.93rem;
    line-height: 1.6;
}

.message-row.user .bubble {
    background: #4338ca;
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.message-row.assistant .bubble {
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-left-radius: 2px;
}

.bubble pre {
    margin: 10px 0;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
}

.typing-cursor {
    display: inline-block;
    width: 6px;
    height: 15px;
    background: var(--primary);
    margin-left: 4px;
    animation: blink 0.9s infinite;
    vertical-align: middle;
}

@keyframes blink {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}

/* Input Form */
.input-container {
    padding: 18px 28px 24px;
    background: var(--bg-dark);
}

.input-form {
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 12px;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.input-form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.input-form textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    max-height: 150px;
    padding: 6px 4px;
}

.btn-send {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.btn-send:hover {
    opacity: 0.9;
}

.btn-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.brand-link {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}

.brand-link:hover {
    opacity: 0.85;
}

.badge-optional {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

.token-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 8px 12px;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.token-input:focus {
    border-color: var(--primary);
}

.token-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}