:root {
    --sidebar-width: 250px;
    --primary-color: #4a6fa5;
    --primary-hover: #3a5a8a;
    --error-color: #e74c3c;
    --background-dark: #1e1e2d;
    --background-darker: #161622;
    --background-light: #2a2a3a;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --modal-overlay: rgba(0, 0, 0, 0.7);
    --border-radius: 6px;
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background-color: var(--background-dark);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--background-darker);
    padding: 1rem;
    border-right: 1px solid var(--background-light);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--background-light);
    margin-bottom: 1rem;
}

    .sidebar-header h3 {
        margin: 0;
        font-size: 1.25rem;
    }

.sidebar-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* User Info / Auth */
.login-button, .user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}

.login-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

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

.user-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-info {
    background-color: var(--background-light);
}

.user-details {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
    overflow: hidden;
}

    .user-details .status {
        font-size: 0.75rem;
        color: var(--text-muted);
    }

    .user-details .email {
        font-size: 0.85rem;
        font-weight: 500;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.logout-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: #5c2a2a;
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s;
}

    .logout-button:hover {
        background-color: #6d3a3a;
    }

/* Main Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Layout */
.chat-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--background-dark);
}

/* Chat Messages */
.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Chat Message Bubbles */
.message {
    padding: 0.75rem;
    margin: 0.25rem 0;
    border-radius: var(--border-radius);
    max-width: 70%;
    word-break: break-word;
}

    .message.user {
        background-color: var(--primary-color);
        margin-left: auto;
        color: white;
    }

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

/* Chat Input */
.message-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--background-light);
    background-color: var(--background-light);
}

.message-input {
    flex-grow: 1;
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: var(--border-radius);
    border: none;
    background-color: var(--background-dark);
    color: var(--text-color);
}

.send-button {
    padding: 0.75rem 1.25rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-weight: bold;
    cursor: pointer;
}

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

/* Placeholder for empty chat */
.message-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    color: var(--text-muted);
}

/* Chat List */
.chat-list {
    margin-top: 1rem;
    max-height: 50vh;
    overflow-y: auto;
}

.chat-item {
    padding: 0.75rem;
    margin: 0.25rem 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

    .chat-item:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .chat-item.active {
        background-color: #3498db;
    }

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

.chat-date {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Buttons */
.primary-button {
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}

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

    .primary-button:disabled {
        background-color: var(--background-light);
        cursor: not-allowed;
    }

.action-button {
    width: 100%;
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}

    .action-button:hover {
        background: #34495e;
    }

    .action-button:disabled {
        opacity: 0.7;
        cursor: not-allowed;
    }

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
}

    .modal.visible {
        visibility: visible;
        opacity: 1;
    }

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--modal-overlay);
}

.modal-content {
    background-color: var(--background-darker);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 400px;
    z-index: 1;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

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

.modal-body {
    padding: 1.5rem;
}

/* Form */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

    .form-group label {
        font-weight: 500;
    }

.form-input {
    padding: 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--background-light);
    background-color: var(--background-dark);
    color: var(--text-color);
    width: 100%;
}

/* Utility */
.icon {
    font-size: 1rem;
}

.hidden {
    display: none !important;
}

.success-message {
    color: #2ecc71;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.error-message {
    color: var(--error-color);
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.auth-prompt {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: var(--text-muted);
}

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

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-area {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-top: 1px solid #333;
    background-color: #1e1e2d;
    position: sticky;
    bottom: 0;
}

    .input-area input {
        flex-grow: 1;
        padding: 0.75rem;
        border-radius: 6px;
        border: none;
        font-size: 1rem;
        background-color: #2a2a3a;
        color: #fff;
        margin-right: 0.5rem;
    }

    .input-area button {
        padding: 0.75rem 1.25rem;
        background-color: #4a6fa5;
        color: white;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        font-weight: bold;
    }

        .input-area button:hover {
            background-color: #3a5a8a;
        }

