:root {
    --icp-green: #2e6b30;
    --icp-green-dark: #1f4a21;
    /* poveznice usklađene s početnom stranicom (home.css: .read-more, .link-card a) */
    --icp-link: #5E8C00;
    --icp-link-hover: #6FA700;
    --bs-link-color: var(--icp-link);
    --bs-link-color-rgb: 94, 140, 0;
    --bs-link-hover-color: var(--icp-link-hover);
    --bs-link-hover-color-rgb: 111, 167, 0;
}

a {
    text-decoration: none;
}

main a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link) {
    font-weight: 500;
}

a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):hover {
    text-decoration: underline;
}

body {
    background: #f4f6f4;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.icp-header {
    background: linear-gradient(135deg, var(--icp-green-dark), var(--icp-green));
    color: #fff;
}

.icp-logo {
    max-height: 56px;
}

.icp-logo-badge {
    background: #fff;
    border-radius: .375rem;
    padding: 4px 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

.icp-nav {
    background: rgba(0, 0, 0, .25);
    --bs-navbar-padding-y: .2rem;
    --bs-navbar-nav-link-padding-y: .35rem;
    --bs-navbar-nav-link-padding-x: .9rem;
    font-size: .925rem;
}

.icp-nav .icp-avatar {
    width: 22px;
    height: 22px;
    font-size: .72rem;
}

.icp-nav .nav-link.active {
    font-weight: 600;
}

/* korisnički izbornik */
.icp-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #93C600;
    color: var(--icp-green-dark);
    font-size: .8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.icp-avatar-lg {
    width: 38px;
    height: 38px;
    font-size: 1.05rem;
}

.icp-user-menu {
    min-width: 240px;
    padding: .5rem 0;
    border: 0;
    border-radius: .5rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
}

.icp-user-menu-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .35rem 1rem .5rem;
}

.icp-user-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .45rem 1rem;
}

.icp-user-menu .dropdown-item i {
    width: 1.1rem;
    text-align: center;
    color: var(--icp-green);
}

.icp-user-menu .dropdown-item.text-danger i {
    color: inherit;
}

.icp-user-menu .dropdown-item:hover,
.icp-user-menu .dropdown-item:focus {
    background: #eef4e6;
}

.icp-user-menu .dropdown-item.text-danger:hover {
    background: #fbeaea;
}

.icp-user-menu .dropdown-item.active {
    background: var(--icp-green);
    color: #fff;
}

.icp-user-menu .dropdown-item.active i {
    color: #fff;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 1rem;
}

.card-icp {
    border: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.report-output {
    background: #fff;
    overflow: auto;
}

.status-ok {
    color: #198754;
    font-weight: 600;
}

.status-draft {
    color: #dc3545;
    font-weight: 600;
}

table.dataTable td, table.dataTable th {
    font-size: .875rem;
}

.map-full {
    isolation: isolate;
    height: calc(100vh - 260px);
    min-height: 480px;
    border-radius: .375rem;
}

/* ---- Pregled upisanih podataka (PretragaPloha) ---- */
.icp-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    border-bottom: 1px solid #e9ecef;
}

.icp-toolbar-godina {
    width: auto;
    flex: 0 0 auto;
}

.icp-toolbar-godina .form-select {
    min-width: 110px;
}

.icp-toolbar-search {
    flex: 1 1 320px;
    max-width: 520px;
}

.icp-toolbar .input-group-text {
    background: #fff;
    color: #6c757d;
}

.icp-toolbar-search .input-group-text {
    border-right: 0;
}

.icp-toolbar-search .form-control {
    border-left: 0;
}

.icp-toolbar-select {
    width: auto;
    min-width: 200px;
}

.icp-spin {
    display: inline-block;
    animation: icp-spin .8s linear infinite;
}

@keyframes icp-spin {
    to { transform: rotate(360deg); }
}

.icp-table-wrap {
    padding: 0 1rem 1rem;
}

.icp-table-wrap div.dt-container .dt-layout-row:last-child {
    margin-top: .75rem;
    font-size: .875rem;
    color: #6c757d;
}

.icp-table-wrap div.dt-container div.dt-length select {
    margin-left: .75rem;
    margin-right: .35rem;
}

table.icp-table {
    margin-top: 0 !important;
}

table.icp-table > thead > tr > th {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #6c757d;
    background: #fff;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
    padding-top: .75rem;
    padding-bottom: .6rem;
}

table.icp-table > tbody > tr > td {
    padding-top: .55rem;
    padding-bottom: .55rem;
    border-color: #f0f2f0;
}

table.icp-table > tbody > tr:not(.dtrg-group) {
    cursor: pointer;
}

table.icp-table > tbody > tr:not(.dtrg-group):hover > * {
    --bs-table-bg-state: #f3f8ec;
}

table.icp-table tr.dtrg-group.icp-group > th,
table.icp-table tr.dtrg-group.icp-group > td {
    background: #eef3ea !important;
    color: var(--icp-green-dark);
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding-top: .5rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid #dfe7d8;
}

.icp-group-count {
    display: inline-block;
    margin-left: .4rem;
    padding: 0 .45rem;
    border-radius: 1rem;
    background: var(--icp-green);
    color: #fff;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: 0;
}

/* stupci */
table.icp-table th.icp-col-id,
table.icp-table td.icp-col-id {
    width: 80px;
    text-align: left !important;
    font-variant-numeric: tabular-nums;
}

table.icp-table th.icp-col-num,
table.icp-table td.icp-col-num {
    width: 90px;
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

table.icp-table td.icp-col-lokacija {
    min-width: 260px;
    width: 40%;
}

table.icp-table th.icp-col-datum,
table.icp-table td.icp-col-datum {
    width: 115px;
    text-align: right !important;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

table.icp-table th.icp-col-tip,
table.icp-table td.icp-col-tip {
    width: 90px;
    text-align: center !important;
    white-space: nowrap;
}

table.icp-table th.icp-col-status,
table.icp-table td.icp-col-status {
    width: 90px;
    text-align: center !important;
}

.icp-badge-ok,
.icp-badge-draft {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-weight: 600;
    font-size: .72rem;
    padding: .3em .7em;
}

.icp-badge-ok {
    background: #e3f3e6;
    color: #146c2e;
}

.icp-badge-draft {
    background: #fdecea;
    color: #b02a37;
}

/* ---- Pregled podataka o točkama (Plohe): karta s bočnim panelom ---- */
.plohe-map-wrap {
    position: relative;
    overflow: hidden;
    border-radius: .5rem;
    /* vlastiti stacking context: Leaflet kontrole i panel (z-index do 1000) ostaju ispod padajućih izbornika zaglavlja */
    isolation: isolate;
}

.plohe-map {
    height: calc(100vh - 250px);
    min-height: 520px;
}

.plohe-panel {
    position: absolute;
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: 320px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, .97);
    border-radius: .5rem;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .18);
    overflow: hidden;
}

.plohe-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem .6rem .5rem .9rem;
    border-bottom: 1px solid #e9ecef;
}

.plohe-panel-filters {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .6rem .75rem;
    border-bottom: 1px solid #e9ecef;
    background: #fafbfa;
}

.plohe-panel-filters .input-group-text {
    background: #fff;
    color: #6c757d;
}

.plohe-list {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.plohe-list-msg {
    padding: 1rem;
    color: #6c757d;
    font-size: .875rem;
}

.plohe-item {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .5rem .6rem .5rem .8rem;
    border-bottom: 1px solid #f0f2f0;
    border-left: 3px solid transparent;
    cursor: pointer;
    outline: none;
}

.plohe-item:hover,
.plohe-item:focus-visible {
    background: #f3f8ec;
}

.plohe-item.active {
    background: #e6f0db;
    border-left-color: var(--icp-green);
}

.plohe-item-tip {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    margin-top: .4rem;
    border-radius: 50%;
    border: 1px solid #888;
}

/* iste boje kao točke na karti (icpmap.js) */
.plohe-item-tip.tip-4 { background: royalblue; }
.plohe-item-tip.tip-16 { background: red; }
.plohe-item-tip.tip-l2 { background: red; }

.plohe-item-body {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.plohe-item-title {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    font-size: .9rem;
}

.plohe-item-ops {
    font-size: .75rem;
    color: #6c757d;
    font-variant-numeric: tabular-nums;
}

.plohe-item-ops::before {
    content: "op. ";
}

.plohe-item-sub {
    font-size: .8rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plohe-item-usp {
    font-size: .72rem;
    color: #6c757d;
}

main a.plohe-item-edit {
    flex-shrink: 0;
    align-self: center;
    padding: .2rem .35rem;
    border-radius: .25rem;
    color: #6c757d;
    opacity: .55;
}

.plohe-item:hover a.plohe-item-edit,
.plohe-item.active a.plohe-item-edit {
    opacity: 1;
}

main a.plohe-item-edit:hover {
    background: #fff;
    color: var(--icp-green);
    text-decoration: none;
}

.leaflet-container .leaflet-popup-content a.btn {
    text-decoration: none;
}

.leaflet-container .leaflet-popup-content a.btn-success {
    color: #fff;
}

.leaflet-container .leaflet-popup-content a.btn-outline-success {
    color: var(--bs-success);
}

.leaflet-container .leaflet-popup-content a.btn-outline-success:hover {
    color: #fff;
}

.icp-poligon-tip {
    font-weight: 600;
}

.plohe-panel-open {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1000;
    font-weight: 600;
}

/* na mobitelu panel ide ispod karte */
@media (max-width: 767.98px) {
    .plohe-map {
        height: 55vh;
        min-height: 320px;
    }

    .plohe-panel {
        position: static;
        width: auto;
        max-height: 60vh;
        box-shadow: none;
        border-radius: 0;
        border-top: 1px solid #e9ecef;
    }

    .plohe-panel-toggle,
    .plohe-panel-open {
        display: none !important;
    }
}
