/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Google Sans', Arial, sans-serif;
    background-color: #f8f9fa;
    color: #202124;
    line-height: 1.6;
}

.container {
    display: block;
    height: 100vh;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* Sidebar styles */
.sidebar {
    width: 280px;
    background-color: #ffffff;
    border-right: 1px solid #dadce0;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    height: calc(100vh - 120px); /* Adjust for header and footer */
    position: fixed;
    left: 0;
    top: 60px; /* Position below header */
    z-index: 100;
    overflow-y: auto;
}

/* Sidebar mobile overlay */
.sidebar-mobile-overlay {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-header {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #dadce0;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    width: 32px;
    height: 32px;
    margin-right: 8px;
}

.logo span {
    font-size: 18px;
    font-weight: 500;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #5f6368;
}

.mobile-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: #5f6368;
    cursor: pointer;
    font-size: 20px;
    margin-right: 10px;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.mobile-sidebar-toggle:hover {
    background-color: #f1f3f4;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    background-color: #e8f0fe;
    color: #1a73e8;
    border: 1px solid #d2e3fc;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    transition: background-color 0.2s;
    text-decoration: none;
    text-align: center;
}

.new-chat-btn:hover {
    background-color: #d2e3fc;
}

.new-chat-btn i {
    margin-right: 8px;
}

.conversations-list {
    margin-top: 16px;
}

.conversation-item {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s;
}

.conversation-content {
    display: flex;
    align-items: center;
    flex: 1;
    overflow: hidden;
}

.delete-conversation {
    background: none;
    border: none;
    color: #5f6368;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.5;
    transition: all 0.2s;
    display: none;
}

.conversation-item:hover .delete-conversation {
    display: block;
}

.delete-conversation:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.05);
    color: #ea4335;
}

.conversation-item:hover {
    background-color: #f1f3f4;
}

.conversation-item.active {
    background-color: #e8f0fe;
    color: #1a73e8;
}

.conversation-item i {
    margin-right: 12px;
    color: #5f6368;
}

.conversation-item.active i {
    color: #1a73e8;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #dadce0;
}

.user-profile {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
}

.user-profile:hover {
    background-color: #f1f3f4;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 12px;
    overflow: hidden;
    background-color: #1a73e8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-initials {
    color: white;
    font-weight: 500;
    font-size: 16px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
}

.user-email {
    font-size: 12px;
    color: #5f6368;
}

.sidebar-menu {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
}

.sidebar-menu a {
    padding: 8px 12px;
    color: #5f6368;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: background-color 0.2s;
}

.sidebar-menu a:hover {
    background-color: #f1f3f4;
}

.sidebar-menu a i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

.auth-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.guest-profile {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #dadce0;
}

.guest-message {
    padding: 8px 12px;
    margin-bottom: 16px;
    background-color: #f1f3f4;
    border-radius: 8px;
    font-size: 13px;
    color: #5f6368;
}

.btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #1a73e8;
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: #1765cc;
}

.btn-outline {
    background-color: transparent;
    color: #1a73e8;
    border: 1px solid #1a73e8;
}

.btn-outline:hover {
    background-color: #e8f0fe;
}

/* Main content styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px); /* Adjust for header and footer */
    margin-left: 280px;
    width: calc(100% - 280px);
    position: absolute;
    left: 0;
    top: 60px; /* Position below header */
}

.main-header {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #dadce0;
    background-color: #ffffff;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-left h1 {
    font-size: 20px;
    font-weight: 500;
    color: #202124;
    margin: 0;
}

.site-logo {
    display: flex;
    align-items: center;
}

.site-logo img {
    max-height: 40px;
    max-width: 200px;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-selector label {
    font-size: 14px;
    color: #5f6368;
    font-weight: 500;
}

.model-selector select {
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid #dadce0;
    background-color: #f8f9fa;
    font-size: 14px;
    color: #202124;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.model-selector select:hover {
    background-color: #f1f3f4;
    border-color: #d2d5d9;
}

.model-selector select:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

/* Chat container styles */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow: hidden;
    height: calc(100vh - 65px);
    position: relative;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.welcome-message {
    text-align: center;
    margin: auto;
    max-width: 600px;
}

.welcome-message h1 {
    font-size: 32px;
    margin-bottom: 16px;
    color: #1a73e8;
}

.welcome-message p {
    font-size: 16px;
    color: #5f6368;
}

.message {
    display: flex;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
    align-items: flex-start;
    gap: 8px;
}

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

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

.message-assistant {
    justify-content: flex-start;
}

.message-bubble {
    position: relative;
    max-width: 70%;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
}

.message-content {
    width: 100%;
    font-size: 14px;
    line-height: 1.5;
}

.message-user .message-bubble {
    background-color: #e8f0fe;
    color: #1a73e8;
    border-top-right-radius: 4px;
}

.message-assistant .message-bubble {
    background-color: #f1f3f4;
    color: #202124;
    border-top-left-radius: 4px;
}

.message-predefined .message-bubble {
    background-color: #f1f3f4;
    color: #202124;
    border-top-left-radius: 4px;
    /* Removed the blue border and color to make it look like a regular message */
}

.message-badge {
    font-size: 10px;
    color: #5f6368;
    margin-top: 4px;
    margin-left: 12px;
    font-weight: 500;
}

.message-error .message-content {
    background-color: #fce8e6;
    color: #d93025;
    border-top-left-radius: 4px;
    border-left: 3px solid #d93025;
}

.error-badge {
    color: #d93025;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    width: fit-content;
    animation: fadeIn 0.3s ease;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #5f6368;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    opacity: 0.4;
}

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

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

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

@keyframes typing {
    0% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.4; transform: scale(1); }
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #5f6368;
    font-size: 14px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.loading::before {
    content: '';
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 2px solid #dadce0;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.chat-input-container {
    padding: 16px;
    background-color: #ffffff;
    border-top: 1px solid #dadce0;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    background-color: #f1f3f4;
    border-radius: 24px;
    padding: 8px 16px;
    transition: box-shadow 0.2s;
}

.chat-input-wrapper:focus-within {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    background-color: #ffffff;
    border: 1px solid #dadce0;
}

#chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    resize: none;
    max-height: 200px;
    padding: 8px 0;
    outline: none;
    font-family: inherit;
}

#send-button {
    background: none;
    border: none;
    color: #1a73e8;
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    margin-left: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

#send-button:hover {
    background-color: #e8f0fe;
}

#send-button:disabled {
    color: #dadce0;
    cursor: not-allowed;
}

/* Responsive styles */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        z-index: 100;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
        transition: left 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar.active + .sidebar-mobile-overlay {
        display: none !important;
        opacity: 1;
    }

    .sidebar-toggle {
        display: block;
    }

    .mobile-sidebar-toggle {
        display: block;
        position: absolute;
        left: 10px;
        top: 10px;
        z-index: 90;
    }

    .main-content {
        width: 100% !important;
        margin-left: 0 !important;
        padding-left: 10px;
        padding-right: 10px;
    }

    .main-header {
        padding: 12px;
        padding-left: 40px; /* Make room for the mobile sidebar toggle */
    }

    .message-content {
        max-width: 85%;
    }

    /* Adjust container for mobile */
    .container {
        position: relative;
        display: block;
    }

    /* Adjust auth buttons for mobile */
    .auth-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .auth-buttons .btn {
        width: 100%;
        text-align: center;
    }
}