:root {
    --primary-color: #3a86ff;
    --secondary-color: #8338ec;
    --accent-color: #ff006e;
    --background: #ffffff;
    --surface: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --success: #2ecc71;
    --error: #e74c3c;
    --border-radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

.dark-theme {
    --primary-color: #4e95fd;
    --secondary-color: #9158f5;
    --accent-color: #ff4b8b;
    --background: #121212;
    --surface: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #adb5bd;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 16px;
    background: white;
    border-left: 4px solid #333;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 4px;
    transform: translateY(30px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success {
    border-left-color: #4CAF50;
}

.toast-error {
    border-left-color: #F44336;
}

.toast-info {
    border-left-color: #2196F3;
}

.toast-icon {
    color: #555;
}

.toast-success .toast-icon {
    color: #4CAF50;
}

.toast-error .toast-icon {
    color: #F44336;
}

.toast-info .toast-icon {
    color: #2196F3;
}

.toast-message {
    font-size: 14px;
}

/* Typing Indicator Styles */
.typing-indicator .message.typing {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    min-width: 60px;
}

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

.typing-indicator .message .dot:nth-child(1) {
    animation-delay: 0s;
}

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

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

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

/* Header Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
}

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

.logo img {
    height: 40px;
    margin-right: 15px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

#theme-switch {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

#theme-switch:hover {
    color: var(--accent-color);
    transform: rotate(15deg);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background-color: var(--surface);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: var(--transition);
    flex: 1;
    max-width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background-color: rgba(58, 134, 255, 0.1);
    color: var(--primary-color);
}

.tab-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* Content Area */
.content-area {
    background-color: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 30px;
    flex: 1;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

textarea {
    width: 100%;
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
    background-color: var(--background);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 15px;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(58, 134, 255, 0.2);
}

select {
    padding: 12px 15px;
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
    background-color: var(--background);
    color: var(--text-primary);
    font-size: 16px;
    transition: var(--transition);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.controls {
    display: flex;
    gap: 10px;
}

.primary-btn, .secondary-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

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

.primary-btn:hover {
    background-color: #2a75ee;
    transform: translateY(-2px);
}

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

.secondary-btn:hover {
    background-color: rgba(58, 134, 255, 0.1);
    transform: translateY(-2px);
}

.primary-btn:disabled, .secondary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Image Result */
.result-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loading-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(58, 134, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

.result {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.result img {
    max-width: 100%;
    max-height: 500px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

#download-image {
    display: none;
    margin-top: 20px;
}

/* Chat Styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 20px;
    background-color: var(--background);
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
}

.chat-message {
    display: flex;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease-in-out;
}

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

.chat-message .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.chat-message.user .avatar {
    background-color: var(--accent-color);
    color: white;
}

.chat-message.system .avatar {
    background-color: var(--primary-color);
    color: white;
}

.chat-message .message {
    background-color: var(--surface);
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.5;
}

.chat-message.system .message {
    border-top-left-radius: 4px;
    background-color: rgba(58, 134, 255, 0.1);
    color: var(--text-primary);
}

.chat-message.user .message {
    border-top-right-radius: 4px;
    background-color: rgba(255, 0, 110, 0.1);
    color: var(--text-primary);
    margin-left: auto;
}

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

.chat-message.user .avatar {
    margin-right: 0;
    margin-left: 12px;
}

.chat-input {
    display: flex;
    gap: 10px;
}

.chat-input textarea {
    margin-bottom: 0;
    min-height: 60px;
    flex: 1;
}

.chat-input button {
    align-self: flex-end;
    height: 50px;
    width: 50px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pre and Code Styles */
.message pre {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.message code {
    font-family: 'Consolas', 'Monaco', monospace;
    padding: 2px 4px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* New styles for file upload and voice recording */
.chat-input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-actions {
    display: flex;
    gap: 10px;
    padding: 0 10px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.action-btn:hover {
    background-color: rgba(58, 134, 255, 0.1);
    color: var(--primary-color);
}

.action-btn.recording {
    color: var(--error);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* File message styles */
.chat-message .file-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 8px;
}

.chat-message .file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    margin-top: 8px;
}

.chat-message .file-info i {
    font-size: 20px;
}

/* Voice message styles */
.chat-message .voice-message {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.chat-message .voice-message i {
    color: var(--accent-color);
}

/* Footer */
footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 20px;
    color: var(--text-secondary);
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    color: var(--text-secondary);
    font-size: 20px;
    transition: var(--transition);
}

.social-links a:hover {
    color: var(--primary-color);
}

/* Responsive Styles */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .theme-toggle {
        align-self: flex-end;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        max-width: none;
    }
    
    .content-area {
        padding: 20px;
    }
    
    .chat-container {
        height: 400px;
    }
    
    .chat-message .message {
        max-width: 90%;
    }
    
    footer {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}
