:root {
    --bg-main: #ffffff;
    --bg-sidebar: #000000;
    --bg-user-msg: #f4f4f4;
    --bg-ai-msg: #ffffff;
    --border-color: #e5e5e5;
    --border-hover: #d4d4d4;
    --text-primary: #0d0d0d;
    --text-secondary: #666666;
    --accent-color: #000000;
    --accent-hover: #333333;
    --input-bg: #ffffff;
    
    /* Sidebar specific variables */
    --sidebar-text: #ffffff;
    --sidebar-text-muted: #a3a3a3;
    --sidebar-border: #262626;
    --sidebar-input-bg: #171717;
    --sidebar-hover: #262626;
}

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

body, html {
    height: 100%;
    width: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
}

/* App Layout */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

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

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

.logo-icon {
    width: 28px;
    height: 28px;
    background: var(--sidebar-text);
    color: var(--bg-sidebar);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.85rem;
}

.logo h2 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.new-chat-btn {
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.new-chat-btn:hover {
    background-color: var(--sidebar-hover);
}

/* Sidebar Tabs */
.sidebar-tabs {
    display: flex;
    flex-direction: column;
    padding: 0 16px 16px 16px;
    gap: 8px;
    border-bottom: 1px solid var(--sidebar-border);
}

.tab-btn {
    background: transparent;
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text-muted);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tab-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tab-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.badge {
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
}

.badge-uncensored {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.badge-performance {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.tab-btn:hover {
    color: var(--sidebar-text);
    border-color: #555;
    background: var(--sidebar-hover);
}

.tab-btn.active {
    background: #1a1a1a;
    color: var(--sidebar-text);
    border-color: #555;
}

.sidebar-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

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

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sidebar-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    justify-content: space-between;
}

.get-key-link {
    color: var(--sidebar-text-muted);
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
}

.get-key-link:hover {
    color: var(--sidebar-text);
}

.model-select {
    width: 100%;
    background: var(--sidebar-input-bg);
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
}

.model-select option {
    background: var(--sidebar-input-bg);
    color: var(--sidebar-text);
}

.model-select:hover {
    border-color: #555;
}

.model-select:focus {
    border-color: var(--sidebar-text);
}

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

.api-input {
    width: 100%;
    background: var(--sidebar-input-bg);
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
}
.api-input::placeholder {
    color: var(--sidebar-text-muted);
}

.api-input:focus {
    border-color: var(--sidebar-text);
}

.auth-btn {
    width: 100%;
    border: none;
    background: var(--sidebar-text);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--bg-sidebar);
    transition: background-color 0.2s;
}

.auth-btn:hover {
    background: #e5e5e5;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-main);
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 0;
    padding-top: 24px;
}

.chat-box::-webkit-scrollbar {
    width: 6px;
}
.chat-box::-webkit-scrollbar-track {
    background: transparent;
}
.chat-box::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}
.chat-box::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.message {
    display: flex;
    gap: 16px;
    padding: 24px 24px;
    line-height: 1.6;
    font-size: 0.95rem;
}

@media (min-width: 848px) {
    .message {
        padding-left: calc(50vw - 130px - 350px);
        padding-right: calc(50vw - 130px - 350px);
    }
}

.user-message {
    background-color: var(--bg-user-msg);
}

.ai-message {
    background-color: var(--bg-ai-msg);
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    color: white;
    font-size: 0.8rem;
    margin-top: 2px;
}

.user-message .avatar {
    background-color: #6b7280;
}

.ai-message .avatar {
    background-color: #10a37f;
}

.message-content {
    flex: 1;
    color: var(--text-primary);
}

.message-content p {
    margin-bottom: 12px;
}
.message-content p:last-child {
    margin-bottom: 0;
}

.message-content a {
    color: #10a37f;
    text-decoration: none;
}
.message-content a:hover {
    text-decoration: underline;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}
.typing-dot {
    width: 5px;
    height: 5px;
    background: #9ca3af;
    border-radius: 50%;
    animation: bounce 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 bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
.chat-input-area {
    padding: 16px 24px;
    background: var(--bg-main);
    display: flex;
    justify-content: center;
}

.chat-input-wrapper {
    width: 100%;
    max-width: 768px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#chat-form {
    width: 100%;
    position: relative;
    display: flex;
    align-items: flex-end;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    background: var(--input-bg);
    box-shadow: 0 0 15px rgba(0,0,0,0.03);
}

#chat-form:focus-within {
    border-color: #a3a3a3;
    box-shadow: 0 0 15px rgba(0,0,0,0.06);
}

#user-input {
    flex: 1;
    border: none;
    padding: 14px 20px;
    background: transparent;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    max-height: 200px;
}

#user-input::placeholder {
    color: #9ca3af;
}

#send-btn {
    width: 32px;
    height: 32px;
    margin: 8px 12px 8px 0;
    border-radius: 50%;
    border: none;
    background-color: var(--text-primary);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

#send-btn:hover {
    background-color: var(--accent-hover);
}

#send-btn:disabled {
    background-color: #e5e5e5;
    color: #a3a3a3;
    cursor: not-allowed;
}

.footer-disclaimer {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
    }
    .sidebar-content {
        display: none; 
    }
    .sidebar-footer {
        display: none;
    }
    .chat-box {
        padding-top: 16px;
    }
    .message {
        padding: 16px;
    }
}

/* Media Uploads */
.file-preview-container {
    width: 100%;
    display: flex;
    gap: 12px;
    padding: 0 8px 8px 8px;
    overflow-x: auto;
}

.file-preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.file-preview-item.video-preview {
    background-color: #f3f4f6;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #6b7280;
}

.remove-file-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#attach-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 1.1rem;
    padding: 12px 0 12px 16px;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}

#attach-btn:hover {
    color: var(--text-primary);
}

/* Reasoning Block */
.thought-block {
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
}

.thought-header {
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    background: #f3f4f6;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.thought-header i {
    transition: transform 0.2s;
}

.thought-header.collapsed i {
    transform: rotate(-90deg);
}

.thought-content {
    padding: 12px;
    font-size: 0.9rem;
    color: #4b5563;
    font-style: italic;
    border-top: 1px solid #e5e7eb;
    white-space: pre-wrap;
}

.thought-content.hidden {
    display: none;
}

