:root {
    --bg-dark: #0a0c10;
    --sidebar-bg: #0d1117;
    --sidebar-width: 260px;
    --primary-accent: #00e5a0;
    --secondary-accent: #0055ff;
    --text-main: #e6edf3;
    --text-dim: #848d97;
    --border-color: #30363d;
    --bubble-user: #1f2937;
    --bubble-bot: #161b22;
    --gradient-n: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'IBM Plex Mono', monospace;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 16px;
    transition: transform 0.3s ease;
    z-index: 100;
    flex-shrink: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.logo-box {
    width: 32px; height: 32px;
    background: var(--gradient-n);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    color: var(--bg-dark);
    font-size: 18px;
}

.brand-name {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 18px;
}

.new-chat-btn {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: transparent;
    color: var(--text-main);
    display: flex; align-items: center; gap: 8px;
    cursor: pointer;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    transition: background 0.2s, border-color 0.2s;
    margin-bottom: 20px;
}

.new-chat-btn:hover {
    background: rgba(0,229,160,0.06);
    border-color: var(--primary-accent);
    color: var(--primary-accent);
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
}

.chat-history::-webkit-scrollbar { width: 3px; }
.chat-history::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.history-item {
    padding: 9px 10px;
    border-radius: 6px;
    display: flex; align-items: center;
    justify-content: space-between;
    cursor: pointer;
    margin-bottom: 2px;
    font-size: 12px;
    color: var(--text-dim);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.history-item:hover, .history-item.active {
    background: rgba(255,255,255,0.04);
    color: var(--text-main);
    border-color: var(--border-color);
}

.history-item .title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 185px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.delete-btn {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 3px;
    border-radius: 4px;
    display: flex;
    transition: all 0.15s;
    flex-shrink: 0;
}

.history-item:hover .delete-btn { opacity: 1; }
.delete-btn:hover { color: #ff6b6b; background: rgba(255,107,107,0.1); }

.status-indicator {
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    display: flex; align-items: center; gap: 8px;
    font-size: 11px;
    color: var(--text-dim);
}

.dot {
    width: 7px; height: 7px;
    background: var(--primary-accent);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--primary-accent);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%,100% { opacity:1; }
    50% { opacity:0.5; }
}

/* ── MAIN ── */
.main-chat {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 56px;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.chat-title {
    font-size: 13px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.hamburger {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
}
.hamburger:hover { background: rgba(255,255,255,0.06); }

/* ── CHAT WINDOW ── */
.chat-window {
    flex-grow: 1;
    overflow-y: auto;
    padding: 32px 20px;
    scroll-behavior: smooth;
}

.chat-window::-webkit-scrollbar { width: 3px; }
.chat-window::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* ── WELCOME ── */
.welcome-screen {
    max-width: 600px;
    margin: 60px auto;
    text-align: center;
}

.welcome-logo {
    width: 64px; height: 64px;
    background: var(--gradient-n);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    color: var(--bg-dark);
    font-size: 32px;
    margin: 0 auto 20px;
    box-shadow: 0 0 32px rgba(0,229,160,0.2);
}

.welcome-title {
    font-family: 'Syne', sans-serif;
    font-size: 30px;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.welcome-tagline {
    color: var(--primary-accent);
    font-size: 14px;
    margin-bottom: 36px;
}

.suggested-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 560px;
    margin: 0 auto;
}

.chip {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.5;
    transition: all 0.2s;
    display: flex; align-items: flex-start; gap: 10px;
    color: var(--text-dim);
}

.chip:hover {
    border-color: var(--primary-accent);
    background: rgba(0,229,160,0.05);
    color: var(--text-main);
}

/* ── MESSAGES ── */
.message {
    max-width: 760px;
    margin: 0 auto 24px;
    display: flex;
    gap: 14px;
    animation: fadeUp 0.3s ease forwards;
}

@keyframes fadeUp {
    from { opacity:0; transform:translateY(8px); }
    to { opacity:1; transform:translateY(0); }
}

.message.user { flex-direction: row-reverse; }

.avatar {
    width: 30px; height: 30px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    font-weight: 700;
    font-family: 'Syne', sans-serif;
    margin-top: 2px;
}

.bot .avatar {
    background: var(--gradient-n);
    color: var(--bg-dark);
}

.user .avatar {
    background: #1f2937;
    color: #4d88ff;
    border: 1px solid rgba(0,85,255,0.3);
}

.bubble {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.75;
    max-width: 680px;
}

.user .bubble {
    background: var(--bubble-user);
    border-top-right-radius: 3px;
}

.bot .bubble {
    background: var(--bubble-bot);
    border: 1px solid var(--border-color);
    border-top-left-radius: 3px;
}

/* ── TYPING ── */
.typing {
    display: flex; gap: 4px;
    padding: 6px 2px;
    align-items: center;
}

.typing span {
    width: 5px; height: 5px;
    background: var(--primary-accent);
    border-radius: 50%;
    animation: bounce 1.2s infinite;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%,100% { opacity:0.3; transform:translateY(0); }
    50% { opacity:1; transform:translateY(-4px); }
}

/* ── INPUT ── */
.input-container {
    padding: 12px 20px 20px;
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-dark);
}

.input-wrapper {
    max-width: 680px;
    margin: 0 auto;
    background: #161b22;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 14px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: rgba(0,229,160,0.4);
}

textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 100px;
    overflow-y: auto;
    line-height: 1.6;
}

textarea::placeholder { color: var(--text-dim); }
textarea::-webkit-scrollbar { width: 2px; }

.controls {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.hint {
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 0.3px;
}

.send-btn {
    background: var(--primary-accent);
    color: var(--bg-dark);
    border: none;
    width: 30px; height: 30px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover { background: #00ffb3; transform: scale(1.05); }
.send-btn:active { transform: scale(0.93); }
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.5); }
    .hamburger { display: flex; }
    .suggested-chips { grid-template-columns: 1fr; }
    .chat-window { padding: 20px 14px; }
    .input-container { padding: 10px 14px 16px; }
    .welcome-screen { margin: 30px auto; }
    .welcome-title { font-size: 24px; }
}

.attach-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-dim);
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.attach-btn:hover { border-color: var(--primary-accent); color: var(--primary-accent); }

.file-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,229,160,0.08);
  border: 1px solid rgba(0,229,160,0.25);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  color: var(--primary-accent);
  margin-bottom: 8px;
}
.file-badge button {
  background: none; border: none;
  color: var(--text-dim);
  cursor: pointer; font-size: 12px; padding: 0 2px;
  line-height: 1;
}
.file-badge button:hover { color: #ff6b6b; }
