/* ChatGPT Style CSS */
@import url('https://fonts.googleapis.com/css2?family=Söhne:wght@400;500;600&display=swap');

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

:root {
    --text-primary: #202123;
    --text-secondary: #565869;
    --bg-primary: #ffffff;
    --bg-secondary: #f7f7f8;
    --bg-sidebar: #202123;
    --border-color: #e5e5e5;
    --hover-bg: #f0f0f0;
    --btn-primary: #10a37f;
    --btn-primary-hover: #0d8f6f;
}

body {
    font-family: 'Söhne', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    color: white;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    transition: background-color 0.2s;
}

.new-chat-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.convo {
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 6px;
    margin-bottom: 2px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.convo:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.convo.active {
    background-color: rgba(255, 255, 255, 0.2);
}

.convo-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.clear-conversations {
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.clear-conversations:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.company-info {
    margin-top: 12px;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.company-logo {
    height: 30px;
    width: auto;
}

.company-info span {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

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

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.message {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.message:last-child {
    border-bottom: none;
}

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

.message.assistant {
    background-color: var(--bg-secondary);
}

.message-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    gap: 16px;
}

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 2px;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    flex: 1;
    line-height: 1.6;
    font-size: 16px;
}

.message-content pre {
    background-color: #1e1e1e;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 16px 0;
}

.message-content code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 14px;
}

.message-content pre code {
    background-color: transparent;
    padding: 0;
}

/* Input Container */
.input-container {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

#message-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    background: transparent;
    padding: 8px 12px;
    max-height: 200px;
    font-family: inherit;
}

.send-button {
    background-color: var(--text-primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.send-button:hover {
    background-color: var(--text-secondary);
}

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

.input-options {
    max-width: 800px;
    margin: 8px auto 0;
    display: flex;
    justify-content: flex-end;
}

.model-select {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Mobile Styles */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
}

.sidebar-toggle {
    display: none;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 999;
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .main-content {
        width: 100%;
    }
    
    .message-wrapper {
        padding: 0 16px;
    }
    
    .input-container {
        padding: 16px;
    }
}

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

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

::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Loading Animation */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

/* Gradient Background (removed in ChatGPT style) */
.gradient {
    display: none;
}

/* Code block styles */
.hljs {
    background: #1e1e1e !important;
    color: #d4d4d4 !important;
    padding: 16px !important;
    border-radius: 6px !important;
}

/* Hide old UI elements */
.row,
.box.conversations,
.field,
.color-picker,
.mobile-sidebar,
.stop_generating,
.buttons {
    display: none !important;
}

/* Ensure messages div uses new styles */
#messages {
    background: transparent;
    border: none;
    box-shadow: none;
}