@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=Syne:wght@400;500;600;700;800&display=swap');

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

:root {
    --bg-deep: #0a0e1a;
    --bg-surface: rgba(16, 22, 40, 0.65);
    --bg-surface-solid: #101628;
    --bg-card: rgba(16, 22, 40, 0.55);
    --bg-card-hover: rgba(20, 28, 50, 0.7);
    --bg-card-border: rgba(0, 200, 160, 0.12);
    --bg-user-msg: rgba(0, 200, 160, 0.08);
    --bg-user-msg-border: rgba(0, 200, 160, 0.2);
    --bg-ai-msg: rgba(16, 22, 40, 0.45);
    --bg-ai-msg-border: rgba(139, 149, 168, 0.1);
    --accent: #00c8a0;
    --accent-bright: #0ff2c8;
    --accent-warm: #f5a623;
    --accent-glow: rgba(0, 200, 160, 0.15);
    --text-main: #e8edf5;
    --text-muted: #8b95a8;
    --text-dim: #5a6478;
    --danger: #f56565;
    --code-bg: #0F1B2D;
    --code-border: #2B6CB0;
    --option-bg: #0a0e1a;
    --radial-hint: #1a3a6a;
    --overlay-light: rgba(255, 255, 255, 0.02);
    --font-display: 'Syne', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --header-h: 64px;
    --input-h: 230px;
}

[data-theme="light"] {
    --bg-deep: #fafbfc;
    --bg-surface: rgba(255, 255, 255, 0.85);
    --bg-surface-solid: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.92);
    --bg-card-hover: rgba(240, 249, 246, 1);
    --bg-card-border: rgba(0, 121, 107, 0.18);
    --bg-user-msg: rgba(0, 200, 160, 0.1);
    --bg-user-msg-border: rgba(0, 121, 107, 0.3);
    --bg-ai-msg: rgba(240, 249, 246, 0.6);
    --bg-ai-msg-border: rgba(139, 149, 168, 0.2);
    --accent: #00796b;
    --accent-bright: #00c8a0;
    --accent-warm: #d97706;
    --accent-glow: rgba(0, 121, 107, 0.15);
    --text-main: #1a202c;
    --text-muted: #4a5568;
    --text-dim: #718096;
    --danger: #dc2626;
    --code-bg: #f0f9f6;
    --code-border: #00796b;
    --option-bg: #ffffff;
    --radial-hint: #b3e5d9;
    --overlay-light: rgba(0, 121, 107, 0.03);
}

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-deep);
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-main);
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
    -moz-osx-font-smoothing: grayscale;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Mrežni overlay ─── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0,200,160,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,200,160,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* ─── Tekstura ─── */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.35;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    pointer-events: none;
    z-index: 0;
}

/* ─── Pozadinski gradijenti ─── */
.bg-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.12;
    animation: orbFloat 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    top: -10%;
    right: -10%;
    animation-duration: 25s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--radial-hint) 0%, transparent 70%);
    bottom: -15%;
    left: -10%;
    animation-duration: 30s;
    animation-delay: -5s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-warm) 0%, transparent 70%);
    top: 40%;
    left: 50%;
    opacity: 0.06;
    animation-duration: 22s;
    animation-delay: -10s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -20px) scale(1.05); }
    50% { transform: translate(-20px, 30px) scale(0.95); }
    75% { transform: translate(15px, 15px) scale(1.02); }
}

/* ─── Traka za pomjeranje ─── */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-bright);
}

/* ─── Zaglavlje ─── */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    z-index: 100;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid var(--bg-card-border);
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
    transition: opacity 0.2s;
}

.logo:hover {
    opacity: 0.8;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--accent);
}

.logo-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,200,160,0.08);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}
.new-chat-btn svg {
    width: 16px;
    height: 16px;
}
.new-chat-btn:hover {
    background: rgba(0,200,160,0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 100px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    backdrop-filter: blur(10px);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    animation: pulse 2s ease-in-out infinite;
}

.status-badge.error .status-dot {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(245, 101, 101, 0.3);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

/* ─── Glavni sadržaj ─── */
.main {
    flex: 1;
    overflow-y: auto;
    padding-top: var(--header-h);
    padding-bottom: var(--input-h);
    position: relative;
    z-index: 1;
}

/* ─── Početni ekran ─── */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px 40px;
    min-height: calc(100vh - var(--header-h) - var(--input-h));
    animation: fadeInUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hero.hidden {
    display: none;
}

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

.hero-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
    animation: float 6s ease-in-out infinite;
}

.hero-icon svg {
    width: 100%;
    height: 100%;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--text-main) 20%, var(--accent) 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 480px;
    margin-bottom: 36px;
    line-height: 1.6;
}

/* ─── Brza pitanja ─── */
.quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 640px;
    margin-bottom: 28px;
}

.chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    white-space: nowrap;
}

.chip:hover {
    background: var(--bg-card-hover);
    border-color: rgba(0, 200, 160, 0.3);
    color: var(--text-main);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 200, 160, 0.08);
}

.chip:active {
    transform: translateY(0);
}

.chip-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.6;
}

.chip:hover .chip-icon {
    opacity: 1;
    color: var(--accent);
}

.hero-coverage {
    font-size: 0.78rem;
    color: var(--text-dim);
    max-width: 480px;
}

/* ─── Oblast poruka ─── */
.chat-area {
    display: none;
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px 16px;
    width: 100%;
}

.chat-area.active {
    display: block;
}

/* ─── Poruke ─── */
.messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: msgAppear 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

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

.message.ai {
    align-self: flex-start;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 2px;
}

.message.user .msg-avatar {
    background: linear-gradient(135deg, var(--accent), var(--accent-bright));
    color: var(--bg-deep);
}

.message.ai .msg-avatar {
    background: var(--bg-surface);
    border: 1px solid var(--bg-card-border);
    color: var(--accent);
}

.msg-avatar svg {
    width: 16px;
    height: 16px;
}

.msg-bubble {
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    line-height: 1.65;
    font-size: calc(0.92rem * var(--msg-scale, 1));
    position: relative;
}

.message.user .msg-bubble {
    background: var(--bg-user-msg);
    border: 1px solid var(--bg-user-msg-border);
    border-top-right-radius: var(--radius-sm);
    color: var(--text-main);
}

.message.ai .msg-bubble {
    background: var(--bg-ai-msg);
    border: 1px solid var(--bg-ai-msg-border);
    border-top-left-radius: var(--radius-sm);
    backdrop-filter: blur(8px);
}

/* ─── Agent badge (koji model je odgovorio) ─── */
.msg-agent-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--pesares-teal-300, #00c8a0);
    letter-spacing: 0.3px;
    margin: 0 0 10px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(0, 200, 160, 0.08);
    border: 1px solid rgba(0, 200, 160, 0.25);
    text-transform: uppercase;
}
.msg-agent-badge strong {
    font-weight: 700;
    color: var(--text-primary, #f1f5f9);
}

/* ─── Markdown sadržaj u AI porukama ─── */
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 {
    font-family: var(--font-display);
    font-weight: 600;
    margin: 16px 0 8px;
    color: var(--text-main);
}

.msg-bubble h1 { font-size: calc(1.1rem * var(--msg-scale, 1)); }
.msg-bubble h2 { font-size: calc(1.0rem * var(--msg-scale, 1)); }
.msg-bubble h3 { font-size: calc(0.95rem * var(--msg-scale, 1)); }

.msg-bubble p {
    margin: 8px 0;
}

.msg-bubble p:first-child {
    margin-top: 0;
}

.msg-bubble p:last-child {
    margin-bottom: 0;
}

.msg-bubble ul, .msg-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.msg-bubble li {
    margin: 4px 0;
}

.msg-bubble strong {
    color: var(--accent);
    font-weight: 600;
}

.msg-bubble em {
    color: var(--text-muted);
}

.msg-bubble code {
    background: rgba(0, 200, 160, 0.08);
    border: 1px solid rgba(0, 200, 160, 0.15);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.85em;
    color: var(--accent-bright);
}

.msg-bubble blockquote {
    margin: 12px 0;
    padding: 14px 18px;
    background: rgba(245, 166, 35, 0.06);
    border-left: 4px solid var(--accent-warm);
    border-radius: 0 8px 8px 0;
    font-size: 0.92em;
    line-height: 1.7;
    color: #ffffff;
    position: relative;
}
.msg-bubble blockquote::before {
    content: '§';
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 1.4em;
    font-weight: 700;
    color: rgba(245, 166, 35, 0.2);
    font-family: var(--font-display);
}
.msg-bubble blockquote strong {
    color: var(--accent-warm);
}
.msg-bubble blockquote p {
    margin: 6px 0;
}
.msg-bubble blockquote p:first-child {
    margin-top: 0;
}
.msg-bubble blockquote p:last-child {
    margin-bottom: 0;
}

/* ─── Header linkovi (Resursi, O Konsultantu) ─── */
.header-link {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid var(--bg-card-border);
    border-radius: 8px;
    transition: all 0.3s ease;
}
.header-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(0, 200, 160, 0.08);
}

/* ─── Jurisdiction selector u toolbar-u ispod unosa ─── */
.input-toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--bg-card-border);
    border-radius: 12px;
    flex-wrap: wrap;
}
.jur-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.jur-select {
    background: rgba(0, 200, 160, 0.08);
    color: var(--text-main);
    border: 1px solid rgba(0, 200, 160, 0.25);
    border-radius: 6px;
    padding: 6px 10px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: border-color .2s, background .2s;
}
.jur-select:hover { border-color: var(--accent); background: rgba(0, 200, 160, 0.12); }
.jur-select:focus { border-color: var(--accent); }
.jur-select option { background: var(--option-bg); color: var(--text-main); }

/* ─── Akcione dugmad ispod AI odgovora (Kopiraj, Podijeli) ─── */
.msg-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-wrap: wrap;
}
.msg-action-btn {
    background: rgba(0, 200, 160, 0.08);
    color: var(--text-muted);
    border: 1px solid rgba(0, 200, 160, 0.15);
    border-radius: 6px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
}
.msg-action-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 200, 160, 0.12);
}
.msg-action-btn svg { width: 14px; height: 14px; }
.msg-action-btn.copied { color: var(--accent); background: rgba(0, 200, 160, 0.16); }
.msg-action-btn:disabled { opacity: 0.45; cursor: default; }
.msg-action-btn.voted { color: var(--accent); background: rgba(0, 200, 160, 0.18); border-color: rgba(0, 200, 160, 0.4); opacity: 1; }
.msg-action-btn.voted[data-action="down"] { color: #e05555; background: rgba(224,85,85,0.18); border-color: rgba(224,85,85,0.4); }

.msg-bubble pre {
    background: rgba(10, 14, 26, 0.6);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    overflow-x: auto;
    margin: 10px 0;
}

.msg-bubble pre code {
    background: none;
    border: none;
    padding: 0;
}

.msg-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.85rem;
}

.msg-bubble th {
    background: rgba(0, 200, 160, 0.08);
    border: 1px solid var(--bg-card-border);
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--accent);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.msg-bubble td {
    border: 1px solid rgba(139, 149, 168, 0.1);
    padding: 7px 12px;
}

.msg-bubble blockquote {
    border-left: 3px solid var(--accent);
    padding: 8px 16px;
    margin: 10px 0;
    background: rgba(0, 200, 160, 0.04);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-main);
}

.msg-bubble hr {
    border: none;
    height: 1px;
    background: var(--bg-card-border);
    margin: 12px 0;
}

/* ─── Mermaid dijagrami ─── */
.mermaid-diagram {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    overflow-x: auto;
    text-align: center;
}

.mermaid-diagram svg {
    min-width: 600px;
    height: auto;
}

@media (max-width: 768px) {
    .mermaid-diagram {
        padding: 8px;
        margin: 8px 0;
    }

    .mermaid-diagram svg {
        font-size: 12px;
    }
}

.mermaid-diagram .node rect,
.mermaid-diagram .node polygon,
.mermaid-diagram .node circle {
    cursor: pointer;
    transition: opacity 0.2s;
}

.mermaid-diagram .node:hover rect,
.mermaid-diagram .node:hover polygon,
.mermaid-diagram .node:hover circle {
    opacity: 0.85;
}

/* ─── Indikator kucanja ─── */
.typing-indicator {
    display: flex;
    gap: 8px;
    padding: 8px 4px;
    align-items: center;
}

.typing-status {
    font-size: 0.88em;
    color: var(--text-dim);
    font-style: italic;
    margin-right: 4px;
    opacity: 0.85;
    transition: opacity 0.3s;
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.3;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ─── Poruka o grešci ─── */
.msg-error {
    background: rgba(245, 101, 101, 0.08) !important;
    border-color: rgba(245, 101, 101, 0.2) !important;
    color: #fca5a5 !important;
}

/* ─── Polje za unos ─── */
.input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(to top, var(--bg-deep) 60%, transparent 100%);
    padding: 12px 16px 16px;
}

.input-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-xl);
    padding: 8px 8px 8px 20px;
    backdrop-filter: blur(20px);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-container:focus-within {
    border-color: rgba(0, 200, 160, 0.35);
    box-shadow: 0 0 0 3px rgba(0, 200, 160, 0.06), 0 8px 32px rgba(0, 0, 0, 0.2);
}

#userInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.5;
    resize: none;
    max-height: 200px;
    min-height: 44px;
    padding: 8px 0;
    scrollbar-width: none;
}

.upload-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.upload-btn:hover {
    color: var(--accent);
    background: rgba(0, 200, 160, 0.08);
}
.upload-btn svg {
    width: 18px;
    height: 18px;
}

.file-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 12px 0;
}
.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 200, 160, 0.08);
    border: 1px solid rgba(0, 200, 160, 0.2);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--accent);
    max-width: 200px;
}
.file-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-chip-remove {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
}
.file-chip-remove:hover {
    color: #ff6b6b;
}

#userInput::-webkit-scrollbar {
    display: none;
}

#userInput::placeholder {
    color: var(--text-dim);
    opacity: 0.55;
}

.send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    align-self: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-bright));
    color: var(--bg-deep);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s;
    opacity: 0.4;
}

.send-btn:not(:disabled) {
    opacity: 1;
}

.send-btn:not(:disabled):hover {
    transform: scale(1.08);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.send-btn:not(:disabled):active {
    transform: scale(0.95);
}

.send-btn:disabled {
    cursor: not-allowed;
}

.send-btn svg {
    width: 18px;
    height: 18px;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-top: 8px;
    padding: 0 8px;
}

.input-footer .disclaimer {
    flex: 1 1 0;
    min-width: 0;
}
.input-footer .disclaimer:last-child {
    text-align: right;
}

.disclaimer {
    font-size: 0.68rem;
    color: var(--text-dim);
    line-height: 1.4;
}

.version {
    font-size: 0.65rem;
    color: var(--text-dim);
    opacity: 0.6;
    flex-shrink: 0;
    margin-left: 12px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 640px) {
    :root {
        --header-h: 50px;
        --input-h: 220px;
    }

    .header-inner {
        padding: 0 12px;
    }

    .logo-text {
        font-size: 0.95rem;
        letter-spacing: 1.5px;
    }

    .status-badge .status-text {
        display: none;
    }

    /* Mobile: sakriti tekstualne linkove iz header-a da dugmadi stanu */
    .header .header-right .header-link {
        display: none !important;
    }

    .theme-toggle {
        width: 32px;
        height: 32px;
    }
    .theme-toggle svg { width: 16px; height: 16px; }

    /* Mermaid/flow dijagram mora moći horizontalni scroll kad ne stane */
    .mermaid-diagram, .mermaid {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Hero - compact for mobile */
    .hero {
        padding: 20px 14px 16px;
    }

    .hero-icon svg {
        width: 48px;
        height: 48px;
    }

    .hero-title {
        font-size: 1.2rem;
        margin-bottom: 4px;
    }

    .hero-subtitle {
        font-size: 0.82rem;
        margin-bottom: 14px;
    }

    .hero-coverage {
        font-size: 0.7rem;
        margin-top: 10px;
    }

    .quick-chips {
        gap: 6px;
    }

    .chip {
        padding: 7px 12px;
        font-size: 0.78rem;
    }

    .chip-icon {
        display: none;
    }

    /* Messages */
    .message {
        max-width: 92%;
    }

    .msg-bubble {
        padding: 10px 12px;
        font-size: 0.86rem;
    }

    .msg-avatar {
        width: 26px;
        height: 26px;
    }

    .chat-area {
        padding: 12px 8px;
    }

    /* Input area - bigger, more prominent */
    .input-wrapper {
        padding: 8px 10px;
    }

    .input-container {
        padding: 10px 8px 10px 16px;
        border-radius: 22px;
    }

    #userInput {
        font-size: 1rem;
        padding: 6px 0;
        min-height: 24px;
    }

    .send-btn {
        width: 40px;
        height: 40px;
    }

    .input-footer {
        flex-direction: column;
        align-items: center;
        gap: 2px;
        margin-top: 4px;
    }

    .disclaimer {
        text-align: center;
        font-size: 0.6rem;
    }

    .version {
        margin-left: 0;
        font-size: 0.6rem;
    }

    /* Mobile: sakriti new-chat + font-size-toggle iz header-a (vode u drawer) */
    .header .header-right .new-chat-btn,
    .header .header-right .font-size-toggle {
        display: none !important;
    }
    /* Mobile: sakriti jurisdikciju + agent + BETA A/B iz input-toolbar-a (vode u drawer) */
    .input-toolbar .jur-label,
    .input-toolbar .jur-select,
    .input-toolbar .disclaimer {
        display: none !important;
    }
    /* Mobile: sakriti marketing disclaimer (prebačen u drawer) */
    .input-footer .disclaimer-trust {
        display: none !important;
    }
    /* Mobile: pravni disclaimer kompaktan, jedan red */
    .input-footer .disclaimer-legal {
        font-size: 11px;
        line-height: 1.35;
        opacity: 0.6;
        text-align: center;
    }
    .input-footer {
        justify-content: center !important;
    }
    /* Toolbar ostaje kao container ali bez sadržaja; smanjujem visinu */
    .input-toolbar {
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        background: transparent !important;
    }
    /* Prikazati hamburger */
    .hamburger-btn {
        display: inline-flex !important;
    }
    /* Drawer + backdrop postaju vidljivi samo na mobilnom */
    .mobile-drawer {
        display: block !important;
    }
    .mobile-drawer-backdrop {
        display: block !important;
        visibility: hidden;
    }
    body.drawer-open .mobile-drawer-backdrop {
        visibility: visible;
    }
    /* Sakriti scroll kad je drawer otvoren */
    body.drawer-open {
        overflow: hidden;
    }
}

@media (max-width: 380px) {
    .chip {
        font-size: 0.75rem;
        padding: 7px 12px;
    }
}

/* ─── ACCESSIBILITY ─── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─── Theme toggle ─── */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--bg-card-border);
    color: var(--text-muted);
    width: 36px; height: 36px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.3s ease, color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
    padding: 0;
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-glow);
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ─── Hamburger + mobile drawer (samo na mobilnom) ─── */
.hamburger-btn {
    display: none;  /* default skriven; prikazan tek na <768px */
    background: transparent;
    border: 1px solid var(--bg-card-border);
    color: var(--text-muted);
    width: 36px; height: 36px;
    border-radius: 50%;
    align-items: center; justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: color .2s, border-color .2s;
}
.hamburger-btn:hover { color: var(--accent); border-color: var(--accent); }
.hamburger-btn svg { width: 18px; height: 18px; }

.mobile-drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 90;
    opacity: 0;
    transition: opacity .2s ease;
}
body.drawer-open .mobile-drawer-backdrop {
    display: block;
    opacity: 1;
}

.mobile-drawer {
    display: none;
    position: fixed;
    top: var(--header-h);  /* ispod header-a — hamburger ostaje klikabilan za close */
    right: -300px;
    width: 280px;
    max-width: 85vw;
    height: calc(100vh - var(--header-h));
    background: var(--bg-surface);
    border-left: 1px solid var(--bg-card-border);
    box-shadow: -4px 0 18px rgba(0,0,0,.4);
    z-index: 100;
    padding: 16px;
    transition: right .25s ease;
    overflow-y: auto;
}
body.drawer-open .mobile-drawer {
    right: 0;
}
.mobile-drawer .drawer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.mobile-drawer .drawer-item:hover,
.mobile-drawer .drawer-item:focus-visible {
    background: rgba(0, 200, 160, 0.08);
    border-color: rgba(0, 200, 160, 0.25);
}
.mobile-drawer .drawer-item svg { width: 18px; height: 18px; }
.mobile-drawer .drawer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 4px;
    border-top: 1px solid var(--bg-card-border);
    border-bottom: 1px solid var(--bg-card-border);
    margin: 8px 0;
}
.mobile-drawer .drawer-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}
.mobile-drawer .drawer-font-ctrl {
    display: inline-flex;
    border: 1px solid var(--bg-card-border);
    border-radius: 18px;
    overflow: hidden;
}
.mobile-drawer .drawer-font-ctrl button {
    background: transparent;
    border: 0;
    color: var(--text-main);
    font-family: var(--font-ui);
    font-weight: 700;
    cursor: pointer;
    padding: 6px 14px;
    min-width: 40px;
}
.mobile-drawer .drawer-font-ctrl button + button {
    border-left: 1px solid var(--bg-card-border);
}
.mobile-drawer .drawer-font-ctrl button:disabled {
    opacity: 0.35;
    cursor: default;
}
.mobile-drawer .drawer-font-ctrl button:hover:not(:disabled) {
    color: var(--accent);
    background: rgba(0, 200, 160, 0.08);
}
.mobile-drawer .drawer-field {
    padding: 12px 14px;
    margin: 4px 0;
    border-top: 1px solid var(--bg-card-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mobile-drawer .drawer-field + .drawer-field {
    border-top: 1px solid var(--bg-card-border);
    padding-top: 12px;
}
.mobile-drawer .drawer-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 14px;
    cursor: pointer;
}
.mobile-drawer .drawer-segmented {
    display: flex;
    border: 1px solid var(--bg-card-border);
    border-radius: 8px;
    overflow: hidden;
}
.mobile-drawer .drawer-segmented button {
    flex: 1;
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 8px;
    transition: background .15s ease, color .15s ease;
}
.mobile-drawer .drawer-segmented button + button {
    border-left: 1px solid var(--bg-card-border);
}
.mobile-drawer .drawer-segmented button:hover:not(.active) {
    background: rgba(0, 200, 160, 0.06);
}
.mobile-drawer .drawer-segmented button.active {
    background: rgba(0, 200, 160, 0.15);
    color: var(--accent);
}
.mobile-drawer .drawer-trust {
    margin: 20px 0 0;
    padding: 12px 14px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-muted);
    opacity: 0.75;
    font-style: italic;
    border-top: 1px solid var(--bg-card-border);
    text-align: center;
}
.mobile-drawer .drawer-beta {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: rgba(0, 200, 160, 0.12);
    color: var(--accent);
    border: 1px solid rgba(0, 200, 160, 0.3);
    border-radius: 12px;
    vertical-align: middle;
}

/* ─── Font size toggle (A− / A+) ─── */
.font-size-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--bg-card-border);
    border-radius: 18px;
    overflow: hidden;
    height: 36px;
}
.font-size-toggle button {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0 10px;
    height: 100%;
    min-width: 34px;
    transition: color 0.2s ease, background 0.2s ease;
}
.font-size-toggle button:hover:not(:disabled) {
    color: var(--accent);
    background: rgba(0, 200, 160, 0.08);
}
.font-size-toggle button:disabled {
    opacity: 0.35;
    cursor: default;
}
.font-size-toggle button + button {
    border-left: 1px solid var(--bg-card-border);
}
#fontDecrease { font-size: 11px; }
#fontIncrease { font-size: 14px; }
@media (max-width: 600px) {
    .font-size-toggle { height: 32px; }
    .font-size-toggle button { min-width: 30px; padding: 0 8px; }
}

/* Light mode prilagodbe za orb pozadinu (subtler na svijetlom) */
[data-theme="light"] .orb {
    opacity: 0.35;
    filter: blur(40px);
}
[data-theme="light"] .bg-noise {
    opacity: 0.08;
}
[data-theme="light"] .header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bg-card-border);
}
