/* Add these at the very top of the file */
:root {
    background: #202123;
}

body {
    margin: 0;
    padding: 0;
    background: #202123;
    min-height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background: #343541;
    color: #ececf1;
    overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    margin-right: 0;
    padding: 8px;
    box-sizing: border-box;
    background-color: #202123;
    border-right: 1px solid #2a2b32;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 20px 12px 20px;
    border-bottom: 1px solid #2a2b32;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    color: #ececf1;
    margin: 0;
    font-weight: 600;
}

.chat-list {
    list-style: none;
    padding: 0 0 0 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 12px 20px;
    cursor: pointer;
    background-color: transparent;
    color: #ececf1;
    border-radius: 8px;
    margin: 0 8px 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
    font-size: 1rem;
}

.chat-item.selected,
.chat-item:hover {
    background-color: #353740;
}

.chat-name {
    flex-grow: 1;
    margin-right: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delete-chat-button {
    opacity: 0;
    background: none;
    border: none;
    color: #888;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: opacity 0.2s, color 0.2s;
}

.chat-item:hover .delete-chat-button {
    opacity: 1;
}

.delete-chat-button:hover {
    color: #ff5c5c;
}

.new-chat-form {
    padding: 16px 20px 20px 20px;
    border-top: 1px solid #2a2b32;
    background: #202123;
}

.new-chat-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #353740;
    margin-bottom: 10px;
    box-sizing: border-box;
    background: #353740;
    color: #ececf1;
    font-size: 1rem;
}

.new-chat-input::placeholder {
    color: #888;
}

.new-chat-button {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: #444654;
    color: #ececf1;
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
    transition: background 0.15s;
}

.new-chat-button:hover {
    background: #565869;
}

.sidebar-new-chat {
    width: calc(100% - 16px);
    margin: 8px;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid #565869;
    border-radius: 6px;
    color: #ececf1;
    display: flex;
    align-items: center;
    font-size: 14px;
}

/* --- Chat Container --- */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.chat-header {
    text-align: center;
    color: #ececf1;
    margin-bottom: 1rem;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 120px; /* Space for input form */
    background: #343541;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    width: 100%;
    border-bottom: 1px solid rgba(32,33,35,0.5);
    padding: 24px 0;
    background: transparent;
}

.message.user {
    background: transparent;
}

.message.assistant {
    background: #444654;
}

.message-content {
    max-width: 768px;
    margin: 0 auto;
    padding: 24px 200px;
    color: #ececf1;
    font-size: 16px;
    line-height: 1.5;
}

/* --- Message Form --- */
.message-form {
    position: fixed;
    bottom: 0;
    left: 260px; /* sidebar width */
    right: 0;
    padding: 24px 0;
    background: linear-gradient(180deg, rgba(53,53,65,0) 0%, #353541 30%);
    border-top: 1px solid #2a2b32;
    display: flex;
    justify-content: center;
}

.message-form form {
    width: 100%;
    max-width: 768px;
    padding: 0 200px;
    display: flex;
    gap: 12px;
}

.message-input {
    flex-grow: 1;
    background: #40414f;
    border: 1px solid rgba(32,33,35,0.5);
    border-radius: 6px;
    color: #ececf1;
    font-size: 16px;
    line-height: 1.5;
    padding: 12px 16px;
    margin: 0;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

.message-button {
    padding: 12px 16px;
    background: #40414f;
    border: 1px solid rgba(32,33,35,0.5);
    border-radius: 6px;
    color: #ececf1;
    font-size: 14px;
    transition: background 0.2s;
}

.message-button:hover:not(:disabled) {
    background: #2a2b32;
}

/* --- Smooth scrolling & thin scrollbars --- */
.messages-container,
.chat-list {
    scroll-behavior: smooth;
}

.messages-container::-webkit-scrollbar,
.chat-list::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-thumb,
.chat-list::-webkit-scrollbar-thumb {
    background: #565869;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover,
.chat-list::-webkit-scrollbar-thumb:hover {
    background: #6b6d7a;
}

/* Firefox */
.messages-container,
.chat-list {
    scrollbar-width: thin;
    scrollbar-color: #565869 transparent;
}

/* --- Focus & hover polish --- */
.new-chat-input:focus,
.message-input:focus {
    border: 1.5px solid #007aff;
    box-shadow: 0 0 0 2px rgba(0,122,255,0.25);
}

.new-chat-button:hover,
.message-button:hover:not(:disabled) {
    filter: brightness(1.1);
}

.message-button:focus-visible,
.new-chat-button:focus-visible {
    outline: 2px solid #007aff;
    outline-offset: 2px;
}

/* Subtle fade for message container edges (ChatGPT-like) */
.messages-container::after {
    content: '';
    position: sticky;
    bottom: 0;
    height: 48px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(52,53,65,0) 0%, #343541 100%);
}

/* --- Landing Page --- */
.landing-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    background: #343541;
}

.landing-content {
    padding: 24px 200px;
    max-width: 768px;
    margin: 0 auto;
    width: 100%;
}

.landing-content h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #ececf1;
    font-weight: 600;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 40px;
    padding: 0 20px;
}

.example-card {
    background: #40414f;
    border: 1px solid #565869;
    border-radius: 8px;
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #ececf1;
    width: 100%;
}

.example-card:hover {
    background: #2a2b32;
}

.example-emoji {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.example-text {
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Refine existing message styles */
.message.assistant {
    padding: 24px 48px;
    background: #444654;
    margin: 0;
    border-bottom: 1px solid #2a2b32;
}

.message.user {
    padding: 24px 48px;
    background: #343541;
    margin: 0;
    border-bottom: 1px solid #2a2b32;
}

.message-content {
    background: transparent;
    box-shadow: none;
    padding: 0;
    max-width: 768px;
    margin: 0 auto;
}

.message.assistant .message-content,
.message.user .message-content {
    border-radius: 0;
    background: transparent;
}
