:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-kimi: #0066cc;
    --accent-minimax: #22c55e;
    --accent-gradient: linear-gradient(135deg, #0066cc, #8b5cf6);
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn-new-chat {
    width: 100%;
    padding: 12px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s;
}

.btn-new-chat:hover {
    opacity: 0.9;
}

.btn-new-chat span {
    font-size: 20px;
}

.chat-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
}

.chat-item {
    padding: 12px 15px;
    margin-bottom: 5px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-item:hover {
    background: var(--glass);
}

.chat-item.active {
    background: var(--glass);
    border: 1px solid var(--glass-border);
}

.chat-item-icon {
    font-size: 18px;
}

.chat-item-info {
    flex-grow: 1;
    overflow: hidden;
}

.chat-item-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-preview {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.btn-settings {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-settings:hover {
    background: var(--glass);
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.mobile-header {
    display: none;
    padding: 15px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--glass-border);
    align-items: center;
    gap: 15px;
}

.menu-btn, .more-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.current-chat-title {
    flex-grow: 1;
    font-weight: 600;
}

/* Empty State */
.empty-state {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.empty-content {
    text-align: center;
    max-width: 500px;
}

.empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.empty-content h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.empty-content p {
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.model-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.model-card {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s;
}

.model-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-kimi);
}

.model-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 15px;
}

.model-icon.kimi {
    background: var(--accent-kimi);
}

.model-icon.minimax {
    background: var(--accent-minimax);
}

.model-card h3 {
    margin-bottom: 5px;
}

.model-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

/* Chat Container */
.chat-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 100px;
}

.message {
    max-width: 80%;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    margin-left: auto;
}

.message-bubble {
    padding: 15px 20px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.6;
}

.message.user .message-bubble {
    background: var(--accent-gradient);
    color: white;
    border-bottom-right-radius: 5px;
}

.message.assistant .message-bubble {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 5px;
}

.message-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
    padding: 0 5px;
}

.message.user .message-meta {
    text-align: right;
}

/* Input Area */
.input-area {
    position: fixed;
    bottom: 0;
    left: 280px;
    right: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--glass-border);
    padding: 15px 20px;
}

.model-selector {
    margin-bottom: 10px;
}

.model-selector select {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px 15px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

.input-box {
    display: flex;
    gap: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 5px;
}

.input-box textarea {
    flex-grow: 1;
    background: transparent;
    border: none;
    padding: 12px 15px;
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    outline: none;
    max-height: 120px;
}

.send-btn {
    width: 45px;
    height: 45px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

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

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.api-section {
    margin-bottom: 30px;
}

.api-section h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.api-section label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.api-section input {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.api-section input:focus {
    border-color: var(--accent-kimi);
}

.hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.hint code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.btn-save {
    width: 100%;
    padding: 15px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

/* Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 50;
}

.overlay.show {
    display: block;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .mobile-header {
        display: flex;
    }
    
    .input-area {
        left: 0;
    }
    
    .model-cards {
        grid-template-columns: 1fr;
    }
    
    .message {
        max-width: 90%;
    }
}

/* Loading Indicator */
.loading {
    display: flex;
    gap: 5px;
    padding: 10px;
}

.loading span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 15px;
    background: var(--bg-secondary);
    border-radius: 20px;
    border-bottom-left-radius: 5px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

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

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
