body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background-color: #FFFFFF;
    color: #333333;
}

#top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #FFFFFF;
    box-sizing: border-box;
}

#logo {
    height: 40px;
    width: auto;
    max-width: 100%;
}

#chat-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    width: 53.33%;
    margin: 0 auto;
    max-height: calc(100vh - 210px);
    min-height: 200px;
}

.message {
    display: flex;
    margin-bottom: 20px;
}

.message-content {
    background-color: #F3F4F6;
    border-radius: 18px;
    padding: 12px 16px;
    max-width: 100%;
    font-size: 14px;
    line-height: 1.4;
    color: #1F2937;
    white-space: pre-wrap;
    word-break: break-word;
}

.bot-message .message-content {
    font-weight: 500;
}

.user-message .message-content {
    background-color: #FF6B6B;
    color: #FFFFFF;
    margin-left: auto;
    font-weight: 500;
}

.bot-icon {
    width: 30px;
    height: 30px;
    margin-right: 10px;
}

#empty-state-heading {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-size: 25px;
    font-weight: 580;
    color: #000000;
    width: 100%;
    z-index: 1001;
    transition: top 0.3s ease;
}

#user-input {
    width: 53.33%;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    padding: 10px 20px;
    background-color: #FFFFFF;
    box-sizing: border-box;
    position: absolute;
    bottom: 35px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    transition: all 0.3s ease;
}

#user-input.centered {
    position: fixed;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    max-height: 40vh;
}

#message-input-container {
    display: flex;
    align-items: flex-end;
    flex-grow: 1;
    background-color: #F3F4F6;
    border-radius: 24px;
    padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 1003; 
}

#message-input {
    flex-grow: 1;
    border: none;
    background-color: transparent;
    color: #1F2937;
    font-size: 14px;
    font-weight: 500;
    outline: none;
    resize: none;
    overflow-y: auto;
    min-height: 24px;
    max-height: 150px;
    line-height: 1.5;
    transition: height 0.3s ease;
}

#message-input::placeholder {
    color: #9CA3AF;
    font-weight: 400;
}

#send-button {
    background-color: #FF6B6B;
    border: none;
    cursor: pointer;
    margin-left: 10px;
    padding: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    align-self: flex-end;
}

#send-button:hover {
    background-color: #f55656;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
}

#send-button:disabled {
    background-color: #E5E7EB;
    cursor: default;
    box-shadow: none;
}

#send-icon {
    width: 20px;
    height: 20px;
    fill: #FFFFFF;
    transition: fill 0.3s ease;
}

#send-button:disabled #send-icon {
    fill: #9CA3AF;
}

#attachment-label {
    cursor: pointer;
    margin-right: 10px;
    align-self: flex-end;
}

#attachment-icon {
    width: 22px;
    height: 22px;
    fill: #3f4145;
}

#file-upload-progress {
    width: 100%;
    height: 4px;
    background-color: #E5E7EB;
    display: none;
    margin-top: 5px;
}

#file-upload-progress-bar {
    height: 100%;
    background-color: #3B82F6;
    width: 0%;
}

#file-info {
    display: none;
    font-size: 12px;
    color: #1F2937;
    background-color: #F3F4F6;
    padding: 8px;
    border-radius: 4px;
    width: 165px;
    height: auto;
    min-height: 90px;
    max-height: 120px;
    box-sizing: border-box;
    position: absolute;
    left: -174px;
    bottom: -4px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    padding-right: 24px;
    z-index: 1002;
}

#file-info:hover {
    background-color: #E5E7EB;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#file-info::before {
    content: '📎';
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
}

#file-info-close {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #6B7280;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

#file-info-close:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

.download-button-container {
    display: flex;
    justify-content: flex-start;
    margin-top: 10px;
    margin-bottom: 10px;
}

.download-button {
    background-color: #f0f0f0;
    border: 1px solid #d0d0d0;
    color: #333;
    padding: 6px 12px;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s, box-shadow 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: 120px;
    height: 30px;
}

.download-button:hover {
    background-color: #e0e0e0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.download-button:active {
    background-color: #d0d0d0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.download-icon {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    fill: #555;
}

#logout-button {
    background-color: #EF4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
}

.message-content img {
    max-width: 100%;
    height: auto;
    margin-top: 10px;
    border-radius: 8px;
}

#welcome-message {
    font-size: 18px;
    font-weight: bold;
    color: #FF6B6B;
}

/* User menu styles */
.user-menu {
    position: relative;
}

.user-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #000000;
    color: #FFFFFF;
    font-size: 18px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
    text-align: center;
    padding: 0;
    aspect-ratio: 1/1;
    flex-shrink: 0;
}

.user-icon:hover {
    background-color: #333333;
    box-shadow: 0 0 0 2px #3B82F6;
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    background-color: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    min-width: 180px;
    padding: 8px 0;
}

.user-dropdown button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #1F2937;
    transition: background-color 0.3s ease, color 0.3s ease;
    white-space: nowrap;
}

.user-dropdown button:hover {
    background-color: #F3F4F6;
    color: #3B82F6;
}

.user-dropdown button svg {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    fill: currentColor;
}

#clear-history {
    color: #252525;
    border-bottom: 1px solid #E5E7EB;
}

#clear-history:hover {
    background-color: #F3F4F6;
    color: #45B7D1;
}

#clear-history svg {
    fill: #252525;
}

#clear-history:hover svg {
    fill: #45B7D1;
}

#submit-feedback {
    color: #252525;
    border-bottom: 1px solid #E5E7EB;
}

#submit-feedback:hover {
    background-color: #ECFDF5;
    color: #059669;
}

#submit-feedback svg {
    fill: #252525;
}

#submit-feedback:hover svg {
    fill: #059669;
}

#logout {
    color: #252525;
}

#logout:hover {
    background-color: #FEE2E2;
    color: #DC2626;
}

#logout svg {
    fill: #252525;
}

#logout:hover svg {
    fill: #DC2626;
}

/* Loading Overlay styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
  
.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}
  
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.waiting-message {
    font-size: 14px;
    color: #6B7280;
    font-style: italic;
    margin-top: 8px;
    margin-bottom: 16px;
    animation: fade 1.5s infinite alternate;
}

@keyframes fade {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* File attachment */
.file-attachment .message-content {
    display: flex;
    align-items: center;
    background-color: #e6f2ff;
    color: #1a5f7a;
    padding: 14px 18px;
    border-radius: 12px;
    max-width: 320px;
    margin-left: auto;
    box-shadow: 0 2px 4px rgba(26, 95, 122, 0.1);
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

.file-attachment .message-content:hover {
    background-color: #d9ecff;
    box-shadow: 0 4px 8px rgba(26, 95, 122, 0.15);
}

.file-attachment .file-icon {
    font-size: 28px;
    margin-right: 14px;
    color: #2c85b2;
}

.file-attachment .file-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
}

.file-attachment .file-name {
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #0d3f54;
}

.file-attachment .file-size {
    font-size: 12px;
    color: #4d8096;
}

/* Suggestion styles */

.suggestions-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    position: fixed;
    top: 60%;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    z-index: 1002;
    max-height: 150px;
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.98);
    transition: top 0.3s ease;
}

.suggestion-label {
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.suggestion-label:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.suggestion-label svg {
    width: 22px;
    height: 22px;
    margin-right: 10px;
}

/* Colorful icons */
.suggestion-label svg use[*|href="#icon-server"] { fill: #FF6B6B; }
.suggestion-label svg use[*|href="#icon-git-branch"] { fill: #4ECDC4; }
.suggestion-label svg use[*|href="#icon-box"] { fill: #45B7D1; }
.suggestion-label svg use[*|href="#icon-cloud"] { fill: #FFA07A; }
.suggestion-label svg use[*|href="#icon-activity"] { fill: #98D8C8; }

/* Sign In Styles */
#auth-buttons {
    display: flex;
    gap: 10px;
}

.auth-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

#sign-in-button {
    background-color: #FF6B6B;
    color: white;
}

#sign-in-button:hover {
    background-color: #FF5252;
}

#sign-up-button {
    background-color: #000000;
    color: white;
}

#sign-up-button:hover {
    background-color: #342f2f;
}

/* Login Popup Styles */
.login-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000; /* Increased z-index to ensure it's above all other elements */
}

.login-popup-content {
    background-color: #FFFFFF;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative; /* Added to create a new stacking context */
    z-index: 10001; /* Even higher z-index for the content */
}

.login-popup h2 {
    color: #333333;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.login-popup p {
    color: #666666;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.login-popup button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.login-popup button#login-button {
    background-color: #FF6B6B;
    color: white;
    margin-right: 0.5rem;
}

.login-popup button#login-button:hover {
    background-color: #FF5252;
}

.login-popup button#signup-button {
    background-color: #000000;
    color: white;
}

.login-popup button#signup-button:hover {
    background-color: #342f2f;
}

/* Footer styles */
footer {
    text-align: center;
    padding: 5px 0;
    background-color: #FFFFFF;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

footer p {
    margin: 0;
    font-size: 11px;
    color: #6B7280;
}

/* Empty state styles */
body.empty-state #empty-state-heading {
    display: block;
}

body.empty-state #chat-container,
body.empty-state #messages-container {
    display: none;
}

/* Add responsive styles */
@media screen and (max-width: 1024px) {
    #chat-container {
        width: 70%;
        max-height: calc(100vh - 140px);
        margin-bottom: 60px;
    }

    #user-input {
        width: 70%;
        bottom: 20px;
    }

    .suggestions-container {
        width: 70%;
        top: 65%;
    }

    .message-content {
        font-size: 15px;
        padding: 14px 18px;
    }

    .bot-icon {
        width: 28px;
        height: 28px;
    }

    #empty-state-heading {
        font-size: 22px;
        top: 35%;
    }
    .user-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    #file-info {
        left: 0;
        bottom: 100%;
        margin-bottom: 8px;
    }
}

/* Tablets (max-width: 768px) */
@media screen and (max-width: 768px) {
    #top-bar {
        padding: 8px 16px;
    }

    #logo {
        height: 32px;
    }

    #welcome-message {
        font-size: 16px;
    }

    #chat-container {
        width: 85%;
        max-height: calc(100vh - 120px);
        margin-bottom: 50px;
    }

    #user-input {
        width: 85%;
        bottom: 15px;
    }

    .user-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .message-content {
        font-size: 14px;
        padding: 12px 16px;
        max-width: 85%;
    }

    .suggestions-container {
        width: 85%;
        gap: 10px;
        padding: 15px;
        max-height: 120px;
    }

    .suggestion-label {
        font-size: 13px;
        padding: 8px 14px;
    }

    .suggestion-label svg {
        width: 18px;
        height: 18px;
        margin-right: 8px;
    }

    .download-button {
        font-size: 11px;
        padding: 5px 10px;
    }

    #message-input {
        font-size: 14px;
    }

    #send-button {
        padding: 12px;
    }

    #send-icon {
        width: 18px;
        height: 18px;
    }

    .user-dropdown {
        min-width: 160px;
    }

    .user-dropdown button {
        font-size: 13px;
        padding: 8px 14px;
    }
    #file-info {
        left: 0;
        bottom: 100%;
        margin-bottom: 8px;
    }
    #empty-state-heading {
        font-size: 22px;
    } 
}

/* Mobile devices (max-width: 480px) */
@media screen and (max-width: 480px) {
    body {
        display: flex;
        flex-direction: column;
        height: 100vh;
        overflow: hidden; /* Prevent body scroll */
        position: fixed; /* Lock the viewport */
        width: 100%;
    }
    #top-bar {
        flex-shrink: 0; /* Prevent top bar from shrinking */
        position: relative;
        z-index: 1001;
    }

    #logo {
        height: 28px;
    }

    #welcome-message {
        display: none;
    }

    #chat-container {
        flex: 1;
        width: 92%;
        position: absolute;
        top: 60px; /* Adjust based on your top bar height */
        bottom: 150px; /* Space for input + footer */
        left: 50%;
        transform: translateX(-50%);
        overflow-y: auto;
        margin: 0;
        z-index: 1;
    }
    #user-input {
        width: 92%;
        position: fixed;
        bottom: 25px; /* Slightly adjust position */
        padding: 6px 12px;
        left: 50%;
        transform: translateX(-50%);
        margin: 0;
    }
    
    .user-icon {
        width: 32px; /* Maintain same width and height */
        height: 32px;
        font-size: 14px;
        min-width: 32px; /* Ensure minimum width */
        min-height: 32px; /* Ensure minimum height */
    }

    .message-content {
        font-size: 13px;
        padding: 10px 14px;
        max-width: 92%;
    }

    .message {
        margin-bottom: 16px;
    }

    .bot-icon {
        width: 24px;
        height: 24px;
        margin-right: 8px;
    }

    .suggestions-container {
        width: 92%;
        gap: 8px;
        padding: 12px;
        flex-wrap: wrap;
        max-height: 120px;
    }

    .suggestion-label {
        font-size: 11px;
        padding: 6px 10px;
        white-space: nowrap;
    }

    .suggestion-label svg {
        width: 16px;
        height: 16px;
        margin-right: 6px;
    }

    #empty-state-heading {
        font-size: 18px;
        z-index: 1001;
    }

    #message-input {
        font-size: 13px;
        min-height: 20px;
    }

    #send-button {
        padding: 10px;
    }

    #send-icon {
        width: 16px;
        height: 16px;
    }

    .download-button {
        font-size: 10px;
        padding: 4px 8px;
        height: 26px;
    }

    .download-icon {
        width: 14px;
        height: 14px;
        margin-right: 4px;
    }

    .user-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .user-dropdown {
        min-width: 140px;
        right: -5px;
    }

    .user-dropdown button {
        font-size: 12px;
        padding: 6px 12px;
    }

    .user-dropdown button svg {
        width: 14px;
        height: 14px;
    }

    /* Login popup adjustments */
    .login-popup-content {
        padding: 20px;
        width: 85%;
    }

    .login-popup h2 {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .login-popup p {
        font-size: 13px;
        margin-bottom: 16px;
    }

    .login-popup button {
        padding: 8px 16px;
        font-size: 13px;
    }

    /* File attachment adjustments */
    .file-attachment .message-content {
        max-width: 260px;
        padding: 10px 14px;
    }

    .file-attachment .file-icon {
        font-size: 24px;
        margin-right: 10px;
    }

    .file-attachment .file-name {
        font-size: 12px;
    }

    .file-attachment .file-size {
        font-size: 10px;
    }

    /* Auth buttons adjustments */
    #auth-buttons {
        gap: 8px;
        margin-left: auto;
    }

    #sign-in-button,
    #sign-up-button {
        padding: 8px 16px;
        font-size: 13px;
        white-space: nowrap;
    }
    footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: #FFFFFF;
        z-index: 1001;
        padding: 2px 0;
        height: 25px;
    }

    footer p {
        margin: 0;
        font-size: 10px;
    }

    #file-info {
        min-height: 80px;
        font-size: 11px;
        z-index: 1002;
    }
}

/* Small mobile devices (max-width: 360px) */
@media screen and (max-width: 360px) {
    #chat-container {
        width: 95%;
        max-height: calc(100vh - 90px);
        bottom: 80px; 
    }


    #user-input {
        width: 95%;
        bottom: 22px; 
    }

    .user-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
        min-width: 28px;
        min-height: 28px;
    }

    .suggestions-container {
        width: 95%;
        gap: 6px;
        padding: 10px;
        max-height: 120px;
    }

    .suggestion-label {
        font-size: 10px;
        padding: 5px 8px;
    }

    .suggestion-label svg {
        width: 14px;
        height: 14px;
        margin-right: 4px;
    }

    #empty-state-heading {
        font-size: 16px;
    }

    .message-content {
        font-size: 12px;
        padding: 8px 12px;
    }

    .download-button {
        font-size: 9px;
        padding: 3px 6px;
        height: 24px;
    }

    .user-dropdown {
        min-width: 130px;
    }

    .user-dropdown button {
        font-size: 11px;
        padding: 5px 10px;
    }
    #auth-buttons {
        gap: 6px;
    }

    #sign-in-button,
    #sign-up-button {
        padding: 6px 12px;
        font-size: 12px;
    }

    footer {
        padding: 2px 0;
        height: 22px;
    }

    #file-info {
        min-height: 70px;
        font-size: 10px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .suggestion-label,
    .download-button,
    #send-button,
    .user-icon,
    .user-dropdown button {
        min-height: 44px; /* Apple's recommended minimum touch target size */
    }

    .suggestion-label {
        margin: 2px; /* Additional spacing between touch targets */
    }

    #message-input-container {
        min-height: 44px;
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .message-content,
    #message-input {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Ensure proper display in landscape mode */
@media screen and (max-height: 480px) and (orientation: landscape) {
    #chat-container {
        max-height: calc(100vh - 80px);
        margin-bottom: 35px;
    }

    #user-input {
        bottom: 8px;
    }

    .suggestions-container {
        top: 70%;
        max-height: 70px;
    }

    footer {
        padding: 2px 0;
    }
}

/* Better looking scrollbar */
.suggestions-container::-webkit-scrollbar {
    width: 6px;
}

.suggestions-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}