:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --primary-color: #888888;
    --hover-color: #f5f5f5;
    --sidebar-bg: #f8f9fa;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

.sidebar {
    width: 224px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    font-size: 0.8em;
}

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

.sidebar-header h2 {
    font-size: 19.2px;
    font-weight: 600;
}

.sidebar-top {
    padding: 12px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px;
    overflow: hidden;
    min-height: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.2s;
}

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

.menu-item.active {
    background-color: var(--primary-color);
    color: white;
}

.menu-item-icon {
    margin-right: 12px;
    font-size: 14.4px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.menu-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.new-chat-button {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--text-color);
    font-family: inherit;
    font-size: inherit;
}

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

.new-chat-icon {
    margin-right: 10px;
    font-size: 12.8px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.new-chat-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

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

.chat-history {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: 20px;
    margin-bottom: 12px;
    overflow-y: auto;
    min-height: 0;
}

.chat-history-title {
    font-size: 9.6px;
    font-weight: 600;
    text-transform: uppercase;
    color: #666;
    padding: 8px 12px;
    margin-bottom: 8px;
}

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

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

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

.chat-item-icon {
    display: none;
    margin-right: 10px;
    font-size: 16px;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px;
    flex-shrink: 0;
}

.sidebar-footer .menu-item {
    margin-bottom: 0;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 15%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: none;
}

.empty-state-text {
    font-size: 16px;
}

.message {
    display: flex;
    margin-bottom: 45px;
    align-items: flex-start;
    position: relative;
}

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

.message-avatar {
    display: none;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    position: relative;
}

.message.assistant .message-wrapper {
    max-width: 85%;
    margin-right: auto;
}

.message.user .message-wrapper {
    max-width: 60%;
    margin-left: auto;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
}

.message.user .message-content {
    background-color: #f5f5f5;
    color: var(--text-color);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background-color: transparent;
    color: var(--text-color);
    border-bottom-left-radius: 4px;
}

.message-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    padding: 0 4px;
}

.user-copy-btn {
    position: absolute;
    right: 100%;
    margin-right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s;
}

.message.user:hover .user-copy-btn {
    opacity: 1;
}

.message-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: color 0.2s, transform 0.1s, background-color 0.2s;
    border-radius: 4px;
}

.message-action-btn:hover {
    color: var(--primary-color);
    background-color: rgba(102, 102, 102, 0.1);
}

.message-action-btn:active {
    transform: scale(0.95);
}

.message-action-btn.active {
    color: var(--primary-color);
}

.message-action-btn.active.like-btn {
    color: #888888;
}

.message-action-btn.active.dislike-btn {
    color: #888888;
}

.message-action-btn svg,
.message-action-btn .icon-img {
    display: block;
    width: 16px;
    height: 16px;
}

.message-action-btn .icon-img {
    object-fit: contain;
}

.message-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.copy-btn {
    margin-right: 0;
}

.input-area {
    padding: 20px 15%;
    background-color: var(--bg-color);
}

.attachments-preview {
    display: none;
    padding: 8px 12px;
    margin-bottom: 8px;
    background-color: #f8f9fa;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.attachment-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 4px;
    background-color: white;
    border-radius: 6px;
    font-size: 13px;
    gap: 8px;
}

.attachment-item:last-child {
    margin-bottom: 0;
}

.attachment-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.attachment-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-color);
}

.attachment-size {
    color: #666;
    font-size: 11px;
    flex-shrink: 0;
}

.attachment-remove {
    background: none;
    border: none;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0;
}

.attachment-remove:hover {
    background-color: #f0f0f0;
    color: #888888;
}

.chat-container.drag-over,
.input-area.drag-over {
    background-color: #f5f5f5;
    border: 2px dashed var(--primary-color);
}

.input-container {
    display: flex;
    align-items: center;
    background-color: #f5f5f5;
    border-radius: 24px;
    padding: 8px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    gap: 8px;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.action-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.action-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.action-btn:hover .action-icon {
    opacity: 1;
}

.input-field {
    flex: 1;
    border: none;
    background: white;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    max-height: 200px;
    min-height: 44px;
    outline: none;
}

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

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background-color: #e0e0e0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    background-color: #d0d0d0;
}

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

.send-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    opacity: 0.7;
}

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

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--bg-color);
}

.auth-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-color);
}

.auth-card h1 {
    margin-bottom: 8px;
    font-size: 28px;
}

.auth-card p {
    color: #666;
    margin-bottom: 24px;
}

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

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

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
}

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

.btn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #777777;
}

.btn:active {
    background-color: #4d4d4d;
}

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

.auth-link {
    margin-top: 20px;
    text-align: center;
    color: #666;
}

.auth-link a {
    color: #555555;
    text-decoration: underline;
    text-decoration-color: #888888;
    text-underline-offset: 3px;
    font-weight: 500;
    transition: color 0.2s, text-decoration-color 0.2s;
}

.auth-link a:hover {
    color: #333333;
    text-decoration-color: #666666;
}

#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
}

.notification {
    background: white;
    padding: 16px 20px;
    margin-bottom: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification-icon {
    font-size: 20px;
}

.notification.error {
    border-left: 4px solid #888888;
}

.notification.success {
    border-left: 4px solid #888888;
}

.notification.info {
    border-left: 4px solid #888888;
}

.notification-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    margin-left: auto;
    color: #999;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    color: #333;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: fixed;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .main-content {
        width: 100%;
    }
}
