:root {
    --primary-color: #4285f4;
    --primary-light: #e8f0fe;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --bg-color: #ffffff;
    --sidebar-bg: #f5f5f5;
    --message-bg: #f1f3f4;
    --ai-message-bg: #e8f0fe;
    --border-color: #dadce0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --error-color: #d93025;
    --success-color: #0f9d58;
}

[data-theme="dark"] {
    --primary-color: #8ab4f8;
    --primary-light: #2d3e50;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --bg-color: #202124;
    --sidebar-bg: #2d2d2d;
    --message-bg: #303134;
    --ai-message-bg: #2d3e50;
    --border-color: #3c4043;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --error-color: #f28b82;
    --success-color: #81c995;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

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

.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    transform: translateX(0);
    transition: transform 0.3s ease, width 0.3s ease;
    z-index: 10;
}

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

.logo {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-weight: bold;
}

.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--primary-light);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

.new-chat-btn i {
    margin-right: 8px;
}

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

.user-profile {
    display: flex;
    align-items: center;
}

.avatar {
    width: 32px;
    height: 32px;
    background-color: var(--message-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    color: var(--text-secondary);
}

.username {
    font-weight: 500;
}

.help-btn, .theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.help-btn:hover, .theme-toggle:hover {
    background-color: var(--message-bg);
    color: var(--text-primary);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s ease;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    text-align: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.welcome-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.welcome-content {
    max-width: 800px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease;
}

.logo-large {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    font-size: 24px;
    font-weight: 600;
}

.logo-large .logo-icon {
    width: 48px;
    height: 48px;
    font-size: 24px;
    margin-right: 15px;
}

.welcome-screen h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.prompt-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.suggestion-card {
    background-color: var(--message-bg);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.suggestion-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px var(--shadow-color);
}

.suggestion-card p {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.suggestion-card i {
    color: var(--primary-color);
    position: absolute;
    bottom: 15px;
    right: 15px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s ease;
}

.suggestion-card:hover i {
    opacity: 1;
    transform: translateY(0);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
    display: none;
}

.chat-messages.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.message {
    max-width: 800px;
    margin: 0 auto 20px;
    padding: 15px 20px;
    border-radius: 12px;
    line-height: 1.6;
    position: relative;
    opacity: 0;
    transform: translateY(10px);
    animation: messageAppear 0.3s ease forwards;
}

.message.user {
    background-color: var(--message-bg);
    margin-left: auto;
    border-bottom-right-radius: 0;
}

.message.ai {
    background-color: var(--ai-message-bg);
    margin-right: auto;
    border-bottom-left-radius: 0;
}

.message-content {
    overflow-wrap: break-word;
}

.message-content img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 10px;
    box-shadow: 0 2px 5px var(--shadow-color);
}

.message-content pre {
    background-color: var(--sidebar-bg);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.message-content code {
    background-color: var(--sidebar-bg);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}

.message-content th, .message-content td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: left;
}

.message-content th {
    background-color: var(--sidebar-bg);
}

.message-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 15px;
    margin: 10px 0;
    color: var(--text-secondary);
}

.message-content ul, .message-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

.message-meta {
    display: flex;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.message-meta .avatar {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    font-size: 12px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--ai-message-bg);
    border-radius: 12px;
    max-width: 800px;
    margin: 0 auto 20px;
    border-bottom-left-radius: 0;
    opacity: 0;
    transform: translateY(10px);
    animation: messageAppear 0.3s ease forwards;
}

.typing-dots {
    display: flex;
    align-items: center;
    height: 24px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    margin: 0 2px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    display: inline-block;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

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

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

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

.input-container {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-color);
    position: relative;
}

.input-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background-color: var(--message-bg);
    color: var(--primary-color);
}

.input-wrapper {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

textarea#messageInput {
    width: 100%;
    padding: 12px 50px 12px 20px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    background-color: var(--message-bg);
    color: var(--text-primary);
    resize: none;
    min-height: 50px;
    max-height: 200px;
    outline: none;
    font-size: 16px;
    transition: all 0.2s ease;
}

textarea#messageInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

#sendButton {
    position: absolute;
    right: 15px;
    bottom: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#sendButton:not([disabled]) {
    color: var(--primary-color);
}

#sendButton:hover:not([disabled]) {
    transform: scale(1.1);
}

.disclaimer {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 10px;
    opacity: 0.7;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background-color: var(--bg-color);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 10px 25px var(--shadow-color);
}

.modal.active .modal-content {
    transform: translateY(0);
}

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

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

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.help-section {
    margin-bottom: 20px;
}

.help-section h3 {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 16px;
}

.help-section h3 i {
    margin-right: 10px;
    color: var(--primary-color);
}

.help-section p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.background-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.bg-option {
    cursor: pointer;
    text-align: center;
}

.bg-preview {
    width: 100%;
    height: 80px;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-option:hover .bg-preview {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.bg-option span {
    font-size: 14px;
    color: var(--text-secondary);
}

.custom-bg-controls {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: var(--text-secondary);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--message-bg);
    color: var(--text-primary);
    outline: none;
}

button#applyCustomBg {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

button#applyCustomBg:hover {
    background-color: #3367d6;
}

.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#musicQuery {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--message-bg);
    color: var(--text-primary);
    outline: none;
}

#searchMusicBtn {
    padding: 10px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#searchMusicBtn:hover {
    background-color: #3367d6;
}

.music-results {
    max-height: 300px;
    overflow-y: auto;
}

.music-track {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    background-color: var(--message-bg);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.music-track:hover {
    background-color: var(--ai-message-bg);
}

.track-cover {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    margin-right: 15px;
    background-color: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.track-info {
    flex: 1;
}

.track-title {
    font-weight: 500;
    margin-bottom: 5px;
}

.track-artist {
    font-size: 12px;
    color: var(--text-secondary);
}

.track-duration {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 15px;
}

.generate-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease;
    margin-top: 15px;
}

.generate-btn:hover {
    background-color: #3367d6;
}

.image-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 15px 0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--text-primary);
    color: var(--bg-color);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes typingAnimation {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        width: 280px;
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .background-options {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .prompt-suggestions {
        grid-template-columns: 1fr;
    }
    
    .message {
        padding: 12px 15px;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .background-options {
        grid-template-columns: 1fr;
    }
}
