/* Bebyggelsesprocent – værktøj. Arver temaets variabler hvis de findes. */
.bp-tool {
	--bp-primary: var(--c-primary, #0059b3);
	--bp-primary-dark: var(--c-primary-dark, #004993);
	--bp-text: var(--c-text, #1a1a1a);
	--bp-muted: var(--c-muted, #545454);
	--bp-border: var(--c-border, #bfbfbf);
	--bp-bg-alt: var(--c-bg-alt, #f5f5f5);
	--bp-success: #358000;
	--bp-success-bg: #eaf3e0;
	--bp-warn: #8a5a00;
	--bp-warn-bg: #fff3d6;
	--bp-error: #b51d09;
	--bp-error-bg: #fbe9e6;
	--bp-radius: 4px;
	color: var(--bp-text);
	font-size: 1rem;
	line-height: 1.5;
}
.bp-tool *, .bp-tool *::before, .bp-tool *::after { box-sizing: border-box; }
.bp-tool .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }

/* Søg */
.bp-search { background: #fff; border: 1px solid var(--bp-border); border-top: 6px solid var(--bp-primary); padding: 24px; border-radius: var(--bp-radius); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.bp-search__title { margin: 0 0 16px; font-size: 1.5rem; line-height: 1.25; }
.bp-label { display: block; font-weight: 600; margin-bottom: 2px; }
.bp-hint { margin: 0 0 8px; color: var(--bp-muted); font-size: .9375rem; }
.bp-combo { position: relative; display: flex; gap: 8px; }
.bp-input, .bp-calc input[type="text"], .bp-calc input[type="number"], .bp-calc select {
	width: 100%; min-height: 48px; padding: 8px 12px; font: inherit; color: inherit; background: #fff;
	border: 2px solid #747474; border-radius: var(--bp-radius);
}
.bp-input { font-size: 1.125rem; }
.bp-input:focus, .bp-calc input:focus, .bp-calc select:focus, .bp-btn:focus-visible, .bp-suggest__item:focus { outline: 4px solid #ffbc2b; outline-offset: 0; }
.bp-suggest { position: absolute; z-index: 50; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 0; list-style: none; background: #fff; border: 2px solid #747474; border-radius: var(--bp-radius); max-height: 320px; overflow: auto; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.bp-suggest__item, .bp-suggest__empty { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #eee; }
.bp-suggest__item:hover, .bp-suggest__item.is-active { background: var(--bp-primary); color: #fff; }
.bp-suggest__item.is-partial { color: var(--bp-muted); }
.bp-suggest__item.is-partial:hover, .bp-suggest__item.is-partial.is-active { color: #fff; }
.bp-suggest__empty { color: var(--bp-muted); cursor: default; }
.bp-status { min-height: 1.5em; margin: 8px 0 0; font-size: .9375rem; }
.bp-status--error { color: var(--bp-error); font-weight: 600; }
.bp-status--loading::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid var(--bp-primary); border-right-color: transparent; border-radius: 50%; animation: bp-spin .8s linear infinite; }
@keyframes bp-spin { to { transform: rotate(360deg); } }

/* Knapper */
.bp-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 20px; font: inherit; font-weight: 600; border-radius: var(--bp-radius); border: 2px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
.bp-btn--primary { background: var(--bp-primary); color: #fff; }
.bp-btn--primary:hover { background: var(--bp-primary-dark); }
.bp-btn--secondary { background: #fff; color: var(--bp-primary); border-color: var(--bp-primary); }
.bp-btn--secondary:hover { background: #e6eef7; }
.bp-btn--link { background: none; color: var(--bp-primary); text-decoration: underline; padding-left: 8px; padding-right: 8px; }
.bp-icon-btn { width: 40px; height: 40px; border: 0; background: none; font-size: 1.5rem; color: var(--bp-muted); cursor: pointer; border-radius: var(--bp-radius); }
.bp-icon-btn:hover { background: var(--bp-error-bg); color: var(--bp-error); }

/* Resultat */
.bp-result { margin-top: 32px; outline: none; }
.bp-result__head { border-bottom: 1px solid var(--bp-border); padding-bottom: 12px; margin-bottom: 20px; }
.bp-eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .06em; font-size: .8125rem; color: var(--bp-muted); font-weight: 600; }
.bp-result__addr { margin: 2px 0 4px; font-size: 1.75rem; }
.bp-result__meta { margin: 0; color: var(--bp-muted); }
.bp-hero-figure { display: flex; gap: 24px; align-items: center; background: #e6eef7; border-left: 6px solid var(--bp-primary); padding: 20px 24px; margin-bottom: 24px; border-radius: var(--bp-radius); }
.bp-hero-figure__num { font-size: 4rem; font-weight: 700; line-height: 1; color: var(--bp-primary-dark); }
.bp-hero-figure__num span { font-size: 2rem; margin-left: 2px; }
.bp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.bp-card { background: #fff; border: 1px solid var(--bp-border); border-radius: var(--bp-radius); padding: 20px; margin-bottom: 20px; }
.bp-card--wide { margin-top: 4px; }
.bp-card__title { margin: 0 0 12px; font-size: 1.125rem; }
.bp-dl { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 6px 16px; margin: 0 0 12px; }
.bp-dl dt { color: var(--bp-muted); }
.bp-dl dd { margin: 0; }
.bp-link-ext::after { content: " ↗"; }
.bp-map { height: 360px; border: 1px solid var(--bp-border); border-radius: var(--bp-radius); background: var(--bp-bg-alt); }
.bp-tag { display: inline-block; font-size: .75rem; padding: 1px 6px; background: var(--bp-bg-alt); border: 1px solid var(--bp-border); border-radius: 10px; vertical-align: 1px; }
.bp-table-wrap { overflow-x: auto; }
.bp-table, .bp-std-table, .bp-calc-table, .bp-buildings { width: 100%; border-collapse: collapse; }
.bp-table th, .bp-table td, .bp-std-table th, .bp-std-table td, .bp-calc-table th, .bp-calc-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #ddd; vertical-align: top; }
.bp-table thead th, .bp-std-table thead th { background: var(--bp-bg-alt); border-bottom: 2px solid #999; }
.bp-std-table caption { text-align: left; font-weight: 600; padding: 0 0 8px; }
.bp-calc-table th { font-weight: 400; color: var(--bp-muted); }
.bp-calc-table td { text-align: right; }
.bp-small { display: block; font-size: .875rem; color: var(--bp-muted); margin-top: 4px; }
.bp-sources { margin-top: 8px; font-size: .875rem; }
.bp-sources ul { list-style: none; padding: 0; margin: 8px 0 0; }
.bp-sources li { padding: 2px 0; }
.bp-sources li span { display: inline-block; min-width: 140px; font-weight: 600; }
.bp-sources li.is-ok::before { content: "✓ "; color: var(--bp-success); }
.bp-sources li.is-warn::before { content: "! "; color: var(--bp-warn); font-weight: 700; }

/* Beregner */
.bp-calc-wrap { margin-top: 32px; }
.bp-calc { background: var(--bp-bg-alt); border: 1px solid var(--bp-border); border-radius: var(--bp-radius); padding: 24px; }
.bp-calc__title { margin: 0 0 4px; font-size: 1.5rem; }
.bp-calc__intro { margin: 0 0 16px; color: var(--bp-muted); }
.bp-fieldset { border: 0; border-top: 1px solid var(--bp-border); margin: 0 0 8px; padding: 16px 0 8px; }
.bp-fieldset legend { font-weight: 700; font-size: 1.125rem; padding: 0 8px 0 0; }
.bp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px 24px; }
.bp-field label { display: block; font-weight: 600; margin-bottom: 4px; }
.bp-unit { position: relative; display: flex; align-items: stretch; }
.bp-unit input { padding-right: 48px !important; }
.bp-unit span { position: absolute; right: 2px; top: 2px; bottom: 2px; display: flex; align-items: center; padding: 0 12px; background: #eee; border-left: 1px solid #ccc; color: var(--bp-muted); border-radius: 0 2px 2px 0; pointer-events: none; }
.bp-buildings { margin-bottom: 12px; background: #fff; }
.bp-buildings th { text-align: left; font-size: .875rem; padding: 8px; border-bottom: 2px solid #999; }
.bp-buildings td { padding: 6px 8px; border-bottom: 1px solid #ddd; }
.bp-buildings td:nth-child(2) { width: 170px; }
.bp-buildings td:nth-child(3) { width: 90px; }
.bp-buildings td:nth-child(4) { width: 50px; }
.bp-center { text-align: center; }
.bp-check input { width: 22px; height: 22px; accent-color: var(--bp-primary); }
.bp-calc__actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }

.bp-output { margin-top: 24px; background: #fff; border: 1px solid var(--bp-border); border-radius: var(--bp-radius); padding: 24px; }
.bp-output__title { margin: 0 0 16px; }
.bp-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.bp-kpi { border: 1px solid var(--bp-border); border-radius: var(--bp-radius); padding: 16px; display: flex; flex-direction: column; }
.bp-kpi__label { font-size: .875rem; color: var(--bp-muted); font-weight: 600; }
.bp-kpi__value { font-size: 2rem; font-weight: 700; line-height: 1.2; margin: 4px 0; }
.bp-kpi__value.is-ok { color: var(--bp-success); }
.bp-kpi__value.is-over { color: var(--bp-error); }
.bp-kpi__sub { font-size: .875rem; color: var(--bp-muted); }
.bp-meter { height: 18px; background: #e5e5e5; border-radius: 9px; overflow: hidden; }
.bp-meter__bar { height: 100%; background: var(--bp-primary); transition: width .4s; }
.bp-meter__bar.is-over { background: var(--bp-error); }
.bp-meter__legend { font-size: .875rem; color: var(--bp-muted); margin: 6px 0 16px; }
.bp-details { margin: 16px 0; }
.bp-details summary { cursor: pointer; font-weight: 600; color: var(--bp-primary); }
.bp-disclaimer { font-size: .875rem; color: var(--bp-muted); border-top: 1px solid #ddd; padding-top: 12px; margin: 16px 0 0; }

/* Alerts (genbruges hvis temaet ikke har dem) */
.bp-alert { padding: 16px 20px; border-left: 6px solid; border-radius: var(--bp-radius); margin: 16px 0; }
.bp-alert h3 { margin: 0 0 4px; font-size: 1.0625rem; }
.bp-alert p { margin: 0; }
.bp-alert--success { background: var(--bp-success-bg); border-color: var(--bp-success); }
.bp-alert--warning { background: var(--bp-warn-bg); border-color: #ffbc2b; }
.bp-alert--error { background: var(--bp-error-bg); border-color: var(--bp-error); }

.bp-tool.is-loading .bp-result { opacity: .5; }
.bp-tool--compact .bp-search { box-shadow: none; }

@media (max-width: 760px) {
	.bp-cols, .bp-kpis { grid-template-columns: 1fr; }
	.bp-combo { flex-direction: column; }
	.bp-combo .bp-btn { width: 100%; }
	.bp-hero-figure { flex-direction: column; align-items: flex-start; }
	.bp-buildings td:nth-child(2) { width: 120px; }
}

@media print {
	.bp-search, .bp-calc__actions, [data-bp-add], .bp-icon-btn, .bp-map { display: none !important; }
	.bp-output, .bp-calc, .bp-card { border-color: #999; box-shadow: none; }
	.bp-details[open] summary, .bp-details summary { display: none; }
	.bp-details > * { display: block !important; }
}
