/* =====================================================================
   DVFlow – Maps (vrij ingedeelde statusschermen, zoals PRTG Maps)
   Opbouw: .map-host > .map-scaler > .map-zoomer (scale via maps.js) > .map > .mi (items)
   ===================================================================== */

/* ---------- pagina's */
.page--full.map-page { overflow: hidden; padding-bottom: 0; }
.page--full.map-page > .map-host { flex: 1 1 0; min-height: 0; }
.map-page--kiosk { position: relative; height: 100vh; display: flex; flex-direction: column; background: #05080b; }
.map-page--kiosk > .map-host { flex: 1 1 0; min-height: 0; }
.map-kiosk-exit { position: fixed; top: 8px; right: 8px; z-index: 50; width: 28px; height: 28px; display: grid; place-items: center;
    border-radius: 50%; background: rgba(0, 0, 0, .35); color: rgba(255, 255, 255, .55); opacity: 0; transition: opacity .2s; }
.map-page--kiosk:hover .map-kiosk-exit { opacity: 1; }
.public-main { min-height: 100vh; background: #05080b; }
.public-missing { color: #c9d2d8; font-size: 18px; padding: 48px; text-align: center; }

/* ---------- host en schalen */
.map-host { position: relative; overflow: auto; background: #05080b; border-radius: var(--radius); }
.map-host--view { background: transparent; }
.map-page--kiosk .map-host--view { background: #05080b; }
.map-host--fit { overflow: hidden; display: flex; align-items: flex-start; justify-content: center; }
.map-page--kiosk .map-host { border-radius: 0; }
.map-scaler { position: relative; flex: none; margin: 0 auto; }
.map-zoomer { position: absolute; left: 0; top: 0; }

/* ---------- de map */
.map { position: relative; isolation: isolate; overflow: hidden; font-family: var(--font); --mi-text: #e6ecf0; --mi-muted: #8d9aa4;
    --mi-card: rgba(255, 255, 255, .035); --mi-line: rgba(255, 255, 255, .08); color: var(--mi-text); }
.map--light { --mi-text: #1b232c; --mi-muted: #657782; --mi-card: #ffffff; --mi-line: #e1e6ea; }
.map--design { background-image: linear-gradient(rgba(127, 140, 150, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127, 140, 150, .12) 1px, transparent 1px) !important; background-size: 10px 10px !important; }

.mi { position: absolute; box-sizing: border-box; overflow: hidden; }
.mi-fill { position: absolute; inset: 0; }
.mi-box { position: absolute; inset: 0; box-sizing: border-box; }
.mi--filled { border-radius: 8px; }
.map--design .mi { outline: 1px dashed rgba(127, 140, 150, .45); overflow: visible; cursor: move; }
.map--design .mi > *:not(.mi-h) { pointer-events: none; overflow: hidden; }
.map--design .mi.is-selected { outline: 2px solid #3b8eea; z-index: 9999 !important; }
.mi-h { position: absolute; width: 10px; height: 10px; background: #fff; border: 2px solid #3b8eea; border-radius: 2px; z-index: 2; }
.mi-h--nw { left: -6px; top: -6px; cursor: nwse-resize; }
.mi-h--n { left: calc(50% - 5px); top: -6px; cursor: ns-resize; }
.mi-h--ne { right: -6px; top: -6px; cursor: nesw-resize; }
.mi-h--e { right: -6px; top: calc(50% - 5px); cursor: ew-resize; }
.mi-h--se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.mi-h--s { left: calc(50% - 5px); bottom: -6px; cursor: ns-resize; }
.mi-h--sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.mi-h--w { left: -6px; top: calc(50% - 5px); cursor: ew-resize; }

.mi-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px; text-align: center;
    font-size: 13px; color: var(--mi-muted); }
.map--design .mi-empty { border: 1px dashed var(--mi-line); }
.mi-empty--frame { flex-direction: column; background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(127, 140, 150, .06) 10px 20px); }
.mi-placeholder { opacity: .4; }

/* tekst, afbeelding, klok, webpagina */
.mi-text { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; line-height: 1.15; white-space: pre-wrap;
    word-break: break-word; letter-spacing: -.01em; }
.mi-img { width: 100%; height: 100%; display: block; user-select: none; }
.mi-clock { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; }
.mi-clock__time { font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.mi-clock__date { margin-top: 6px; color: var(--mi-muted); text-transform: capitalize; }
.mi-frame { width: 100%; height: 100%; border: 0; display: block; background: transparent; }

/* kaart met titel (grafiek, boom, alarmen, blokken) */
.mi-card { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--mi-card); border: 1px solid var(--mi-line);
    border-radius: 8px; overflow: hidden; }
.mi-card--flat { background: transparent; border: 0; border-radius: 0; }
.mi-card__body { flex: 1 1 0; min-height: 0; padding: 4px 10px 6px; }
.mi-title { flex: none; height: 26px; display: flex; align-items: center; gap: 8px; padding: 0 10px; font-size: 13px; cursor: pointer;
    white-space: nowrap; overflow: hidden; }
.mi-card--flat .mi-title { padding: 0 2px; }
.mi-title b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.mi-title span { color: var(--mi-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }

/* grafieken op een donkere map */
.map--dark .lc-svg .axis { fill: #8d9aa4; }
.map--dark .lc-svg .grid { stroke: rgba(255, 255, 255, .07); }
.map--dark .lc-svg .grid--base, .map--dark .lc-svg .tick { stroke: rgba(255, 255, 255, .16); }
.map--dark .lc-svg .lc-empty { fill: #657782; }
.map--dark .chart-legend, .map--dark .lc-stats { color: #8d9aa4; }
.map--dark .lc-stats b { color: #e6ecf0; }
.map--dark .lc-cross { stroke: #8d9aa4; }
.mi .lc-stats { font-size: 11.5px; gap: 12px; }

/* statusicoon (zoals de PRTG-statusiconen) */
.mi-status { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 6px;
    border-radius: 8px; color: #fff; cursor: pointer; text-align: center; background: var(--st-unknown); }
.mi-status.st-up { background: var(--st-up); }
.mi-status.st-warning { background: var(--st-warning); color: #3d2e00; }
.mi-status.st-down { background: var(--st-down); animation: mi-pulse 2s ease-in-out infinite; }
.mi-status.st-downack { background: var(--st-downack); }
.mi-status.st-unusual { background: var(--st-unusual); }
.mi-status.st-paused { background: var(--st-paused); }
.mi-status__icon { display: flex; align-items: center; gap: 6px; font-size: 26px; font-weight: 700; line-height: 1; }
.mi-status__name { font-size: 14px; font-weight: 600; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-status__value { font-size: 12px; opacity: .9; }
@keyframes mi-pulse { 0%, 100% { filter: none; } 50% { filter: brightness(1.18); } }

/* statusblokken (treemap) */
.mi-tm { position: relative; }
.tm-cell { position: absolute; box-sizing: border-box; border: 1px solid rgba(0, 0, 0, .35); padding: 3px 5px; overflow: hidden; cursor: pointer;
    background: var(--st-unknown); color: #fff; transition: filter .15s; }
.map--light .tm-cell { border-color: #fff; }
.tm-cell:hover { filter: brightness(1.12); }
.tm-cell.st-up { background: var(--st-up); }
.tm-cell.st-warning { background: var(--st-warning); color: #3d2e00; }
.tm-cell.st-down { background: var(--st-down); }
.tm-cell.st-downack { background: var(--st-downack); }
.tm-cell.st-unusual { background: var(--st-unusual); }
.tm-cell.st-paused { background: var(--st-paused); }
.tm-cell__name { display: block; font-size: 11px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .25); }
.tm-cell.st-warning .tm-cell__name { text-shadow: none; }

/* apparaatboom */
.mi-tree { flex: 1 1 0; min-height: 0; overflow: hidden; padding: 2px 8px 8px; font-size: 12px; }
.mt-group { margin: 8px 0 2px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--mi-muted); }
.mt-dev { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding: 2px 0; cursor: pointer; white-space: nowrap; overflow: hidden; }
.mt-dev b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.mt-host { color: var(--mi-muted); font-size: 11px; }
.mt-sen { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 2px 0 2px 14px;
    border-bottom: 1px solid var(--mi-line); cursor: pointer; }
.mt-sen:last-child { border-bottom: 0; }
.mt-sq { width: 10px; height: 10px; border-radius: 2px; flex: none; background: var(--st-unknown); }
.mt-sq.st-up { background: var(--st-up); } .mt-sq.st-warning { background: var(--st-warning); } .mt-sq.st-down { background: var(--st-down); }
.mt-sq.st-downack { background: var(--st-downack); } .mt-sq.st-unusual { background: var(--st-unusual); } .mt-sq.st-paused { background: var(--st-paused); }
.mt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-val { color: var(--mi-muted); font-variant-numeric: tabular-nums; white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }

/* groot getal */
.mi-gauge { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 10px 14px; border-radius: 8px;
    background: var(--mi-card); border: 1px solid var(--mi-line); border-left: 6px solid var(--st-unknown); cursor: pointer; }
.mi-gauge.st-up { border-left-color: var(--st-up); }
.mi-gauge.st-warning { border-left-color: var(--st-warning); }
.mi-gauge.st-down { border-left-color: var(--st-down); background: color-mix(in srgb, var(--st-down) 16%, var(--mi-card)); }
.mi-gauge.st-downack { border-left-color: var(--st-downack); }
.mi-gauge.st-unusual { border-left-color: var(--st-unusual); }
.mi-gauge.st-paused { border-left-color: var(--st-paused); }
.mi-gauge__title { font-size: 13px; font-weight: 600; color: var(--mi-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-gauge__value { font-weight: 700; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mi-gauge__sub { font-size: 12px; color: var(--mi-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* alarmlijst */
.mi-alarms { flex: 1 1 0; min-height: 0; overflow: hidden; padding: 0 8px 6px; }
.mi-alarms__ok { display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%; min-height: 60px; color: var(--st-up); font-weight: 600; }
.ma-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 5px 2px; border-bottom: 1px solid var(--mi-line);
    font-size: 12px; cursor: pointer; }
.ma-row:last-child { border-bottom: 0; }
.ma-row .spill { min-width: 64px; text-align: center; }
.ma-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ma-msg { color: var(--mi-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.ma-since { color: var(--mi-muted); white-space: nowrap; font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* samenvatting (donut) */
.mi-donut { position: absolute; inset: 0; display: flex; }
.mi-donut .donut-card { flex: 1; background: var(--mi-card); border: 1px solid var(--mi-line); box-shadow: none; color: var(--mi-text); }
.mi-donut .donut-card h3 { color: var(--mi-text); }
.map--light .mi-donut .donut-legend a, .map--light .mi-donut .donut-legend .muted { color: var(--mi-text); }

/* ---------- designer */
.page--full > .md { flex: 1 1 0; min-height: 0; }
.md { display: grid; grid-template-columns: 190px minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr); gap: 12px; min-height: 0; }
.md-palette, .md-props { background: var(--white, #fff); border: 1px solid var(--slate-200); border-radius: var(--radius); overflow-y: auto; min-height: 0; }
.md-palette { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.md-palette__title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--slate-500); padding: 2px 8px 6px; }
.md-add { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; background: none; border-radius: var(--radius-sm);
    font: inherit; font-size: 13px; color: var(--slate-800); text-align: left; cursor: pointer; }
.md-add:hover { background: var(--slate-50); color: #1f6fb2; }
.md-center { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
.md-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.md-sep { width: 1px; height: 22px; background: var(--slate-200); }
.map-host--design { flex: 1 1 0; min-height: 0; outline: none; padding: 16px; background: var(--slate-100, #eef1f4); border: 1px solid var(--slate-200, #e1e6ea); }
.map-host--design:focus-visible { box-shadow: 0 0 0 2px #3b8eea inset; }
.md-props { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.md-props .field { margin: 0; }
.md-props__head { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--slate-100); }
.md-props__head .md-link { margin-left: auto; }
.md-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.md-color { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.md-color input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var(--slate-200); border-radius: 4px; background: none; cursor: pointer; }
.md-link { border: 0; background: none; padding: 0; color: #1f6fb2; font: inherit; font-size: 12.5px; cursor: pointer; }
.md-link:hover { text-decoration: underline; }
.md-dirty { font-size: 12.5px; color: var(--st-unusual-ink); font-weight: 600; margin-right: 4px; }

@media (max-width: 1100px) {
    .md { grid-template-columns: 150px minmax(0, 1fr) 260px; }
}
