:root {
    /* --- THEME: DARK (Default) --- */
    --bg-body: #131314;
    --bg-sidebar: #1e1f20;
    --bg-input: #282a2c;
    --bg-hover: rgba(255, 255, 255, 0.1);
    --text-main: #e3e3e3;
    --text-secondary: #9aa0a6;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);

    /* Cod specific */
    --code-bg: #1e1e1e;
    --code-header: #2d2d2d;
    --code-text: #a9b7c6;
}

/* --- THEME: LIGHT (Când clasa e activă) --- */
body.light-mode {
    --bg-body: #ffffff;
    --bg-sidebar: #f0f4f9;
    --bg-input: #f0f4f9;
    --bg-hover: rgba(0, 0, 0, 0.05);
    --text-main: #1f1f1f;
    --text-secondary: #444746;
    --border-color: #e1e3e1;
    --shadow: 0 2px 5px rgba(0, 0, 0, 0.05);

    /* Cod light */
    --code-bg: #f5f5f5;
    --code-header: #e0e0e0;
    --code-text: #2c3e50;
}

/* --- RESET & GLOBAL --- */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Roboto', sans-serif; }

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    /* Tranziție fină între moduri */
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    transition: background-color 0.3s;
}

.new-chat-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 15px;
    border-radius: 20px;
    cursor: pointer;
    margin-bottom: 20px;
    transition: 0.2s;
}
.new-chat-btn:hover { background-color: var(--bg-hover); }

.history-item {
    padding: 10px;
    color: var(--text-main);
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history-item:hover { background-color: var(--bg-hover); }

/* Butonul de Theme Toggle (Poziționat jos în sidebar) */
.theme-toggle {
    margin-top: auto; /* Îl împinge jos */
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    border-radius: 8px;
}
.theme-toggle:hover { background-color: var(--bg-hover); color: var(--text-main); }

/* --- MAIN CHAT --- */
.chat-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-body);
}

.chat-feed {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.message-row {
    width: 100%;
    max-width: 800px;
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-weight: bold;
    color: white;
}
.user .avatar { background-color: #555; }
.ai .avatar { background: linear-gradient(135deg, #4285f4, #d96570); }

/* Cod Block */
.code-block {
    background-color: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 10px;
    font-family: monospace;
}
.code-header {
    background-color: var(--code-header);
    color: var(--text-secondary);
    padding: 5px 15px;
    font-size: 0.8rem;
}
.code-block pre { padding: 15px; color: var(--code-text); overflow-x: auto; }

/* --- INPUT AREA --- */
.input-container {
    position: absolute; bottom: 0; width: 100%;
    padding: 20px;
    /* Gradient pentru a ascunde textul de sub input */
    background: linear-gradient(to top, var(--bg-body) 70%, transparent);
    display: flex; justify-content: center;
}

.input-box {
    width: 100%; max-width: 800px;
    background-color: var(--bg-input);
    border-radius: 30px;
    padding: 8px 15px;
    display: flex; align-items: center;
    border: 1px solid var(--border-color);
}

.input-box input {
    flex: 1;
    background: transparent; border: none; outline: none;
    padding: 10px;
    color: var(--text-main);
    font-size: 1rem;
}

.send-btn {
    background: transparent; border: none; cursor: pointer;
    color: var(--text-main); opacity: 0.6;
}
.send-btn:hover { opacity: 1; }

@media (max-width: 768px) {
    .sidebar { display: none; }
}
