:root {
    --bg: #ffffff;
    --muted: #6b7280;
    --text: #0f172a;
    --accent-start: #10a37f;
    --accent-end: #0e9274;
    --sidebar-bg: #fcfcfc;
    --sidebar-hover: #f3f4f6;
    --border: rgba(15,23,42,0.06);
}

/* Reset */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; }
body { background: var(--bg); color: var(--text); display: flex; overflow: hidden; }
a { text-decoration: none; color: inherit; }

/* SIDEBAR */
.sidebar {
    position: relative;
    width: 260px;
    height: 100%;
    background: var(--sidebar-bg);
    padding: 12px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 12px 20px 12px; }
.logo-openai { display: flex; align-items: center; gap: 8px; }
.logo-openai svg { width: 28px; height: 28px; color: #202123; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.new-chat-btn, .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    color: #4b5563;
    transition: background 0.2s, color 0.2s;
}

.new-chat-btn:hover, .sidebar-toggle:hover {
    background-color: #e5e7eb;
    color: #0f172a;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; margin-bottom: 24px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: #0f172a; font-size: 14px; transition: background 0.2s; border: none; background: transparent; width: 100%; text-align: left; }
.nav-item:hover { background: #ececec; }

/* NEW SIDEBAR SECTIONS */
.sidebar-sections {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
}

.section-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: #0f172a;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.section-group:hover {
    background: #ececec;
}

.section-arrow {
    color: #9ca3af;
    display: flex;
    align-items: center;
}

/* NEW SIDEBAR BOTTOM (User Profile) */
.sidebar-bottom {
    margin-top: auto; /* Pushes to bottom */
    padding-top: 12px;
    /* border-top: 1px solid var(--border); Optional, clean without it */
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.user-profile:hover {
    background: #ececec;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    background-color: #f5c518; /* Yellow/Gold-ish for CH */
    color: #333;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-plan {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 4px;
    width: fit-content;
    margin-top: 2px;
}

/* MAIN */
.main {
    flex: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: white;
}

.top-right-buttons {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    z-index: 10;
}

.pill-small {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    background: #f3f4f6;
    color: #4b5563;
    transition: background 0.2s;
}
.pill-small:hover { background: #e5e7eb; }

/* CHAT WINDOW */
.chat-window {
    flex: 1;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 40px;
    display: none; /* Hidden initially */
    scroll-behavior: smooth;
}

/* PROMPT AREA */
.prompt-wrap {
    width: 100%;
    max-width: 800px;
    margin: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-bottom: 40px;
    transition: all 0.3s ease;
}

.prompt-title-outside {
    font-size: 32px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 32px;
    color: #000;
}

/* INPUT PILL */
.input-pill {
    width: 100%;
    background: #f4f4f5; /* Light gray pill */
    border-radius: 26px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    position: relative;
}

.input-pill:focus-within {
    background: #fff;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
    border: 1px solid #e5e5e5;
}

#user-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    min-width: 0;
    resize: none;
}

#user-input::placeholder {
    color: var(--muted);
    opacity: 1;
}

.input-action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}
.input-action-btn:hover { background: rgba(0,0,0,0.05); color: var(--text); }
.input-action-btn svg { width: 20px; height: 20px; stroke-width: 2; }

/* SUGGESTIONS */
.suggestion-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.suggestion-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 14px;
    background: white;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    color: var(--text);
    transition: all 0.2s ease;
}
.suggestion-pill:hover { background: #f9fafb; border-color: #d1d5db; }

/* ATTACH DROPDOWN */
.attach-container { position: relative; display: flex; align-items: center; margin-right: 8px; z-index: 50; }
.attach-dropdown {
    position: absolute; bottom: 100%; left: 0; margin-bottom: 12px;
    background: white; border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15); border: 1px solid rgba(0,0,0,0.08);
    width: 260px; padding: 6px; display: flex; flex-direction: column; z-index: 100;
}
.attach-dropdown.hidden { display: none; }
.dropdown-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border: none; background: transparent; width: 100%; text-align: left;
    font-size: 14px; color: #333; cursor: pointer; border-radius: 8px;
    transition: background 0.2s;
}
.dropdown-item:hover { background: #f5f5f5; }

/* FILE PREVIEW (Before send) */
#file-preview-container { display: flex; gap: 8px; margin-right: 8px; }
.file-pill {
    display: flex; align-items: center; gap: 8px;
    background: white; border: 1px solid #e5e5e5;
    border-radius: 8px; padding: 4px 8px;
    font-size: 13px; color: #333;
}
.file-pill-close { cursor: pointer; color: #999; display: flex; align-items: center; }
.file-pill-close:hover { color: #666; }

/* MESSAGES */
.message { display: flex; gap: 16px; padding: 24px 0; font-size: 1rem; line-height: 1.6; color: #374151; }
.message.user { justify-content: flex-end; }
.message.user .text {
    background: #f4f4f4; padding: 10px 16px; border-radius: 20px;
    border-bottom-right-radius: 4px; max-width: 80%;
}
.message.bot .text { max-width: 100%; }

/* AVATAR HIDDEN */
.avatar { display: none !important; }

/* Markdown rendering adjustments */
.message-content ul { margin: 6px 0 6px 0; padding-left: 20px; }
.message-content li { margin: 4px 0; }
.message-content strong, .message-content b { font-weight: 700; }

/* ACTIVE CHAT STATE */
body.chat-active .prompt-title-outside { display: none; }
body.chat-active .prompt-wrap {
    position: fixed; bottom: 0; left: 0; right: 0;
    padding: 20px; background: white; z-index: 100;
    width: 100%; max-width: 800px;
}
body.chat-active .chat-window { display: block; padding-bottom: 120px; }
body.chat-active .suggestion-row { display: none; }

/* NEW FILE ATTACHMENT CARD (In Chat) */
.file-attachment-card {
    display: flex; align-items: center; background: #ffffff;
    padding: 10px 12px; border-radius: 12px; margin-bottom: 4px;
    border: 1px solid #e5e7eb; max-width: 320px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.message.user .file-attachment-card { background: #ffffff; border-color: rgba(0,0,0,0.1); }
.file-icon { margin-right: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-info { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.file-name { font-weight: 600; font-size: 14px; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-type { font-size: 11px; color: #6b7280; text-transform: uppercase; margin-top: 2px; }
.message-content { white-space: pre-wrap; word-break: break-word; }

/* MOBILE */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main { padding: 0; }
    .chat-window, .prompt-wrap { padding-left: 16px; padding-right: 16px; }
}
