body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #f0f2f5;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #333;
    color: #fff;
    padding: 20px 40px;
    text-align: center;
}

header h1 {
    margin: 0 0 10px 0;
    font-size: 2em;
}

.intro-text {
    font-size: 0.9em;
    color: #ccc;
    max-width: 700px;
    margin: 0 auto;
}

/* Mobile header adjustments */
@media (max-width: 768px) {
    header {
        padding: 10px 20px;
    }
    
    header h1 {
        font-size: 1.5em;
        margin-bottom: 5px;
    }
    
    .intro-text {
        font-size: 0.8em;
        display: none; /* Hide the long description on mobile */
    }
}

.container {
    display: flex;
    width: 95%;
    max-width: 1000px;
    height: 75vh;
    max-height: 650px;
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    margin: 20px auto;
    flex-grow: 1;
    position: relative;
}

/* Mobile container adjustments */
@media (max-width: 768px) {
    .container {
        width: 100%;
        height: calc(100vh - 120px); /* Adjust for smaller header */
        max-height: none;
        margin: 10px auto;
        border-radius: 0;
        box-shadow: none;
    }
}

.sidebar {
    width: 280px;
    background-color: #f8f9fa;
    padding: 20px;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.sidebar h2 {
    margin: 0;
    font-size: 1.1em;
    color: #555;
}

.close-sidebar-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5em;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.close-sidebar-btn:hover {
    background-color: #e9ecef;
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-around;
    width: 40px;
    height: 40px;
}

.hamburger-line {
    width: 24px;
    height: 3px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Mobile styles */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 280px;
        z-index: 1000;
        transform: translateX(-100%);
        border-right: none;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .close-sidebar-btn {
        display: block;
    }
    
    .chat-area {
        width: 100%;
    }
    
    /* Mobile chat adjustments */
    #chat-log {
        padding: 15px;
    }
    
    .message {
        max-width: 85%;
        font-size: 0.9em;
        padding: 10px 15px;
    }
    
    .chat-input-container {
        padding: 10px 15px;
    }
    
    #user-input {
        margin: 0 5px;
        padding: 10px 12px;
    }
    
    .icon-button {
        font-size: 1.3em;
        padding: 3px;
        margin: 0 2px;
    }
    
    #send-button {
        padding: 8px 15px;
        font-size: 0.9em;
    }
    
    /* Hide footer on mobile to save space */
    footer {
        display: none;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .sidebar {
        width: 260px;
    }
    
    .message {
        max-width: 90%;
        font-size: 0.85em;
        padding: 8px 12px;
    }
    
    .chat-input-container {
        padding: 8px 10px;
    }
    
    .icon-button {
        font-size: 1.2em;
    }
    
    #send-button {
        padding: 6px 12px;
        font-size: 0.85em;
    }
}

.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

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

.new-chat-btn:active {
    transform: translateY(1px);
}

#conversation-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#conversation-list li {
    padding: 12px 8px; /* Adjusted padding */
    cursor: pointer; 
    border-bottom: 1px solid #e7e7e7;
    font-size: 0.9em;
    color: #444;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.2s ease;
    border-radius: 4px;
    margin-bottom: 2px;
}

#conversation-list li:hover {
    background-color: #e9ecef;
}

#conversation-list li.active {
    background-color: #007bff;
    color: white;
}

#conversation-list li.active:hover {
    background-color: #0056b3;
}

#conversation-list li:last-child {
    border-bottom: none;
}

.chat-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: #ffffff; /* Ensure chat area background is white */
}

#chat-log {
    flex-grow: 1;
    overflow-y: auto;
    padding: 25px; /* Increased padding */
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 15px; /* Increased margin */
    padding: 12px 18px; /* Adjusted padding */
    border-radius: 20px; /* More rounded corners */
    max-width: 70%; /* Slightly narrower messages */
    line-height: 1.5;
    word-wrap: break-word;
    font-size: 0.95em;
}

.user-message {
    background-color: #007bff;
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 6px;
}

.bot-message {
    background-color: #e9ecef;
    color: #212529;
    align-self: flex-start;
    margin-right: auto;
    border-bottom-left-radius: 6px;
}

.chat-input-container {
    display: flex;
    align-items: center; /* Vertically align items */
    padding: 15px 25px; /* Adjusted padding */
    border-top: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

#user-input {
    flex-grow: 1;
    padding: 12px 15px; /* Adjusted padding */
    border: 1px solid #ced4da;
    border-radius: 22px; /* More rounded input field */
    margin: 0 10px; /* Margin around input */
    font-size: 1em;
    background-color: #fff; /* Ensure input field is white */
}

#user-input:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.icon-button {
    background: none;
    border: none;
    font-size: 1.5em; /* Larger icons */
    color: #555;
    cursor: pointer;
    padding: 5px;
    margin: 0 3px; /* Spacing for icon buttons */
    transition: color 0.2s ease;
}

.icon-button:hover {
    color: #007bff;
}

#send-button {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 22px; /* Match input field rounding */
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
    margin-left: 5px; /* Space before send button */
}

#send-button:hover {
    background-color: #0056b3;
}

#send-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

footer {
    background-color: #333;
    color: #aaa;
    padding: 15px 40px;
    text-align: center;
    font-size: 0.8em;
}

.disclaimer {
    max-width: 800px;
    margin: 0 auto;
}

/* Scrollbar styling */
#chat-log::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 8px; /* Slightly thicker scrollbar */
}

#chat-log::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#chat-log::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

#chat-log::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}
