:root {
    --bg-primary: #0d0d14;
    --bg-secondary: #151520;
    --bg-tertiary: #1a1a28;
    --accent-pink: #ff6b9d;
    --accent-purple: #9b6bff;
    --accent-cyan: #6bffff;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --border-color: #2a2a3a;
}

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

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #12121c 50%, var(--bg-secondary) 100%);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar.open {
    transform: translateX(0);
}

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

.sidebar-header h3 {
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-sidebar {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

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

.empty-gallery {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px 20px;
    font-size: 0.9rem;
}

.gallery-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 8px;
}

.gallery-item:hover {
    background: var(--bg-tertiary);
}

.gallery-icon {
    font-size: 1.5rem;
}

.gallery-info {
    flex: 1;
    min-width: 0;
}

.gallery-prompt {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-date {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header */
.app-header {
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(21, 21, 32, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px;
}

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

.pig-mascot {
    animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.app-title {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.model-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-family: inherit;
    cursor: pointer;
}

.settings-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
}

/* Settings Panel */
.settings-panel {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 20px;
    animation: slideDown 0.2s ease;
}

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

.settings-content h3 {
    margin-bottom: 16px;
    color: var(--accent-pink);
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.setting-row label {
    min-width: 80px;
    color: var(--text-secondary);
}

.setting-row select {
    flex: 1;
    max-width: 300px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
}

.clear-btn {
    background: rgba(255, 100, 100, 0.1);
    border: 1px solid rgba(255, 100, 100, 0.3);
    color: #ff6b6b;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: rgba(255, 100, 100, 0.2);
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
}

.welcome-screen h2 {
    margin-top: 20px;
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-screen p {
    color: var(--text-secondary);
    margin: 12px 0 30px;
    max-width: 400px;
}

.quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 600px;
}

.quick-prompt-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.quick-prompt-btn:hover {
    border-color: var(--accent-purple);
    background: rgba(155, 107, 255, 0.1);
}

/* Messages */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

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

.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.message-content {
    max-width: 80%;
}

.message-text {
    padding: 14px 18px;
    border-radius: 16px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.user-message .message-text {
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    border-bottom-right-radius: 4px;
}

.ai-message .message-text {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

/* Code Block */
.code-block-container {
    margin-top: 12px;
}

.code-block {
    background: #0a0a12;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 0 20px rgba(155, 107, 255, 0.1);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.code-language {
    font-size: 0.75rem;
    color: var(--accent-cyan);
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.code-actions {
    display: flex;
    gap: 8px;
}

.code-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s;
}

.copy-btn {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.copy-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.launch-btn {
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    color: white;
    font-weight: 600;
}

.launch-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(155, 107, 255, 0.3);
}

.code-content {
    padding: 16px;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.code-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre;
}

.code-keyword { color: #ff79c6; }
.code-string { color: #f1fa8c; }
.code-number { color: #bd93f9; }
.code-comment { color: #6272a4; font-style: italic; }

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 12px;
    align-items: center;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--accent-purple);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

/* Input Area */
.input-container {
    padding: 16px 20px;
    background: rgba(21, 21, 32, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px 12px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent-purple);
}

.message-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    padding: 8px;
    max-height: 150px;
}

.message-input::placeholder {
    color: var(--text-secondary);
}

.message-input:focus {
    outline: none;
}

.input-actions {
    display: flex;
    gap: 8px;
}

.random-btn, .send-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.random-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.random-btn:hover {
    background: var(--bg-primary);
    transform: rotate(180deg);
}

.send-btn {
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
    color: white;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

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

/* Footer */
.app-footer {
    padding: 10px 20px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.app-footer a {
    color: var(--accent-pink);
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .app-title {
        display: none;
    }
    
    .model-select {
        max-width: 120px;
        font-size: 0.85rem;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .quick-prompts {
        flex-direction: column;
    }
    
    .quick-prompt-btn {
        width: 100%;
    }
    
    .code-actions {
        flex-direction: column;
        gap: 4px;
    }
    
    .code-btn {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}