/* ================================================
   DocuBot — spletna različica
   Temna tema, moderna tipografija
   ================================================ */

:root {
    --bg-primary: #0b0c10;
    --bg-secondary: rgba(22, 24, 34, 0.65);
    --bg-tertiary: rgba(31, 34, 46, 0.8);
    --bg-input: rgba(15, 16, 26, 0.6);

    --accent: #00f0ff;
    --accent-hover: #00c3cc;
    --accent-dim: rgba(0, 240, 255, 0.15);

    --text-primary: #e2e8f0;
    --text-muted: #94a3b8;
    --text-accent: #b200ff;

    --border: rgba(0, 240, 255, 0.2);
    --border-subtle: rgba(148, 163, 184, 0.1);

    --toast-bg: rgba(11, 12, 16, 0.9);
    --toast-color: #f8fafc;

    --msg-user-bg: rgba(178, 0, 255, 0.15);
    --msg-user-border: #b200ff;
    --msg-ai-bg: rgba(0, 240, 255, 0.08);
    --msg-ai-border: #00f0ff;

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;

    --shadow: 0 8px 32px rgba(0, 240, 255, 0.15);
    --font: 'Inter', system-ui, sans-serif;
    --font-heading: 'Outfit', system-ui, sans-serif;
}

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

html {
    height: 100%;
    background: #050510;
}

body {
    height: 100dvh;
    font-family: var(--font);
    background: #050510;
    color: var(--text-primary);
    overflow: hidden;
}

/* ── Otok UI Struktura ─────────────────────────────── */
.mesh-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background:
        radial-gradient(ellipse 60% 55% at 10% 15%, rgba(140, 0, 255, 0.55) 0%, transparent 70%),
        radial-gradient(ellipse 55% 50% at 90% 85%, rgba(0, 200, 255, 0.45) 0%, transparent 70%),
        radial-gradient(ellipse 40% 40% at 50% 50%, rgba(80, 0, 200, 0.2) 0%, transparent 70%),
        linear-gradient(150deg, #050510 0%, #120830 40%, #04101e 100%);
    z-index: 0;
}

.island-layout {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
    background: transparent;
}

/* ── Glava (Lebdeča) ──────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 64px;
    background: rgba(15, 16, 26, 0.4);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(0, 240, 255, 0.2);
    flex-shrink: 0;
}

.floating-header {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1000px;
    height: 64px;
    border-radius: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: rgba(15, 16, 26, 0.4);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(0, 240, 255, 0.2);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 100;
}

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

.logo-icon {
    font-size: 24px;
    color: var(--accent);
    line-height: 1;
}

.header-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
    filter: brightness(1.1);
    border-radius: 6px;
}

.app-title {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(90deg, #00f0ff, #b200ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.header-badge {
    font-size: 10px;
    font-weight: 600;
    color: #00f0ff;
    background: rgba(0, 240, 255, 0.1);
    padding: 3px 10px;
    border-radius: 99px;
    border: 1px solid rgba(0, 240, 255, 0.3);
    letter-spacing: 0.5px;
}

/* User info pill in header */
.user-info-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: rgba(178, 0, 255, 0.12);
    border: 1px solid rgba(178, 0, 255, 0.3);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Warning banner */
.warning-banner {
    background: rgba(255, 200, 0, 0.1);
    color: #fcd34d;
    padding: 10px 15px;
    text-align: center;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 200, 0, 0.2);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 20px 20px 0 0;
}

/* ── Nadzorna plošča (Dashboard) 1.5.0 ───────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.dash-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.dash-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-dim);
}

.dash-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.dash-icon {
    font-size: 24px;
    background: var(--bg-tertiary);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.dash-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.dash-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item small {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-item span {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Statusni poudarki */
.stat-item.success span {
    color: #10b981;
}

.stat-item.warning span {
    color: #f59e0b;
}

.stat-item.info span {
    color: var(--accent);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

/* ── Layout ─────────────────────────────────── */
.app-layout {
    display: flex;
    justify-content: center;
    /* Centriranje vsebine če je to potrebno */
    height: calc(100vh - 80px);
    background: var(--bg-primary);
    /* Zagotovimo osnovno barvo */
}

/* ── Glavno področje ────────────────────────── */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Področje sporočil (Lebdeče) ──────────────────────── */
.floating-chat {
    position: fixed;
    top: 110px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1000px;
    bottom: 110px;
    border-radius: 28px;
    background: rgba(12, 10, 28, 0.75);
    border: 1px solid rgba(236, 72, 153, 0.35);
    box-shadow:
        0 0 30px rgba(236, 72, 153, 0.15),
        0 0 60px rgba(178, 0, 255, 0.1),
        0 25px 60px rgba(0, 0, 0, 0.7),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow-y: auto;
    padding: 24px 0;
    scroll-behavior: smooth;
    z-index: 10;
}

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
    scroll-behavior: smooth;
    background: transparent;
}

.chat-messages {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 💡💡 Empty state 💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡💡 */
.empty-state {
    text-align: center;
    padding: 22vh 20px 60px 20px;
    color: var(--text-muted);
}

.empty-logo {
    width: 320px !important;
    height: auto !important;
    max-width: 60vw;
    object-fit: contain;
    opacity: 0.12;
    filter: grayscale(30%);
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 24px;
    border-radius: 30px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* ── Sporočilni oblački ─────────────────────── */
.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeSlide 0.2s ease;
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.message.assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 11px;
    color: var(--text-muted);
}

.message-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.message.user .message-dot {
    background: var(--msg-user-border);
}

.message.assistant .message-dot {
    background: var(--msg-ai-border);
}

.message-role {
    font-weight: 600;
    font-size: 11px;
}

.message.user .message-role {
    color: #b200ff;
}

.message.assistant .message-role {
    color: #00f0ff;
}

.message-bubble {
    padding: 16px 20px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.65;
    word-break: break-word;
    white-space: pre-wrap;
    letter-spacing: 0.2px;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, rgba(178, 0, 255, 0.2) 0%, rgba(178, 0, 255, 0.05) 100%);
    border: 1px solid rgba(178, 0, 255, 0.4);
    border-bottom-right-radius: 4px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(178, 0, 255, 0.15);
}

.message.assistant .message-bubble {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.1) 0%, rgba(0, 240, 255, 0.02) 100%);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.05);
}

/* Markdown elementi v oblačkih */
.message-bubble p,
.message-bubble ul,
.message-bubble ol {
    margin-bottom: 6px;
}

.message-bubble ul,
.message-bubble ol {
    padding-left: 1.2rem;
    list-style-position: inside;
}

.message-bubble strong {
    color: #fff;
}

.message-bubble code {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
}

.message-bubble pre {
    background: #1a1a1a;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
}

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

/* Kurzor med generiranjem */
.cursor-blink {
    display: inline-block;
    width: 2px;
    height: 14px;
    background: var(--accent);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* ── Vnosno področje (Lebdeče) ─────────────────────────── */
.floating-input {
    position: fixed;
    bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1000px;
    background: rgba(18, 10, 38, 0.92);
    border: 1px solid rgba(178, 0, 255, 0.5);
    border-radius: 36px;
    padding: 10px 20px;
    box-shadow:
        0 0 0 1px rgba(178, 0, 255, 0.15),
        0 20px 50px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(140, 0, 255, 0.3);
    z-index: 100;
}

@media (max-width: 768px) {
    .floating-input {
        bottom: max(16px, calc(env(safe-area-inset-bottom) + 12px));
        width: 90%;
        border-radius: 28px;
        padding: 8px 14px;
    }
}

.input-container {
    display: flex;
    gap: 12px;
    max-width: 100%;
    margin: 0;
    padding: 0;
    width: 100%;
    align-items: center;
    justify-content: center;
}

.input-container:has(.input-sidebar-spacer:not(.hidden)) {
    justify-content: space-between;
}

.input-main-content {
    flex: 1;
    max-width: 900px;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.input-sidebar-spacer {
    width: 280px;
    flex-shrink: 0;
    pointer-events: none;
}

.input-main-content .token-counter-container {
    max-width: 100%;
    margin: 0 0 10px 0;
}

.input-main-content .file-upload-area {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.input-main-content .input-wrapper {
    max-width: 100%;
    margin: 0;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.textarea-wrapper {
    position: relative;
    flex: 1;
    display: flex;
}

.btn-upload-embedded {
    position: absolute;
    left: 12px;
    bottom: 12px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, transform 0.1s;
    z-index: 5;
    padding: 0;
}

.btn-upload-embedded:hover {
    background: var(--bg-tertiary);
    color: var(--accent);
}

.btn-upload-embedded:active {
    transform: scale(0.92);
}

.btn-upload-embedded:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

textarea#message-input {
    flex: 1;
    background: rgba(8, 5, 20, 0.9);
    color: var(--text-primary);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 20px;
    padding: 12px 18px;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 120px;
    overflow-y: auto;
    /* Skrijemo drsnik — polje ostane pomikljivo */
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* IE/Edge */
}

/* Webkit (Chrome, Safari, mobilni brskalniki) */
textarea#message-input::-webkit-scrollbar {
    display: none;
}

textarea#message-input:focus {
    border-color: rgba(0, 240, 255, 0.6);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
}

textarea#message-input::placeholder {
    color: rgba(148, 163, 184, 0.6);
}

.input-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

/* Circular token counter */
.circular-token-counter {
    width: 36px;
    height: 36px;
    position: relative;
    cursor: help;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
    padding: 2px;
    flex-shrink: 0;
}

.input-hint {
    max-width: 900px;
    margin: 6px auto 0;
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Gumbi ──────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    border-radius: 20px;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, #00f0ff 0%, #b200ff 100%);
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    box-shadow: 0 4px 15px rgba(178, 0, 255, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #00c3cc 0%, #9000cc 100%);
    box-shadow: 0 6px 20px rgba(178, 0, 255, 0.6);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #383838;
}

.btn-light {
    background: rgba(178, 0, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(178, 0, 255, 0.3);
    border-radius: 12px;
    font-size: 18px;
    padding: 4px 12px;
}

.btn-light:hover {
    background: rgba(178, 0, 255, 0.2);
    border-color: rgba(178, 0, 255, 0.6);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ── Modal ──────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 480px;
    max-width: 95vw;
    box-shadow: var(--shadow);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
    font-size: 17px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-footer {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-family: var(--font);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    resize: vertical;
}

.modal.modal-lg {
    width: 900px;
}

/* Zavihki */
.modal-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 6px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tab-btn.active {
    color: var(--accent);
    background: var(--accent-dim);
}

/* Razdeljen pogled v nastavitvah */
.settings-split {
    display: flex;
    gap: 24px;
    height: 520px;
}

.settings-list-container {
    flex: 0 0 320px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
}

.list-search-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg-secondary);
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
}

.list-search-wrapper input,
.list-search-wrapper select {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1.5px solid var(--border);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.list-search-wrapper input:focus,
.list-search-wrapper select:focus {
    outline: none;
    border-color: var(--accent);
}

.settings-list {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow-y: auto;
    padding: 4px;
}

.settings-form {
    flex: 1;
    overflow-y: auto;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.settings-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.settings-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
    border: 1px solid var(--accent-dim);
}

.item-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #334155;
    /* Temna barva za neaktivne */
    transition: all 0.2s;
    flex-shrink: 0;
    cursor: pointer;
}

.item-indicator.active {
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
    display: none;
    z-index: 101;
}

.settings-fab-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-active {
    background: #10b981;
}

.status-pending {
    background: #f59e0b;
}

.settings-item .btn-delete {
    opacity: 0;
    color: #ef4444;
    font-size: 14px;
    padding: 4px;
    cursor: pointer;
}

.settings-item:hover .btn-delete {
    opacity: 1;
}

.form-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: none;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
}

/* Navodila okno */
.help-content {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 1rem;
    line-height: 1.6;
}

.help-content h1,
.help-content h2 {
    margin-top: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.help-content h3 {
    margin-top: 1.2rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.help-content ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
    list-style-type: disc;
}

.help-content li {
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.help-content code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: var(--accent);
}

.help-content hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 2rem 0;
}

.help-content strong {
    color: var(--text-primary);
}

/* ── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3d5470;
}

/* ── Markdown tabele ────────────────────────────── */
table.md-table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0 4px;
    font-size: 13px;
}

table.md-table th {
    background: var(--bg-tertiary);
    color: var(--accent);
    font-weight: 600;
    text-align: left;
    padding: 8px 12px;
    border: 1px solid var(--border);
    white-space: nowrap;
}

table.md-table td {
    padding: 7px 12px;
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: top;
}

table.md-table tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.03);
}

table.md-table tr:hover td {
    background: rgba(56, 189, 248, 0.05);
}

.table-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.btn-table-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    font-size: 12px;
    font-family: var(--font);
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-table-action:hover {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: rgba(56, 189, 248, 0.3);
}

/* ── Pomožni razredi ────────────────────────── */
.hidden {
    display: none !important;
}

/* ── Lebdeča gumba v spodnjem desnem kotu ───────── */
#btn-about,
.settings-fab-button-placeholder {
    /* Le za skupne stile */
    position: fixed;
    bottom: 20px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    transition: all 0.2s ease;
    z-index: 50;
    line-height: 1;
}

#btn-about {
    right: 66px;
    font-family: serif;
    font-size: 19px;
    font-weight: 700;
}

#btn-settings {
    position: relative;
    /* Spremenjeno iz fixed */
    bottom: 0;
    right: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    transition: all 0.2s ease;
    z-index: 50;
    line-height: 1;
    font-size: 18px;
}

#btn-about:hover,
#btn-settings:hover {
    opacity: 1;
    color: var(--accent);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

#btn-settings:hover {
    transform: translateY(-2px) rotate(60deg);
}

/* Tokni / Context bar */
.token-counter-container {
    max-width: 900px;
    margin: 0 auto 10px auto;
}

.token-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 5px;
    padding: 0 2px;
}

.progress-container {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--success);
    transition: width 0.3s ease, background-color 0.3s ease;
}

/* Pametno opozorilo - utripanje gumba za shranjevanje */
@keyframes pulse-border {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
        border-color: var(--danger);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
        border-color: rgba(239, 68, 68, 0.5);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        border-color: var(--danger);
    }
}

.btn-pulse {
    animation: pulse-border 2s infinite;
    background: #fef2f2 !important;
    color: #991b1b !important;
    border: 1px solid #ef4444 !important;
}

/* Izboljšan prikaz SSL preverjanja */
.checkbox-group {
    flex-direction: row !important;
    align-items: center;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin: 8px 0;
    cursor: pointer;
    transition: all 0.2s;
    display: flex !important;
    gap: 12px;
}

.checkbox-group:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-dim);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    cursor: pointer;
    font-size: 14px !important;
    color: var(--text-primary) !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-weight: 500 !important;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Statusna informacija v spodnjem levem kotu */
.user-info-bottom {
    position: fixed;
    bottom: 8px;
    left: 10px;
    font-size: 11px;
    color: lightgray;
    opacity: 0.5;
    z-index: 9999;
    pointer-events: none;
    letter-spacing: 0.2px;
}

/* ── Toast obvestila ────────────────────────── */
.toast-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
    max-width: 400px;
    width: calc(100vw - 48px);
}

.toast {
    background: var(--toast-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    box-shadow: var(--shadow);
    color: var(--toast-color);
    font-size: 13px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0s, 4.7s;
}

.toast.toast-success {
    border-left: 4px solid #10b981;
}

.toast.toast-error {
    border-left: 4px solid #ef4444;
}

.toast.toast-info {
    border-left: 4px solid var(--accent);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
}

/* ── File upload area ────────────────────────── */
.file-upload-area {
    margin-top: 12px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

#btn-upload {
    padding: 6px 12px;
    font-size: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

#btn-upload:hover {
    background: #334155;
    border-color: var(--accent);
}

.uploaded-docs {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.doc-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.doc-tag:hover {
    border-color: var(--accent-dim);
    background: var(--bg-tertiary);
}

.doc-tag-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.doc-tag-delete:hover {
    color: #ef4444 !important;
}

#rag-status-label {
    font-size: 12px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

/* ── Stranska vrstica za dokumente ─────────── */
.chat-container {
    display: flex;
    gap: 28px;
    max-width: 100%;
    margin: 0;
    padding: 0 24px;
    width: 100%;
    align-items: flex-start;
    justify-content: center;
}

.chat-container:has(.doc-sidebar:not(.hidden)) {
    justify-content: space-between;
}

.chat-container .chat-messages {
    flex: 1;
    max-width: 900px;
    margin: 0;
    padding: 0;
}

.doc-sidebar-spacer {
    width: 280px;
    flex-shrink: 0;
    pointer-events: none;
}

.doc-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 10px;
    z-index: 10;
}

.doc-sidebar-bubble {
    background: #1e1b4b; /* deep violet/indigo */
    border: 1px solid rgba(129, 140, 248, 0.3); /* indigo border */
    border-radius: var(--radius-lg);
    border-bottom-left-radius: 4px; /* matching assistant bubble style */
    padding: 16px 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.doc-sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(129, 140, 248, 0.20);
    padding-bottom: 10px;
}

.doc-sidebar-icon {
    font-size: 16px;
}

.doc-sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin: 0;
}

.doc-sidebar-bubble .uploaded-docs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.doc-sidebar-bubble .doc-tag {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

.doc-sidebar-bubble .doc-tag span:nth-child(2) {
    flex: 1;
    min-width: 0;
    text-align: left;
    margin-left: 4px;
}

.doc-sidebar-bubble #rag-status-label {
    border-top: 1px solid rgba(129, 140, 248, 0.20);
    padding-top: 12px;
    margin-top: 4px;
    width: 100%;
    display: flex;
    align-items: center;
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-muted);
}

/* Responsive prilagoditve */
@media (max-width: 1200px) {
    .chat-container {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    .doc-sidebar {
        width: 100%;
        position: static;
    }
    .doc-sidebar-bubble {
        border-bottom-left-radius: var(--radius-lg);
    }
    .doc-sidebar-spacer {
        display: none !important;
    }
    .chat-container .chat-messages {
        max-width: 100%;
    }
    .input-container {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 0 24px;
    }
    .input-sidebar-spacer {
        display: none !important;
    }
    .input-main-content {
        max-width: 100%;
    }
}

/* ── Loading Overlay ────────────────────────── */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.loading-container {
    text-align: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 32px 48px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: modalIn 0.3s ease;
}

.loading-hourglass {
    font-size: 54px;
    display: inline-block;
    animation: spin-hourglass 2s ease-in-out infinite;
}

@keyframes spin-hourglass {
    0% { transform: rotate(0deg); }
    40% { transform: rotate(180deg); }
    50% { transform: rotate(180deg); }
    90% { transform: rotate(360deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.loading-subtext {
    font-size: 12px;
    color: var(--text-muted);
}
/* Mobile Specific Tweaks for Input */
@media (max-width: 768px) {
    .input-main-content .input-wrapper {
        flex-wrap: nowrap;
        gap: 6px;
    }
    .input-actions {
        width: auto;
        flex: 0 0 auto;
    }
    .input-actions .btn {
        flex: none;
        padding: 9px 12px;
    }
    .textarea-wrapper {
        flex: 1;
        min-width: 0;
    }
    .input-container {
        padding: 0 8px 45px 8px; /* Povečan spodnji odmik, da gumb ne bo več odrezan */
    }
    #btn-about, .settings-fab-container {
        bottom: 130px !important;
    }
}



/* RAG docs moved to settings */
#uploaded-docs .doc-tag {
    display: inline-flex;
    width: fit-content;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    gap: 8px;
}

#uploaded-docs .doc-tag span:nth-child(2) {
    flex: 1;
    min-width: 0;
    text-align: left;
    margin-left: 4px;
}

/* ── Header Dropdown Menu ─────────────────────────────── */
.header-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: rgba(12, 10, 30, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    min-width: 210px;
    border: 1px solid rgba(178, 0, 255, 0.3);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 240, 255, 0.05);
    border-radius: 18px;
    z-index: 10000;
    padding: 8px;
    animation: fadeIn 0.15s ease-out;
}

.dropdown-content.show {
    display: block;
}

.dropdown-item {
    padding: 10px 14px;
    text-decoration: none;
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 10px;
    transition: background-color 0.15s, color 0.15s;
    font-family: var(--font);
}

.dropdown-item:hover {
    background: rgba(0, 240, 255, 0.08);
    color: #00f0ff;
}

.text-danger { color: #f87171 !important; }
.text-danger:hover { background: rgba(239, 68, 68, 0.1) !important; color: #ef4444 !important; }

.dropdown-divider {
    border: none;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
    margin: 6px 4px;
}

/* Floating header mora ohraniti absolutno pozicioniranje */
.floating-header {
    position: absolute !important;
    z-index: 9999 !important;
}

/* doc-processing animation */
.doc-processing { animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.6; } 100% { opacity: 1; } }
.doc-error { border: 1px solid #e74c3c; background-color: #fdf2f0; }
