:root {
    --primary-color: #4285f4;
    --primary-light: #e8f0fe;
    --secondary-color: #34a853;
    --error-color: #ea4335;
    --warning-color: #fbbc05;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --bg-color: #ffffff;
    --sidebar-bg: #f5f5f5;
    --message-ai-bg: #f7f7f8;
    --message-user-bg: #ffffff;
    --border-color: #dadce0;
    --code-bg: #f6f8fa;
    --hover-color: #f1f3f4;
    --shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
}

[data-theme="dark"] {
    --primary-color: #8ab4f8;
    --primary-light: #2d3e50;
    --secondary-color: #81c995;
    --error-color: #f28b82;
    --warning-color: #fdd663;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --bg-color: #202124;
    --sidebar-bg: #2d2d2d;
    --message-ai-bg: #282828;
    --message-user-bg: #353535;
    --border-color: #3c4043;
    --code-bg: #292929;
    --hover-color: #3c4043;
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.6), 0 1px 2px 0 rgba(0,0,0,0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Google Sans', Roboto, Arial, sans-serif;
}

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

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

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    transition: transform 0.3s ease;
    z-index: 100;
    position: relative;
}

.sidebar-header {
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.new-chat-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--sidebar-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background-color: var(--hover-color);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.chat-item {
    padding: 10px 10px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-item:hover {
    background-color: var(--hover-color);
}

.chat-item.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.chat-item-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delete-chat-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 4px;
    border-radius: 4px;
}

.chat-item:hover .delete-chat-btn {
    opacity: 1;
}

.delete-chat-btn:hover {
    color: var(--error-color);
    background-color: rgba(234, 67, 53, 0.1);
}

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid var(--border-color);
}

.settings-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    background-color: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s;
}

.settings-btn:hover {
    background-color: var(--hover-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-top: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.user-profile:hover {
    background-color: var(--hover-color);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Chat Container Styles */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

.chat-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background-color: var(--bg-color);
    z-index: 10;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle:hover {
    background-color: var(--hover-color);
}

.chat-header h1 {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.regenerate-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 4px;
    border: none;
    background-color: var(--primary-light);
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9rem;
}

.regenerate-btn:hover {
    background-color: var(--hover-color);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.message {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.ai-avatar {
    background-color: var(--primary-color);
}

.user-avatar {
    background-color: var(--secondary-color);
}

.message-content {
    flex: 1;
    padding-top: 4px;
}

.message-text {
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* Message Formatting Styles */
.message-text h1 {
    font-size: 1.8rem;
    margin: 1.5rem 0 1rem;
    font-weight: 600;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border-color);
}

.message-text h2 {
    font-size: 1.5rem;
    margin: 1.3rem 0 0.8rem;
    font-weight: 600;
}

.message-text h3 {
    font-size: 1.2rem;
    margin: 1.1rem 0 0.6rem;
    font-weight: 600;
}

.message-text p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.message-text strong {
    font-weight: 600;
}

.message-text em {
    font-style: italic;
}

.message-text ul, .message-text ol {
    margin: 0.5rem 0 1rem 1rem;
}

.message-text li {
    margin-bottom: 0.5rem;
    position: relative;
    padding-left: 1rem;
}

.message-text ul li::before {
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.message-text ol {
    counter-reset: item;
}

.message-text ol li {
    counter-increment: item;
}

.message-text ol li::before {
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.code-container {
    position: relative;
    margin: 1rem 0;
}

.code-container pre {
    background-color: var(--code-bg);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    border: 1px solid var(--border-color);
    margin: 0;
}

.code-container code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.code-container:hover .copy-code-btn {
    opacity: 1;
}

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

.copy-code-btn i {
    font-size: 0.8rem;
}

.message-text blockquote {
    border-left: 3px solid var(--primary-color);
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    background-color: var(--primary-light);
}

.message-text hr {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: 1.5rem 0;
}

.message-text table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

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

.message-text th {
    background-color: var(--primary-light);
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-actions {
    opacity: 1;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
}

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

/* Input Container Styles */
.input-container {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-color);
    position: sticky;
    bottom: 0;
}

.input-box {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: flex-end;
}

#user-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 12px 52px 12px 20px;
    font-size: 1rem;
    resize: none;
    outline: none;
    max-height: 200px;
    min-height: 52px;
    background-color: var(--bg-color);
    color: var(--text-primary);
    transition: border 0.3s, box-shadow 0.3s;
}

#user-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.send-btn, .microphone-btn {
    position: absolute;
    bottom: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.send-btn {
    right: 12px;
    color: var(--primary-color);
}

.microphone-btn {
    right: 60px;
}

.send-btn:hover, .microphone-btn:hover {
    background-color: var(--hover-color);
}

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

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--bg-color);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: modalFadeIn 0.3s ease;
}

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

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

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

.modal-body {
    padding: 20px;
}

.setting-option {
    margin-bottom: 16px;
}

.setting-option label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.setting-option select, .setting-option input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-primary);
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.save-settings, .confirm-delete, .cancel-delete {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.save-settings, .confirm-delete {
    background-color: var(--primary-color);
    color: white;
}

.save-settings:hover, .confirm-delete:hover {
    background-color: #3367d6;
}

.cancel-delete {
    background-color: var(--hover-color);
    color: var(--text-primary);
}

.cancel-delete:hover {
    background-color: #e0e0e0;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 8px;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.typing-dot {
    width: 10px;
    height: 10px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    opacity: 0.4;
    animation: typing-animation 1.4s infinite ease-in-out;
}

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

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

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

@keyframes typing-animation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* Character-by-character animation */
.typing-text {
    display: inline;
}

.typing-cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background-color: var(--text-primary);
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: middle;
}

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

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}

/* Responsive Styles */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: 260px;
    }
    
    .sidebar.visible {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .chat-header h1 {
        font-size: 1.2rem;
    }
    
    .message {
        gap: 10px;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .input-box {
        padding: 0 8px;
    }
    
    #user-input {
        padding: 12px 48px 12px 16px;
        min-height: 48px;
    }
    
    .send-btn, .microphone-btn {
        width: 36px;
        height: 36px;
        bottom: 8px;
    }
    
    .send-btn {
        right: 8px;
    }
    
    .microphone-btn {
        right: 52px;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 12px 16px;
    }
    
    .header-actions {
        display: none;
    }
    
    .chat-messages {
        padding: 16px 12px;
    }
    
    .message {
        gap: 8px;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
    }
    
    .input-container {
        padding: 12px;
    }
    
    .disclaimer {
        font-size: 0.7rem;
    }
}
/* Welcome Message Styles */
.welcome-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100vh - 200px); /* Adjust based on your layout */
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.welcome-message {
    max-width: 600px;
    width: 100%;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.welcome-message h1 {
    margin-bottom: 20px;
    color: white;
}

.welcome-message ul {
    text-align: left;
    display: inline-block;
    margin: 20px 0;
}

.welcome-message.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

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

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