/* --- Base and Layout --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f9f9f9; /* Light grey background for the app */
    color: #333;
    margin: 0;
    padding: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden; /* Prevent body scroll */
}

.app-layout {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100%;
}

/* --- New Sidebar (ChatGPT Style) --- */
.sidebar {
    width: 260px;
    background-color: #202123; /* ChatGPT dark sidebar color */
    color: #ececf1;
    display: flex;
    flex-direction: column;
    padding: 12px;
    flex-shrink: 0;
    border-right: 1px solid #3a3a3a;
}

.new-chat-button {
    background-color: transparent;
    border: 1px solid #555;
    color: #fff;
    padding: 12px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.new-chat-button:hover {
    background-color: #2a2b32;
}

.chat-logs {
    flex-grow: 1; /* Pushes list to top and footer to bottom */
    overflow-y: auto; /* Allows history to scroll */
    margin-top: 20px;
}

.chat-logs h3 {
    color: #8e8e8e;
    font-size: 0.8rem;
    text-transform: uppercase;
    padding: 0 10px;
    margin-bottom: 8px;
}

.chat-logs ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chat-logs li a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: #ececf1;
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.2s;
}

.chat-logs li a:hover {
    background-color: #2a2b32;
}

/* --- Main Chat Container (Right Panel) --- */
.chat-container {
    flex: 1; /* Takes up remaining space */
    display: flex;
    flex-direction: column;
    background-color: #ffffff; /* Light mode chat area */
    height: 100vh;
    height: 100dvh;
    /* Remove old centering styles */
    max-width: none;
    border-radius: 0;
    box-shadow: none;
    /* Safe Area Insets for mobile */
    padding-top: constant(safe-area-inset-top);
    padding-top: env(safe-area-inset-top);
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
}

.chat-header {
    background-color: #ffffff;
    color: #333;
    padding: 15px 20px;
    text-align: left; /* Changed from center */
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0; /* Prevents header from shrinking */
}

/* --- Centered Chat Messages --- */
.chat-messages-wrapper {
    flex: 1; /* This is the new scrolling container */
    overflow-y: auto;
    padding: 20px;
}

.chat-messages {
    max-width: 768px; /* Centers content */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    padding: 12px 18px;
    border-radius: 18px;
    max-width: 85%;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.user {
    background-color: #d1eaff; /* Light blue for user */
    color: #333;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.bot {
    background-color: #f3f4f6; /* Light gray for bot (ChatGPT style) */
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* --- Centered Input Form --- */
.chat-input-wrapper {
    padding: 20px;
    width: 100%;
    background-color: #ffffff;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0; /* Prevents input from shrinking */
    box-sizing: border-box; /* Ensures padding is included */
    /* Safe area for mobile input */
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.chat-input-form {
    max-width: 768px; /* Match messages width */
    margin: 0 auto;
    display: flex;
    align-items: center; /* Aligns items in the middle vertically */
    gap: 10px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 12px;
}

#user-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none; /* Disables manual resize */
    font-size: 1rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 8px;
    background: transparent;
    max-height: 200px; /* Prevents it from growing too tall */
}

.icon-button {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.icon-button:hover {
    color: #333;
}

#send-button {
    width: 36px;
    height: 36px;
    border: none;
    background-color: #1e3a8a; /* Your primary blue */
    color: white;
    border-radius: 8px; /* Square-ish button */
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
}

#send-button:hover {
    background-color: #1d4ed8;
}

.footer-text {
    font-size: 0.75rem;
    color: #888;
    text-align: center;
    margin-top: 10px;
}

/* --- Responsiveness --- */
@media (max-width: 768px) {
    .sidebar {
        display: none; /* Hide sidebar on mobile */
    }

    .chat-container {
        /* Ensure it takes full width/height */
        width: 100%;
        height: 100dvh;
    }
    
    .chat-messages-wrapper,
    .chat-input-wrapper {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Remove centering and border from input form on mobile */
    .chat-input-form {
        max-width: 100%;
        margin: 0;
        border: none;
        border-radius: 0;
        border-top: 1px solid #e0e0e0;
        padding-left: 5px;
        padding-right: 5px;
    }

    .chat-input-wrapper {
        padding: 0; /* Let the form handle its own padding */
        border-top: none;
    }
}

/* --- NEW: Sidebar Footer Styles --- */
.sidebar-footer {
    padding: 15px 10px;
    border-top: 1px solid #3a3a3a; /* Separator line */
    flex-shrink: 0; /* Prevents footer from shrinking */
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
}

.social-links a {
    color: #8e8e8e; /* Muted icon color */
    font-size: 1.2rem;
    transition: color 0.2s;
}

.social-links a:hover {
    color: #ececf1; /* Brighter on hover */
}

.profile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    color: #ececf1;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background-color 0.2s;
}

.profile-link:hover {
    background-color: #2a2b32;
}

.profile-link i {
    font-size: 1.4rem;
}    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.new-chat-button:hover {
    background-color: #2a2b32;
}

.chat-logs {
    flex-grow: 1; /* Pushes list to top */
    overflow-y: auto; /* Allows history to scroll */
    margin-top: 20px;
}

.chat-logs h3 {
    color: #8e8e8e;
    font-size: 0.8rem;
    text-transform: uppercase;
    padding: 0 10px;
    margin-bottom: 8px;
}

.chat-logs ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chat-logs li a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: #ececf1;
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.2s;
}

.chat-logs li a:hover {
    background-color: #2a2b32;
}

/* --- Main Chat Container (Right Panel) --- */
.chat-container {
    flex: 1; /* Takes up remaining space */
    display: flex;
    flex-direction: column;
    background-color: #ffffff; /* Light mode chat area */
    height: 100vh;
    height: 100dvh;
    /* Remove old centering styles */
    max-width: none;
    border-radius: 0;
    box-shadow: none;
    /* Safe Area Insets for mobile */
    padding-top: constant(safe-area-inset-top);
    padding-top: env(safe-area-inset-top);
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
}

.chat-header {
    background-color: #ffffff;
    color: #333;
    padding: 15px 20px;
    text-align: left; /* Changed from center */
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0; /* Prevents header from shrinking */
}

/* --- Centered Chat Messages --- */
.chat-messages-wrapper {
    flex: 1; /* This is the new scrolling container */
    overflow-y: auto;
    padding: 20px;
}

.chat-messages {
    max-width: 768px; /* Centers content */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    padding: 12px 18px;
    border-radius: 18px;
    max-width: 85%;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.user {
    background-color: #d1eaff; /* Light blue for user */
    color: #333;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.bot {
    background-color: #f3f4f6; /* Light gray for bot (ChatGPT style) */
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* --- Centered Input Form --- */
.chat-input-wrapper {
    padding: 20px;
    width: 100%;
    background-color: #ffffff;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0; /* Prevents input from shrinking */
    box-sizing: border-box; /* Ensures padding is included */
    /* Safe area for mobile input */
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.chat-input-form {
    max-width: 768px; /* Match messages width */
    margin: 0 auto;
    display: flex;
    align-items: center; /* Aligns items in the middle vertically */
    gap: 10px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 12px;
}

#user-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none; /* Disables manual resize */
    font-size: 1rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 8px;
    background: transparent;
    max-height: 200px; /* Prevents it from growing too tall */
}

.icon-button {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.icon-button:hover {
    color: #333;
}

#send-button {
    width: 36px;
    height: 36px;
    border: none;
    background-color: #1e3a8a; /* Your primary blue */
    color: white;
    border-radius: 8px; /* Square-ish button */
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
}

#send-button:hover {
    background-color: #1d4ed8;
}

.footer-text {
    font-size: 0.75rem;
    color: #888;
    text-align: center;
    margin-top: 10px;
}

/* --- Responsiveness --- */
@media (max-width: 768px) {
    .sidebar {
        display: none; /* Hide sidebar on mobile */
    }

    .chat-container {
        /* Ensure it takes full width/height */
        width: 100%;
        height: 100dvh;
    }
    
    .chat-messages-wrapper,
    .chat-input-wrapper {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Remove centering and border from input form on mobile */
    .chat-input-form {
        max-width: 100%;
        margin: 0;
        border: none;
        border-radius: 0;
        border-top: 1px solid #e0e0e0;
        padding-left: 5px;
        padding-right: 5px;
    }

    .chat-input-wrapper {
        padding: 0; /* Let the form handle its own padding */
        border-top: none;
    }
        }

/* ... existing styles ... */

.icon-button:hover {
    color: #333;
}

/* --- NEW: Voice Recording State --- */
.icon-button.recording {
    color: white;
    background-color: #dc3545; /* Red for recording */
    border-radius: 50%;
    padding: 8px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* ... rest of the existing styles ... */



