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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #0a0a0f;
    color: #e0e0e0;
    overflow: hidden;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: #0f0f15;
    border-right: 1px solid #1a1a25;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar.closed {
    width: 0;
    border: none;
}

.sidebar-header {
    padding: 12px;
    border-bottom: 1px solid #1a1a25;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #d4af37, #b8960c);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: #0a0a0f;
}

.sidebar-logo span {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: 1px solid #2a2a35;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.new-chat-btn:hover {
    background: #1a1a25;
    border-color: #3a3a45;
}

.new-chat-btn svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

/* Navigation Menu */
.sidebar-nav {
    padding: 8px;
    border-bottom: 1px solid #1a1a25;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #aaa;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s ease;
}

.nav-item:hover {
    background: #1a1a25;
    color: #fff;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Conversations List */
.sidebar-conversations {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sidebar-conversations::-webkit-scrollbar {
    width: 4px;
}

.sidebar-conversations::-webkit-scrollbar-thumb {
    background: #2a2a35;
    border-radius: 2px;
}

.conversations-label {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
}

.no-conversations {
    padding: 12px;
    color: #555;
    font-size: 13px;
    text-align: center;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    margin-bottom: 2px;
}

.conversation-item:hover {
    background: #1a1a25;
}

.conversation-item.active {
    background: #1f1f2a;
}

.conversation-item svg {
    width: 16px;
    height: 16px;
    color: #666;
    flex-shrink: 0;
}

.conversation-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conversation-title {
    font-size: 13px;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-date {
    font-size: 11px;
    color: #555;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid #1a1a25;
}

.website-link {
    margin-bottom: 8px;
    color: #d4af37 !important;
}

.credits-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #1a1a25;
    border-radius: 8px;
    margin-bottom: 8px;
}

.credits-display svg {
    width: 16px;
    height: 16px;
    color: #d4af37;
}

.credits-display span {
    font-size: 13px;
    color: #aaa;
}

.buy-credits-btn {
    display: block;
    text-align: center;
    padding: 10px;
    background: linear-gradient(135deg, #d4af37, #b8960c);
    border-radius: 8px;
    color: #0a0a0f;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.buy-credits-btn:hover {
    opacity: 0.9;
}

/* Sidebar Toggle */
.sidebar-toggle {
    position: fixed;
    left: 260px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 48px;
    background: #1a1a25;
    border: 1px solid #2a2a35;
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left 0.2s ease;
    z-index: 100;
}

.sidebar.closed ~ .sidebar-toggle {
    left: 0;
}

.sidebar-toggle:hover {
    background: #2a2a35;
}

.sidebar-toggle svg {
    width: 14px;
    height: 14px;
    color: #666;
}

/* Main Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #0a0a0f;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #2a2a35;
    border-radius: 3px;
}

/* Welcome Screen */
.chat-welcome {
    text-align: center;
    padding: 80px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.chat-welcome h2 {
    color: #fff;
    margin-bottom: 12px;
    font-size: 28px;
    font-weight: 600;
}

.chat-welcome p {
    color: #888;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 32px;
}

.suggestions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.suggestions button {
    background: #1a1a25;
    border: 1px solid #2a2a35;
    color: #e0e0e0;
    padding: 10px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s ease;
}

.suggestions button:hover {
    background: #2a2a35;
    border-color: #d4af37;
    color: #d4af37;
}

/* Messages */
.message {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
}

.message-content {
    font-size: 15px;
    line-height: 1.6;
}

.message.user {
    display: flex;
    justify-content: flex-end;
}

.message.user .message-content {
    background: #d4af37;
    color: #0a0a0f;
    padding: 12px 18px;
    border-radius: 18px 18px 4px 18px;
    max-width: 80%;
}

.message.assistant .message-content {
    color: #e0e0e0;
}

.message.error .message-content {
    color: #ff6b6b;
}

.message.user .message-images {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    justify-content: flex-end;
}

.message.user .message-images img {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 6px;
}

/* Result images */
.result-images {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.result-image-container {
    position: relative;
}

.result-image-container img {
    max-width: 320px;
    max-height: 240px;
    border-radius: 12px;
    display: block;
}

.download-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: rgba(212, 175, 55, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.15s ease;
}

.result-image-container:hover .download-btn {
    opacity: 1;
}

.download-btn svg {
    width: 20px;
    height: 20px;
    color: #0a0a0f;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #d4af37;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

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

/* Upload Preview */
.upload-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: #12121a;
    border-top: 1px solid #1a1a25;
    flex-wrap: wrap;
}

.preview-item {
    position: relative;
}

.preview-item img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #2a2a35;
}

.preview-item .remove-upload {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: #ff4757;
    border: 2px solid #12121a;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-count {
    color: #666;
    font-size: 13px;
    margin-left: auto;
}

/* Input Wrapper & Container */
.chat-input-wrapper {
    padding: 16px 24px 24px;
    background: #0a0a0f;
}

.chat-input-container {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    gap: 8px;
    align-items: center;
    background: #1a1a25;
    border: 1px solid #2a2a35;
    border-radius: 16px;
    padding: 8px 12px;
}

.chat-input-container textarea {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 4px;
    color: #e0e0e0;
    font-size: 15px;
    resize: none;
    outline: none;
    font-family: inherit;
    min-height: 24px;
    max-height: 120px;
    line-height: 1.5;
}

.chat-input-container textarea::placeholder {
    color: #555;
}

/* Buttons */
.upload-btn,
.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.upload-btn {
    background: transparent;
    color: #666;
}

.upload-btn:hover:not(:disabled) {
    color: #d4af37;
    background: rgba(212, 175, 55, 0.1);
}

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

.upload-btn svg {
    width: 20px;
    height: 20px;
}

.send-btn {
    background: #d4af37;
    color: #0a0a0f;
}

.send-btn:hover:not(:disabled) {
    background: #e5c048;
}

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

.send-btn svg {
    width: 18px;
    height: 18px;
}

.upload-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #333;
    border-top-color: #d4af37;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 1000;
        width: 280px;
    }
    
    .sidebar.closed {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar-toggle {
        left: 12px;
        top: 12px;
        transform: none;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        border: 1px solid #2a2a35;
    }
    
    .sidebar.open ~ .sidebar-toggle {
        left: 292px;
    }
    
    .chat-messages { padding: 16px; }
    .chat-input-wrapper { padding: 12px 16px 20px; }
    .suggestions { flex-direction: column; }
}
