/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Arial", sans-serif;
}

/* Layout */
body {
    display: flex;
    height: 100vh;
    background: #121212;
    color: #e0e0e0;
    overflow: hidden; /* Prevent body scroll */
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #1e1e1e;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease; /* Smooth sidebar toggle */
}

.sidebar h2 {
    font-size: 18px;
    text-align: center;
    color: #ffffff;
    margin-bottom: 10px;
}

/* Chat Tabs */
#chat-history {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-tab {
    background: #292929;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.chat-tab:hover {
    background: #3a3a3a;
    transform: translateX(5px); /* Slight hover effect */
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #222;
    height: 100vh;
    overflow: hidden; /* Prevent container overflow */
}

/* Header */
.chat-header {
    text-align: center;
    padding: 15px;
    background: #181818;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Add shadow for depth */
}

/* Chat Messages (Scrollable) */
#chat-box {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px; /* Add gap between messages */
    max-height: calc(100vh - 150px);
    scroll-behavior: smooth; /* Smooth scrolling */
}

/* Messages */
.user-message, .bot-message {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    max-width: 70%;
    font-size: 16px; /* Slightly smaller font for better readability */
    line-height: 1.5; /* Improve line spacing */
    word-wrap: break-word; /* Prevent text overflow */
}

.user-message {
    background: #10a37f;
    color: white;
    align-self: flex-end;
    animation: fadeIn 0.3s ease; /* Fade-in animation */
}

.bot-message {
    background: #ececec;
    color: black;
    align-self: flex-start;
    animation: fadeIn 0.3s ease; /* Fade-in animation */
}

/* Fade-in animation for messages */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* "Read" Button */
.read-btn {
    background: #007BFF;
    color: white;
    border: none;
    padding: 5px 10px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 5px;
    margin-top: 5px;
    transition: background 0.3s;
}

.read-btn:hover {
    background: #005bb5; /* Darker hover state */
}

/* Input Section (Fixed ChatGPT Style) */
.input-area {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #2b2b2b;
    position: fixed;
    bottom: 20px;
    width: 55%;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 20px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
    transition: width 0.3s ease; /* Responsive width adjustment */
}

/* Responsive input area */
@media (max-width: 768px) {
    .input-area {
        width: 90%; /* Wider on smaller screens */
    }
}

input[type="text"] {
    flex-grow: 1;
    padding: 12px;
    font-size: 16px;
    border: none;
    border-radius: 15px;
    outline: none;
    margin: 0 10px;
    background: #121212;
    color: white;
    transition: box-shadow 0.3s;
}

input[type="text"]:focus {
    box-shadow: 0 0 0 2px #10a37f; /* Highlight focus state */
}

/* Buttons */
button {
    background: #10a37f;
    color: white;
    border: none;
    padding: 10px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s, transform 0.2s;
}

button:hover {
    background: #0d8266;
    transform: scale(1.05); /* Slight hover scaling */
}

/* File Button */
.file-btn {
    cursor: pointer;
    transition: opacity 0.3s;
}

.file-btn:hover {
    opacity: 0.8; /* Subtle hover effect */
}

/* Hide Default File Input */
.hidden {
    display: none;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1e1e1e;
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Sidebar Toggle Button */
#toggle-sidebar {
    display: none; /* Hidden by default */
    background: #10a37f;
    color: white;
    border: none;
    padding: 10px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    margin-left: 10px;
    transition: background 0.3s;
}

#toggle-sidebar:hover {
    background: #0d8266;
}

/* Responsive Sidebar */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%); /* Hide sidebar by default */
        z-index: 1000;
    }

    .sidebar.active {
        transform: translateX(0); /* Show sidebar when active */
    }

    #toggle-sidebar {
        display: block; /* Show toggle button on smaller screens */
    }

    .chat-container {
        margin-left: 0; /* Reset margin when sidebar is hidden */
    }
}