* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f5f7fa;
    color: #1f2933;
    height: 100%;
}

a { color: #1769aa; text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .8rem 0; font-weight: 600; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }

/* Layout: top bar + content */
.layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header.topbar {
    display: flex;
    align-items: center;
    background: #1c2530;
    color: #cbd5e1;
    padding: 0 1rem;
    height: 52px;
    border-bottom: 1px solid #2c3a4a;
    position: sticky;
    top: 0;
    z-index: 3000;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff !important;
    text-decoration: none;
    padding: 0 .4rem;
}
.brand:hover { text-decoration: none; }
.brand .logo { font-size: 1.25rem; }

nav.topnav { display: flex; gap: .15rem; }
nav.topnav-desktop { flex: 1; overflow-x: auto; }
nav.topnav-mobile { display: none; }
nav.topnav .stavka {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem .85rem;
    color: #cbd5e1;
    border-bottom: 3px solid transparent;
    font-size: .9rem;
    white-space: nowrap;
    text-decoration: none;
    border-radius: 0;
}
nav.topnav .stavka:hover { background: #2a3441; text-decoration: none; color: #fff; }
nav.topnav .stavka.active { background: #2a3441; border-bottom-color: #f59e0b; color: #fff; }
nav.topnav .stavka.active .ikona { color: #f59e0b; }
nav.topnav .ikona { font-size: 1rem; }

.user-info { display: flex; align-items: center; gap: 1rem; font-size: .88rem; margin-left: auto; }
.user-info .korisnik { color: #cbd5e1; }
.user-info .odjava { color: #f87171; }

.hamburger { display: none; }
.topbar-backdrop { display: none; }

main.content { padding: 1rem 1.2rem; flex: 1; background: #f5f7fa; }
article.content { padding: 1rem 1.2rem; flex: 1; }

/* Forme */
.polje { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.polje label { font-size: .85rem; color: #475569; font-weight: 500; }
.polje input, .polje select, .polje textarea {
    padding: .55rem .7rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: .95rem;
    background: #fff;
}
.polje input:focus, .polje select:focus, .polje textarea:focus {
    outline: none;
    border-color: #4a9eff;
    box-shadow: 0 0 0 3px rgba(74,158,255,.18);
}

button.primary, .btn-primary {
    padding: .55rem 1.2rem;
    background: #1769aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: .95rem;
    font-weight: 500;
}
button.primary:hover { background: #135587; }

button.secondary {
    padding: .55rem 1.2rem;
    background: #fff;
    color: #1f2933;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    font-size: .95rem;
}

.greska {
    padding: .6rem .8rem;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: .9rem;
}

.validation-message { color: #b91c1c; font-size: .85rem; }

/* Prijava */
.prijava-host {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1c2530 0%, #2a3441 100%);
}

.prijava-kartica {
    background: #fff;
    padding: 2.2rem 2rem;
    border-radius: 8px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.18);
    width: 100%;
    max-width: 360px;
}
.prijava-kartica h1 { text-align: center; margin-bottom: .2rem; color: #1c2530; }
.prijava-kartica .podnaslov {
    text-align: center;
    color: #64748b;
    margin: 0 0 1.6rem 0;
    font-size: .9rem;
}
.prijava-kartica button.primary { width: 100%; padding: .65rem; font-size: 1rem; }

/* Tablica */
table.lista {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
table.lista thead th {
    background: #f1f5f9;
    color: #475569;
    text-align: left;
    padding: .7rem 1rem;
    font-weight: 600;
    font-size: .85rem;
    border-bottom: 1px solid #e2e8f0;
}
table.lista tbody td {
    padding: .65rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: .92rem;
}
table.lista tbody tr:hover { background: #f8fafc; }

.bedz { padding: .15rem .55rem; border-radius: 12px; font-size: .78rem; font-weight: 600; }
.bedz.zelen { background: #dcfce7; color: #166534; }
.bedz.crven { background: #fef2f2; color: #991b1b; }
.bedz.sivi { background: #f1f5f9; color: #475569; }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ========== FULL-SCREEN MAPA ========== */
body.fullscreen-mapa header.topbar,
body.fullscreen-mapa nav.topnav-mobile,
body.fullscreen-mapa .mapa-zaglavlje,
body.fullscreen-mapa .vozila-panel,
body.fullscreen-mapa .toast-spremnik { display: none !important; }

body.fullscreen-mapa main.content,
body.fullscreen-mapa article.content { padding: 0 !important; margin: 0 !important; }

body.fullscreen-mapa .mapa-layout { grid-template-columns: 1fr !important; gap: 0 !important; }

body.fullscreen-mapa .mapa-kontejner {
    height: 100vh !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

body.fullscreen-mapa .mapa-kontrole { top: 84px; right: 12px; }
body.fullscreen-mapa .opcije-sadrzaj { top: 84px; right: 50px; }

/* OSM overlay preko Esri satelita -> blend mode da bijele povrsine prolaze */
.osm-multiply { mix-blend-mode: multiply; }
.osm-multiply img { mix-blend-mode: multiply; }

/* ========== MOBILE / RESPONSIVE ========== */
@media (max-width: 900px) {
    header.topbar { gap: .5rem; padding: 0 .7rem; }

    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 34px;
        height: 34px;
        background: transparent;
        border: 1px solid #475569;
        border-radius: 5px;
        cursor: pointer;
        padding: .45rem .4rem;
        order: 1;
    }
    .hamburger span {
        display: block;
        width: 100%;
        height: 2px;
        background: #fff;
        border-radius: 2px;
    }

    .brand { order: 0; }

    nav.topnav-desktop { display: none; }

    nav.topnav-mobile {
        display: flex;
        position: fixed;
        top: 52px;
        left: 0;
        right: 0;
        background: #1c2530;
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height .25s ease;
        z-index: 9000;
        padding: 0;
        pointer-events: auto;
    }
    .layout.sidebar-open nav.topnav-mobile {
        max-height: 500px;
        border-bottom: 1px solid #2c3a4a;
    }
    nav.topnav-mobile .stavka {
        padding: .9rem 1.2rem;
        border-bottom: 1px solid #2c3a4a;
        border-radius: 0;
        color: #fff;
    }
    nav.topnav-mobile .stavka.active { background: #2a3441; border-left: 3px solid #f59e0b; }

    .topbar-backdrop {
        display: block;
        position: fixed;
        top: 52px; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.45);
        z-index: 8000;
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }
    .layout.sidebar-open .topbar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .user-info .korisnik { display: none; }
    main.content { padding: .8rem .7rem; }

    article.content { padding: 1rem .9rem; }
    h1 { font-size: 1.3rem; }

    /* Tablice — horizontalan scroll */
    table.lista { display: block; overflow-x: auto; white-space: nowrap; }

    /* Forme — single column */
    .polje input, .polje select, .polje textarea {
        font-size: 1rem;
        padding: .65rem .7rem;
    }
    button.primary, button.secondary {
        font-size: 1rem;
        padding: .65rem 1rem;
    }

    /* Filteri stack-aju */
    .filteri { gap: .6rem; }
    .filter { width: 100%; }
    .filter input, .filter select { width: 100%; }

    /* Mapa zauzima manji ekran */
    .mapa-kontejner { height: calc(100vh - 180px); }
    .ruta-mapa-kontejner { height: 55vh; }
}

@media (max-width: 600px) {
    .povijest-sazetak { grid-template-columns: repeat(2, 1fr); }
    .mapa-zaglavlje { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .mapa-status { flex-wrap: wrap; }
}

.jopa-marker-tooltip {
    background: #fff;
    border: none;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
    padding: .5rem .7rem;
    color: #1f2933;
}
.jopa-marker-tooltip:before {
    border-top-color: #fff !important;
}

.jopa-kontrole a {
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    text-decoration: none;
    font-size: 16px;
    color: #1f2933;
    background: #fff;
    display: block;
    border-bottom: 1px solid #ddd;
}
.jopa-kontrole a:last-child { border-bottom: none; }
.jopa-kontrole a:hover { background: #f1f5f9; }
