:root {
    --bg-color: #ffffff;
    --text-color: #374151;
    /* Gray 700 */
    --primary-color: #10a37f;
    /* ChatGPT Green ish */
    --secondary-color: #6b7280;
    /* Gray 500 */
    --card-bg: #f9fafb;
    /* Gray 50 */
    --border-color: #e5e7eb;
    /* Gray 200 */
    --accent-color: #10a37f;

    --user-msg-bg: #f3f4f6;
    /* Gray 100 */
    --user-msg-text: #1f2937;

    --agent-msg-bg: transparent;
    --agent-msg-text: #111827;

    --tool-msg-bg: #eff6ff;
    /* Blue 50 */
    --thinking-msg-bg: #fdf2f8;
    /* Pink 50 or similar light */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #0d8a6a;
}

.container {
    max-width: 800px;
    /* ChatGPT style is often centered and contained */
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Auth Page */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: 8px;
    /* Softer radius */
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #111827;
    font-weight: 700;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

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

.btn:hover {
    background: #0d8a6a;
}

.error-msg {
    color: #ef4444;
    text-align: center;
    margin-bottom: 1rem;
    background: #fef2f2;
    padding: 10px;
    border-radius: 6px;
}

/* Chat List */
.room-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0;
}

.room-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.2s;
    cursor: pointer;
    display: block;
}

.room-card:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.room-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #111827;
}

.room-meta {
    color: var(--secondary-color);
    font-size: 0.85rem;
}

/* Chat History */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    /* More spacing like ChatGPT */
    padding-bottom: 4rem;
}

.message-row {
    display: flex;
    width: 100%;
    gap: 1rem;
}

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

.message-row.other {
    justify-content: flex-start;
}

/* ChatGPT Style: 
   User: Bubble, Right.
   Others: No visible bubble (or subtle), Left, with Icon.
*/

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    /* ChatGPT style squared rounded */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    flex-shrink: 0;
}

.avatar.user {
    background: #ab68ff;
    color: white;
    display: none;
    /* Often user has no avatar in right bubble mode */
}

.avatar.agent {
    background: #10a37f;
    color: white;
}

.avatar.system {
    background: #6b7280;
    color: white;
}

.avatar.tool {
    background: #f59e0b;
    color: white;
}

.avatar.thinking {
    background: #8b5cf6;
    color: white;
}

.message-bubble {
    max-width: 80%;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    line-height: 1.6;
    position: relative;
    font-size: 1rem;
}

.message-row.user .message-bubble {
    background: var(--user-msg-bg);
    color: var(--user-msg-text);
    border-bottom-right-radius: 4px;
}

.message-row.other .message-bubble {
    background: transparent;
    color: var(--agent-msg-text);
    padding: 0;
    /* Remove padding for non-bubble look */
    max-width: 90%;
}

.type-tool .message-bubble {
    font-family: monospace;
    background: var(--tool-msg-bg) !important;
    padding: 1rem !important;
    border-radius: 8px !important;
    color: #1e3a8a !important;
}

.type-thinking .message-bubble {
    color: #6b7280 !important;
    font-style: italic;
}

.message-meta {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: #374151;
}

.timestamp {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 4px;
    display: block;
}

/* Header */
header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 700;
    font-size: 1.2rem;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo::before {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 4px;
}

.logout-btn {
    background: transparent;
    color: var(--secondary-color);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.logout-btn:hover {
    background: #f3f4f6;
    color: #111827;
}