/* =========================================================================
   Bosna Travel ERP - stilovi aplikacije
   Bez vanjskih zavisnosti: radi i na potpuno izolovanoj mreži.
   ========================================================================= */

:root {
    --font-sans: "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-mono: "Cascadia Mono", Consolas, "Liberation Mono", monospace;

    --c-bg: #f4f6fa;
    --c-surface: #ffffff;
    --c-surface-2: #fafbfd;
    --c-border: #dfe4ed;
    --c-border-strong: #c6cede;
    --c-text: #1b2434;
    --c-text-soft: #5b6679;
    --c-text-faint: #8a94a6;

    --c-primary: #14568c;
    --c-primary-dark: #0f4270;
    --c-primary-soft: #e7f0f9;
    --c-accent: #0d7a5f;
    --c-accent-soft: #e3f4ee;
    --c-warn: #a8620a;
    --c-warn-soft: #fdf1e0;
    --c-danger: #ac2b2b;
    --c-danger-soft: #fbe9e9;
    --c-info: #1d5fa8;
    --c-info-soft: #e8f1fb;

    --radius: 8px;
    --radius-sm: 5px;
    --shadow-sm: 0 1px 2px rgba(20, 30, 50, .06);
    --shadow: 0 2px 10px rgba(20, 30, 50, .08);
    --shadow-lg: 0 12px 32px rgba(20, 30, 50, .16);

    --sidebar-w: 246px;
    --header-h: 56px;
}

[data-theme="dark"] {
    --c-bg: #11151d;
    --c-surface: #1a202b;
    --c-surface-2: #212936;
    --c-border: #2c3542;
    --c-border-strong: #3b4655;
    --c-text: #e6eaf1;
    --c-text-soft: #a5b0c0;
    --c-text-faint: #7d8899;
    --c-primary: #4b93d4;
    --c-primary-dark: #3b7db9;
    --c-primary-soft: #1b2b3d;
    --c-accent: #35b58f;
    --c-accent-soft: #16302a;
    --c-warn: #d99a45;
    --c-warn-soft: #33270f;
    --c-danger: #e06a6a;
    --c-danger-soft: #341c1c;
    --c-info: #5ea1e0;
    --c-info-soft: #16283a;
    --shadow: 0 2px 10px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
}

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

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .6rem; font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
h4 { font-size: .93rem; }
p { margin: 0 0 .75rem; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: linear-gradient(180deg, #123a5e 0%, #0d2c48 100%);
    color: #cfe0ef;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar__brand {
    display: flex; align-items: center; gap: .6rem;
    padding: .95rem 1rem; border-bottom: 1px solid rgba(255,255,255,.1);
    color: #fff; font-weight: 700; letter-spacing: .2px;
}
.sidebar__brand span.mark {
    width: 30px; height: 30px; border-radius: 7px; flex: 0 0 30px;
    background: var(--c-accent); color: #fff;
    display: grid; place-items: center; font-size: .78rem; font-weight: 700;
}
.sidebar__brand small { display: block; font-weight: 400; font-size: .68rem; color: #9fbdd8; }
.sidebar nav { padding: .5rem 0 1.5rem; }
.sidebar .nav-group { padding: .85rem 1rem .3rem; font-size: .66rem; letter-spacing: .09em;
    text-transform: uppercase; color: #7fa4c4; font-weight: 600; }
.sidebar a.nav-link {
    display: flex; align-items: center; gap: .6rem;
    padding: .48rem 1rem; color: #cfe0ef; font-size: .87rem;
    border-left: 3px solid transparent; text-decoration: none;
}
.sidebar a.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.nav-link.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: var(--c-accent); font-weight: 600; }
.sidebar .nav-icon { width: 18px; text-align: center; opacity: .9; font-size: .95rem; }
.sidebar .nav-badge {
    margin-left: auto; background: var(--c-danger); color: #fff;
    border-radius: 10px; padding: 0 .4rem; font-size: .68rem; font-weight: 600;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: var(--header-h);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.1rem; position: sticky; top: 0; z-index: 30;
}
.topbar__title { font-weight: 600; font-size: .98rem; }
.topbar__spacer { flex: 1; }
.topbar__user { display: flex; align-items: center; gap: .55rem; font-size: .84rem; }
.avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--c-primary);
    color: #fff; display: grid; place-items: center; font-size: .72rem; font-weight: 700;
}

.content { padding: 1.1rem 1.25rem 3rem; flex: 1; }

.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.page-head .subtitle { color: var(--c-text-soft); font-size: .85rem; margin: 0; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 1rem;
}
.card__head {
    padding: .7rem 1rem; border-bottom: 1px solid var(--c-border);
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.card__head h2, .card__head h3 { margin: 0; font-size: .95rem; }
.card__head .spacer { flex: 1; }
.card__body { padding: 1rem; }
.card__body--flush { padding: 0; }
.card__foot { padding: .65rem 1rem; border-top: 1px solid var(--c-border); background: var(--c-surface-2); }

.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
@media (max-width: 1100px) { .grid--4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid--sidebar { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; } }

/* ---------- KPI tiles ---------- */
.kpi { background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--radius); padding: .85rem .95rem; box-shadow: var(--shadow-sm); }
.kpi__label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--c-text-faint); font-weight: 600; }
.kpi__value { font-size: 1.5rem; font-weight: 700; margin-top: .25rem; letter-spacing: -.4px; }
.kpi__meta { font-size: .76rem; color: var(--c-text-soft); margin-top: .2rem; }
.kpi--accent { border-left: 3px solid var(--c-accent); }
.kpi--primary { border-left: 3px solid var(--c-primary); }
.kpi--warn { border-left: 3px solid var(--c-warn); }
.kpi--danger { border-left: 3px solid var(--c-danger); }

.trend { font-weight: 600; font-size: .76rem; }
.trend--up { color: var(--c-accent); }
.trend--down { color: var(--c-danger); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .855rem; }
table.table th, table.table td { padding: .5rem .7rem; border-bottom: 1px solid var(--c-border); text-align: left; vertical-align: top; }
table.table thead th {
    background: var(--c-surface-2); font-weight: 600; font-size: .74rem;
    text-transform: uppercase; letter-spacing: .04em; color: var(--c-text-soft);
    white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.table tbody tr:hover { background: var(--c-surface-2); }
table.table tfoot td { font-weight: 700; background: var(--c-surface-2); border-top: 2px solid var(--c-border-strong); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.muted { color: var(--c-text-soft); }
.faint { color: var(--c-text-faint); font-size: .8rem; }
.mono { font-family: var(--font-mono); font-size: .82rem; }
.table--compact th, .table--compact td { padding: .34rem .5rem; }
.table--striped tbody tr:nth-child(even) { background: var(--c-surface-2); }
.row-total td { font-weight: 700; background: var(--c-primary-soft); }
.sort-link { color: inherit; }

/* ---------- badges / pills ---------- */
.badge {
    display: inline-block; padding: .12rem .48rem; border-radius: 20px;
    font-size: .72rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.badge-success { background: var(--c-accent-soft); color: var(--c-accent); }
.badge-info    { background: var(--c-info-soft); color: var(--c-info); }
.badge-warning { background: var(--c-warn-soft); color: var(--c-warn); }
.badge-danger  { background: var(--c-danger-soft); color: var(--c-danger); }
.badge-secondary { background: var(--c-surface-2); color: var(--c-text-soft); border: 1px solid var(--c-border); }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
    padding: .42rem .85rem; border-radius: var(--radius-sm); border: 1px solid var(--c-border-strong);
    background: var(--c-surface); color: var(--c-text); font-size: .85rem; font-weight: 500;
    cursor: pointer; text-decoration: none; font-family: inherit; line-height: 1.4;
    transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--c-surface-2); text-decoration: none; }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn--primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); }
.btn--accent { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.btn--accent:hover { filter: brightness(.94); }
.btn--danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.btn--danger:hover { filter: brightness(.94); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--c-text-soft); }
.btn--ghost:hover { background: var(--c-surface-2); }
.btn--sm { padding: .22rem .55rem; font-size: .78rem; }
.btn--block { width: 100%; }
.btn-group { display: inline-flex; gap: .35rem; flex-wrap: wrap; }

/* ---------- forms ---------- */
.form-grid { display: grid; gap: .8rem 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-full { grid-column: 1 / -1; }
@media (max-width: 820px) { .form-grid, .form-grid--3, .form-grid--4 { grid-template-columns: 1fr; }
    .form-grid .span-2, .form-grid .span-full { grid-column: auto; } }

.field { display: flex; flex-direction: column; gap: .25rem; }
.field > label { font-size: .78rem; font-weight: 600; color: var(--c-text-soft); }
.field .hint { font-size: .74rem; color: var(--c-text-faint); }
.field .error { font-size: .75rem; color: var(--c-danger); font-weight: 500; }
.required::after { content: " *"; color: var(--c-danger); }

input[type="text"], input[type="number"], input[type="email"], input[type="password"],
input[type="date"], input[type="search"], input[type="tel"], input[type="url"],
input[type="file"], select, textarea {
    width: 100%; padding: .42rem .6rem; font-size: .86rem; font-family: inherit;
    color: var(--c-text); background: var(--c-surface);
    border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft);
}
input[readonly], input:disabled, select:disabled, textarea:disabled {
    background: var(--c-surface-2); color: var(--c-text-soft); cursor: not-allowed;
}
input.is-invalid, select.is-invalid, textarea.is-invalid { border-color: var(--c-danger); }
textarea { min-height: 74px; resize: vertical; }
select[multiple] { min-height: 130px; }
.check { display: flex; align-items: center; gap: .45rem; font-size: .85rem; }
.check input { width: auto; }

.filters {
    display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end;
    padding: .75rem 1rem; background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--radius); margin-bottom: 1rem;
}
.filters .field { min-width: 150px; }
.filters .field--wide { min-width: 240px; flex: 1; }

/* ---------- alerts ---------- */
.alert {
    padding: .6rem .85rem; border-radius: var(--radius-sm); margin-bottom: .8rem;
    border: 1px solid transparent; font-size: .87rem;
}
.alert-success { background: var(--c-accent-soft); border-color: var(--c-accent); color: var(--c-accent); }
.alert-info    { background: var(--c-info-soft); border-color: var(--c-info); color: var(--c-info); }
.alert-warning { background: var(--c-warn-soft); border-color: var(--c-warn); color: var(--c-warn); }
.alert-danger  { background: var(--c-danger-soft); border-color: var(--c-danger); color: var(--c-danger); }
.alert strong { font-weight: 700; }

.empty { padding: 2.2rem 1rem; text-align: center; color: var(--c-text-faint); }
.empty__icon { font-size: 1.8rem; display: block; margin-bottom: .4rem; opacity: .5; }

/* ---------- pagination ---------- */
.pagination { display: flex; gap: .25rem; align-items: center; flex-wrap: wrap; padding: .6rem 1rem; }
.pagination a, .pagination span {
    padding: .25rem .55rem; border-radius: var(--radius-sm); font-size: .82rem;
    border: 1px solid var(--c-border); color: var(--c-text-soft); background: var(--c-surface);
}
.pagination a:hover { background: var(--c-surface-2); text-decoration: none; }
.pagination .is-current { background: var(--c-primary); border-color: var(--c-primary); color: #fff; font-weight: 600; }
.pagination .info { border: none; background: none; margin-right: auto; color: var(--c-text-faint); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--c-border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a {
    padding: .45rem .85rem; font-size: .86rem; color: var(--c-text-soft);
    border-bottom: 2px solid transparent; text-decoration: none;
}
.tabs a:hover { color: var(--c-text); }
.tabs a.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 600; }

/* ---------- charts (pure CSS) ---------- */
.bars { display: flex; align-items: flex-end; gap: .35rem; height: 150px; padding-top: .5rem; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .25rem; min-width: 0; }
.bars .bar__fill { width: 100%; background: var(--c-primary); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars .bar__fill--accent { background: var(--c-accent); }
.bars .bar__label { font-size: .64rem; color: var(--c-text-faint); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bars .bar:hover .bar__fill { filter: brightness(1.15); }

.progress { height: 7px; background: var(--c-surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--c-border); }
.progress__fill { height: 100%; background: var(--c-accent); }
.progress__fill--warn { background: var(--c-warn); }
.progress__fill--danger { background: var(--c-danger); }

/* ---------- document (invoice / voucher) print ---------- */
.document {
    background: #fff; color: #101010; max-width: 820px; margin: 0 auto 1.5rem;
    padding: 26px 30px; border: 1px solid var(--c-border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.document h1 { font-size: 1.25rem; }
.document__head { display: flex; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.2rem; }
.document__parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1rem; }
.document__party { border: 1px solid #d8dde6; border-radius: 6px; padding: .6rem .75rem; }
.document__party h4 { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: #6b7484; margin-bottom: .3rem; }
.document table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.document table th { background: #eef2f7; border: 1px solid #d3dae4; padding: .38rem .5rem; text-align: left; font-size: .72rem; text-transform: uppercase; }
.document table td { border: 1px solid #d3dae4; padding: .38rem .5rem; }
.document__totals { margin-left: auto; width: 320px; margin-top: .9rem; }
.document__totals td { border: none; padding: .18rem .3rem; }
.document__totals tr.grand td { border-top: 2px solid #101010; font-weight: 700; font-size: .95rem; padding-top: .35rem; }
.document__note { margin-top: 1rem; font-size: .78rem; color: #444; border-left: 3px solid #d3dae4; padding-left: .6rem; }
.document__sign { display: flex; justify-content: space-between; margin-top: 2.4rem; font-size: .78rem; }
.document__sign div { width: 40%; text-align: center; border-top: 1px solid #101010; padding-top: .25rem; }

.receipt-paper {
    font-family: var(--font-mono); font-size: .76rem; white-space: pre;
    background: #fff; color: #111; border: 1px dashed #999; border-radius: 4px;
    padding: 12px 14px; max-width: 380px; overflow-x: auto;
}

/* ---------- misc ---------- */
.stack > * + * { margin-top: .6rem; }
.inline-list { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .84rem; }
.inline-list dt { color: var(--c-text-faint); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.inline-list dd { margin: 0; font-weight: 600; }
.definition { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: .3rem .8rem; font-size: .85rem; }
.definition dt { color: var(--c-text-soft); }
.definition dd { margin: 0; font-weight: 500; }
.divider { height: 1px; background: var(--c-border); margin: 1rem 0; }
.text-success { color: var(--c-accent); }
.text-danger { color: var(--c-danger); }
.text-warn { color: var(--c-warn); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.w-100 { width: 100%; }
.flex { display: flex; gap: .5rem; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.flex-wrap { flex-wrap: wrap; }

/* ---------- login / install ---------- */
.auth {
    min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
    background: linear-gradient(135deg, #123a5e 0%, #0a2138 100%);
}
.auth__card {
    background: var(--c-surface); border-radius: 12px; box-shadow: var(--shadow-lg);
    width: 100%; max-width: 400px; padding: 1.8rem;
}
.auth__brand { text-align: center; margin-bottom: 1.3rem; }
.auth__brand .mark {
    width: 46px; height: 46px; border-radius: 11px; background: var(--c-accent); color: #fff;
    display: grid; place-items: center; font-weight: 700; margin: 0 auto .6rem; font-size: .95rem;
}
.auth__card .field { margin-bottom: .8rem; }
.installer { max-width: 780px; margin: 2rem auto; }
.steps { display: flex; gap: .35rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.steps .step {
    flex: 1; min-width: 110px; padding: .45rem .6rem; font-size: .78rem; text-align: center;
    background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--radius-sm); color: var(--c-text-faint);
}
.steps .step.is-active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; font-weight: 600; }
.steps .step.is-done { background: var(--c-accent-soft); border-color: var(--c-accent); color: var(--c-accent); }

.check-list { list-style: none; padding: 0; margin: 0; font-size: .86rem; }
.check-list li { display: flex; justify-content: space-between; gap: 1rem;
    padding: .38rem 0; border-bottom: 1px dashed var(--c-border); }
.check-list li:last-child { border-bottom: none; }

.log-output {
    font-family: var(--font-mono); font-size: .78rem; background: #10151d; color: #d5e0ea;
    padding: .8rem; border-radius: var(--radius-sm); max-height: 340px; overflow: auto; white-space: pre-wrap;
}

/* ---------- print ---------- */
@media print {
    .sidebar, .topbar, .page-actions, .filters, .pagination, .no-print, .tabs { display: none !important; }
    body { background: #fff; font-size: 11pt; }
    .content { padding: 0; }
    .card { border: none; box-shadow: none; margin: 0; }
    .document { border: none; box-shadow: none; max-width: none; padding: 0; }
    table.table thead th { position: static; background: #eee !important; color: #000; }
    a { color: #000; text-decoration: none; }
    .page-break { page-break-before: always; }
}

@media (max-width: 900px) {
    .sidebar { position: fixed; z-index: 60; transform: translateX(-100%); transition: transform .18s ease; }
    .sidebar.is-open { transform: translateX(0); }
    .app.has-sidebar-open::after {
        content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55;
    }
    .menu-toggle { display: inline-flex !important; }
}
.menu-toggle { display: none; }

/* ---------- language switcher ---------- */
.lang-switch { display: flex; align-items: center; }
.lang-switch__select {
    width: auto; padding: .22rem 1.4rem .22rem .45rem; font-size: .78rem;
    border-radius: var(--radius-sm); border: 1px solid var(--c-border);
    background: var(--c-surface); color: var(--c-text-soft); cursor: pointer;
}
.lang-switch__select:hover { background: var(--c-surface-2); color: var(--c-text); }
@media (max-width: 640px) { .lang-switch__select { max-width: 90px; } }

/* Language switcher under the sign-in card */
.auth__foot { display: flex; justify-content: center; margin-top: .9rem; }
.auth__foot .lang-switch__select { min-width: 10rem; }
