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

:root {
    --sidebar-width: 260px;
    --primary-color: #10a37f;
    --background-color: #343541;
    --sidebar-color: #202123;
    --text-color: #ececf1;
    --input-background: #40414f;
    --message-background: #444654;
    --user-message-background: #343541;
    --border-color: #565869;
    --hover-color: #2A2B32;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    background: var(--background-color);
    height: 100vh;
    overflow: hidden;
}

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

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-color);
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 0.5rem 0;
}

.new-chat {
    width: 100%;
    padding: 0.8rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

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

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

.chat-item {
    padding: 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-color);
    transition: background-color 0.2s;
}

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

.chat-item i {
    font-size: 1rem;
    opacity: 0.7;
}

.chat-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: margin-left 0.3s ease;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 0;
    scroll-behavior: smooth;
}

.welcome-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    background: var(--background-color);
    z-index: 10;
}

.welcome-screen h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.welcome-screen p {
    color: var(--text-color);
    opacity: 0.8;
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.messages {
    max-width: 768px;
    margin: 0 auto;
    padding: 0 1rem;
}

.message {
    padding: 1.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    gap: 1.5rem;
    animation: message-fade-in 0.3s ease-out;
    border-radius: 1rem;
    position: relative;
}

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

.user-message {
    background: var(--user-message-background);
}

.ai-message {
    background: var(--message-background);
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    flex-shrink: 0;
}

.user-message .avatar {
    background: #1a73e8;
}

.message-content {
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    line-height: 1.6;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.25;
}

.message-content h1 { font-size: 2em; }
.message-content h2 { font-size: 1.5em; }
.message-content h3 { font-size: 1.25em; }
.message-content h4 { font-size: 1em; }

.message-content p {
    margin-bottom: 1em;
}

.message-content ul,
.message-content ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.message-content li {
    margin-bottom: 0.5em;
}

.message-content code {
    padding: 0.2em 0.4em;
    background-color: rgba(110, 118, 129, 0.4);
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
    font-size: 0.85em;
}

.message-content pre {
    margin: 1em 0;
    padding: 1em;
    background-color: #1e1e1e;
    border-radius: 8px;
    overflow-x: auto;
}

.message-content pre code {
    padding: 0;
    background-color: transparent;
    font-size: 0.9em;
    line-height: 1.5;
}

.message-content blockquote {
    margin: 1em 0;
    padding-left: 1em;
    border-left: 3px solid var(--border-color);
    color: #8e8ea0;
}

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

.message-content th,
.message-content td {
    padding: 0.5em;
    border: 1px solid var(--border-color);
}

.message-content th {
    background-color: var(--message-background);
    font-weight: 600;
}

.message-content a {
    color: #2f81f7;
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

.message-content hr {
    margin: 1.5em 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

.message-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1em 0;
}

.typing {
    display: inline-block;
    width: fit-content;
}

.typing-animation {
    display: inline-block;
    opacity: 0;
    animation: typing 20ms linear both;
}

@keyframes typing {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Input Area Styles */
.input-container {
    padding: 1rem 1rem 2rem;
    background: var(--background-color);
    position: relative;
}

.input-box {
    max-width: 768px;
    margin: 0 auto;
    background: var(--input-background);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.75rem;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

#user-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1rem;
    resize: none;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
}

#user-input:focus {
    outline: none;
}

#send-button {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

#send-button:hover {
    color: #0d8d6a;
}

.disclaimer {
    text-align: center;
    color: #8e8ea0;
    font-size: 0.75rem;
    margin-top: 0.75rem;
    max-width: 768px;
    margin-left: auto;
    margin-right: auto;
}

.preset-questions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    width: 100%;
    max-width: 800px;
    margin-top: 1rem;
}

.preset-btn {
    background: var(--input-background);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    width: 100%;
}

.preset-btn i {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.preset-btn:hover {
    background: var(--hover-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Thinking Message Styles */
.thinking-message .typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

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

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

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

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

/* Chat Title Styles */
.chat-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

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

.chat-title-input {
    flex: 1;
    background: var(--input-background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    font-size: 1rem;
    padding: 2px 4px;
    margin: -3px 0;
    width: calc(100% - 30px); /* Account for the icon */
}

.chat-title-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.edit-button {
    background: transparent;
    border: none;
    color: var(--text-color);
    opacity: 0;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.edit-button:hover {
    background: var(--input-background);
    color: var(--primary-color);
}

.chat-item:hover .edit-button {
    opacity: 0.7;
}

.chat-item:hover .edit-button:hover {
    opacity: 1;
}

.chat-title-input {
    flex: 1;
    background: var(--input-background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    font-size: 1rem;
    padding: 4px 8px;
    margin: -4px 0;
}

.chat-title-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Message Actions Styles */
.message-actions {
    position: absolute;
    bottom: 0.5rem;
    right: 0.75rem;
    display: flex;
    gap: 0.35rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.action-btn {
    background: var(--input-background);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-color);
    padding: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    transition: all 0.2s ease;
}

.action-btn i {
    font-size: 0.85rem;
}

.action-btn:hover {
    background: var(--hover-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.copy-btn:hover {
    color: #2f81f7;
    border-color: #2f81f7;
}

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

/* Adjust message content padding to prevent overlap with buttons */
.ai-message .message-content {
    padding-bottom: 2.5rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    z-index: 1000;
    animation: toast-in 0.3s ease;
}

.toast.fade-out {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes toast-out {
    from {
        transform: translate(-50%, 0);
        opacity: 1;
    }
    to {
        transform: translate(-50%, 100%);
        opacity: 0;
    }
}

/* Language Selector Styles */
.language-selector {
    margin-top: 0.8rem;
    width: 100%;
}

#language-select {
    width: 100%;
    padding: 0.6rem;
    background: var(--input-background);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

#language-select:hover {
    background: var(--hover-color);
    border-color: var(--primary-color);
}

#language-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.15);
}

#language-select option {
    background: var(--background-color);
    color: var(--text-color);
    padding: 0.5rem;
}

/* Menu button styles */
.menu-button {
    position: fixed;
    right: -40px;
    bottom: 20px;
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border: none;
    color: white;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    z-index: 1001;
}

.menu-button:hover {
    background: #0d8c6c;
}

.menu-button i {
    transition: transform 0.3s ease;
}

/* Mobile styles */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 85%;
        max-width: var(--sidebar-width);
    }

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

    .sidebar.active .menu-button {
        right: -40px;
    }

    .sidebar .menu-button {
        right: -40px;
    }

    .main-content {
        margin-left: 0;
    }

    .chat-container {
        padding-top: 1rem;
    }

    .input-box {
        margin: 0 0.5rem;
    }

    .message {
        padding: 1rem;
        gap: 0.75rem;
    }

    .message-content {
        font-size: 0.95rem;
    }

    .preset-questions {
        grid-template-columns: 1fr;
        padding: 0 0.75rem;
    }

    .preset-btn {
        font-size: 0.95rem;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }
}

/* Footer Styles */
.footer {
    text-align: center;
    padding: 1rem 0 0;
    color: #8e8ea0;
    font-size: 0.85rem;
}

.footer-content {
    max-width: 768px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.footer a {
    color: #8e8ea0;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s ease;
}

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

.footer i {
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .footer {
        padding: 0.5rem 0 0;
        font-size: 0.8rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
    }
} 