/* Merak AI — paleta: duboko indigo/noćno plavo + bakreni akcent (fildžan kafe u sumrak) */
:root {
    --ink: #12141c;
    --ink-2: #1a1d29;
    --ink-3: #232636;
    --line: #2e3247;
    --paper: #f6f4ee;
    --copper: #c8703f;
    --copper-bright: #e08a54;
    --text: #e9e7de;
    --text-dim: #9a97a8;
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--ink);
    color: var(--text);
    font-family: var(--font-body);
}

/* ---------- Auth stranice ---------- */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 20%, #1c2032 0%, var(--ink) 65%);
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 40px 32px;
}

.auth-mark {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    color: var(--copper-bright);
    letter-spacing: -0.01em;
}

.auth-sub {
    color: var(--text-dim);
    margin: 6px 0 28px;
    font-size: 14px;
}

.auth-error {
    background: rgba(200, 70, 70, 0.15);
    border: 1px solid rgba(200, 70, 70, 0.4);
    color: #e0a0a0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 18px;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-dim);
}

.auth-form input {
    background: var(--ink-3);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    font-size: 14px;
    font-family: var(--font-body);
}

.auth-form input:focus {
    outline: 2px solid var(--copper);
    outline-offset: 1px;
}

.auth-form button {
    margin-top: 8px;
    background: var(--copper);
    color: #1a1005;
    border: none;
    border-radius: 8px;
    padding: 11px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.auth-form button:hover { background: var(--copper-bright); }

.auth-switch {
    margin-top: 22px;
    font-size: 13px;
    color: var(--text-dim);
    text-align: center;
}

.auth-switch a { color: var(--copper-bright); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* ---------- App layout ---------- */
.app {
    display: grid;
    grid-template-columns: 270px 1fr;
    height: 100vh;
}

.sidebar {
    background: var(--ink-2);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
}

.sidebar-top { margin-bottom: 18px; }

.brand {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    color: var(--copper-bright);
    margin-bottom: 16px;
    padding: 0 6px;
}

.btn-new {
    width: 100%;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text);
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-new:hover { border-color: var(--copper); background: var(--ink-3); }

.conversation-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conversation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 8px;
    padding: 2px 4px 2px 10px;
}

.conversation-item a {
    flex: 1;
    display: block;
    padding: 9px 0;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item:hover { background: var(--ink-3); }
.conversation-item:hover a { color: var(--text); }
.conversation-item.active { background: var(--ink-3); }
.conversation-item.active a { color: var(--copper-bright); }

.delete-form button {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0;
    transition: opacity 0.1s ease;
}

.conversation-item:hover .delete-form button { opacity: 1; }
.delete-form button:hover { color: #e08080; }

.empty-hint { color: var(--text-dim); font-size: 13px; padding: 10px; }

.sidebar-bottom {
    border-top: 1px solid var(--line);
    padding-top: 14px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-dim);
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
    padding: 0;
}

.btn-link:hover { color: var(--copper-bright); }

/* ---------- Chat panel ---------- */
.chat-panel {
    display: flex;
    flex-direction: column;
    background: var(--paper);
    color: #262420;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6b6558;
}

.empty-mark {
    font-family: var(--font-display);
    font-size: 34px;
    color: var(--copper);
    margin-bottom: 10px;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px 20%;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

@media (max-width: 900px) {
    .messages { padding: 24px 6%; }
}

.msg { display: flex; flex-direction: column; gap: 4px; }

.msg-role {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9c8f7a;
    font-weight: 600;
}

.msg-user .msg-role { color: #a8734a; }

.msg-bubble {
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.msg-user .msg-bubble {
    background: #ece6d8;
    border-radius: 12px;
    padding: 12px 16px;
    align-self: flex-start;
    max-width: 80%;
}

.msg-assistant .msg-bubble { color: #262420; }

.composer {
    border-top: 1px solid #e0dac8;
    padding: 16px 20%;
    display: flex;
    gap: 10px;
    background: var(--paper);
}

@media (max-width: 900px) {
    .composer { padding: 14px 6%; }
}

.composer textarea {
    flex: 1;
    resize: none;
    border: 1px solid #d8d0ba;
    border-radius: 10px;
    padding: 12px 14px;
    font-family: var(--font-body);
    font-size: 14.5px;
    max-height: 160px;
    background: #fffdf8;
}

.composer textarea:focus {
    outline: 2px solid var(--copper);
    outline-offset: 1px;
}

.composer button {
    background: var(--copper);
    color: #1a1005;
    border: none;
    border-radius: 10px;
    padding: 0 22px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.composer button:hover { background: var(--copper-bright); }
.composer button:disabled { opacity: 0.5; cursor: default; }

.msg-typing .msg-bubble {
    color: #9c8f7a;
    font-style: italic;
}

.msg-error .msg-bubble { color: #b4483f; }
