* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #090B10 0%, #17102B 100%);
    color: #E2E8F0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.app-container {
    display: flex;
    gap: 1.5rem;
    width: 100%;
    max-width: 1300px;
    height: 90vh;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Sidebar styling */
.sidebar {
    width: 350px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

.sidebar h2 {
    font-size: 1.2rem;
    color: #A78BFA;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 600;
}

.control-group {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.control-group h3 {
    font-size: 0.9rem;
    color: #94A3B8;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 0.5rem;
}

label { font-size: 0.8rem; color: #CBD5E1; font-weight: 500;}

input[type="text"], select, textarea, input[type="file"] {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    color: white;
    padding: 0.5rem;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}
input[type="file"] { padding: 0.2rem; color: #94A3B8; font-size: 0.8rem; }
input[type="text"]:focus, select:focus, textarea:focus { border-color: #8B5CF6; }

.input-row { display: flex; gap: 0.5rem; }

.primary-btn {
    background: linear-gradient(90deg, #8B5CF6 0%, #6D28D9 100%);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    margin-top: 5px;
}
.primary-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}
.pulse-hover:hover {
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.icon-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    padding: 0 0.8rem;
    transition: background 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.2); }

.status-log {
    font-size: 0.75rem;
    font-family: monospace;
    min-height: 20px;
    margin-top: 5px;
}
.status-success { color: #34D399; }
.status-error { color: #F87171; }

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header h2 { font-size: 1.1rem; font-weight: 500; }

.online-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #94A3B8;
}
.dot {
    width: 8px;
    height: 8px;
    background: #10B981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10B981;
}

.chat-history {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    opacity: 0;
    animation: fadeIn 0.3s forwards ease-in-out;
}
@keyframes fadeIn { to { opacity: 1; transform: translateY(0); } from { opacity: 0; transform: translateY(10px); } }

.user-msg { justify-content: flex-end; }
.system-msg { justify-content: flex-start; }

.bubble {
    max-width: 75%;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 0.95rem;
}
.user-msg .bubble {
    background: #3B82F6;
    color: white;
    border-bottom-right-radius: 2px;
}
.system-msg .bubble {
    background: rgba(255, 255, 255, 0.08);
    color: #E2E8F0;
    border-bottom-left-radius: 2px;
}

.loading-msg .bubble {
    background: transparent;
    color: #A78BFA;
    font-style: italic;
    padding: 0.5rem;
}

.chat-input-area {
    padding: 1.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 0.8rem;
}
.chat-input-area input {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    color: white;
    transition: all 0.2s ease;
}
.chat-input-area input:focus {
    background: rgba(0,0,0,0.5);
    border-color: #8B5CF6;
    outline: none;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}
.chat-input-area button {
    border-radius: 24px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Streaming cursor animation */
.bubble.streaming::after {
    content: '▍';
    animation: blink 0.7s infinite;
    color: #A78BFA;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Preserve whitespace & line breaks from LLM responses */
.system-msg .bubble {
    white-space: pre-wrap;
    word-break: break-word;
}
