/*
 * M9WWA Logbook Map – layout only.
 * Fonts, colours, buttons, inputs and tables are inherited from the active theme.
 */
.m9lb {
	--m9lb-gap: 1rem;
	--m9lb-border: rgba(128, 128, 128, 0.35);
	--m9lb-soft: rgba(128, 128, 128, 0.08);
	--m9lb-map-h: 480px;
	box-sizing: border-box;
	max-width: 100%;
	min-width: 0;
}
@supports (color: color-mix(in srgb, red, blue)) {
	.m9lb {
		--m9lb-border: color-mix(in srgb, currentColor 22%, transparent);
		--m9lb-soft: color-mix(in srgb, currentColor 6%, transparent);
	}
}
.m9lb *, .m9lb *::before, .m9lb *::after { box-sizing: border-box; }
.m9lb__inner { display: grid; gap: var(--m9lb-gap); min-width: 0; }
.m9lb__title { margin: 0; }
.m9lb--loading .m9lb__tablewrap { opacity: 0.6; transition: opacity 0.15s; }
.m9lb__sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* counters */
.m9lb__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 0.75rem; }
.m9lb__stat { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.85rem 1rem; border: 1px solid var(--m9lb-border); border-radius: 6px; background: var(--m9lb-soft); min-width: 0; }
.m9lb__stat-label { font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.75; }
.m9lb__stat-value { font-size: 1.9em; font-weight: 700; line-height: 1.15; }
.m9lb__stat-btn { all: unset; cursor: pointer; font-size: 1.9em; font-weight: 700; line-height: 1.15; text-decoration: underline dotted; text-underline-offset: 4px; }
.m9lb__stat-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.m9lb__stat-sub { font-size: 0.85em; opacity: 0.75; overflow-wrap: anywhere; }
.m9lb__scope { margin: -0.4rem 0 0; font-size: 0.85em; opacity: 0.7; }

/* filters */
.m9lb__filters { display: grid; gap: 0.75rem; padding: 1rem; border: 1px solid var(--m9lb-border); border-radius: 6px; }
.m9lb__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; align-items: end; }
.m9lb__row--main { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.m9lb__field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.m9lb__field label { font-size: 0.9em; font-weight: 600; }
.m9lb__field select, .m9lb__field input:not([type="checkbox"]) { width: 100%; max-width: 100%; min-width: 0; }
.m9lb__field--check { justify-content: flex-end; }
.m9lb__field--check label { font-weight: 400; }
.m9lb__hint { opacity: 0.7; font-size: 0.8em; }
.m9lb__more > summary { cursor: pointer; font-weight: 600; margin-bottom: 0.75rem; }
.m9lb__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.m9lb__btn-quiet { opacity: 0.85; }

/* map */
.m9lb__mapwrap { display: grid; gap: 0.5rem; min-width: 0; }
.m9lb__maptools { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.m9lb__maptools label { display: inline-flex; align-items: center; gap: 0.35rem; }
.m9lb__map-note { font-size: 0.85em; opacity: 0.8; }
.m9lb__map { height: var(--m9lb-map-h); min-height: 260px; width: 100%; border: 1px solid var(--m9lb-border); border-radius: 6px; z-index: 0; overflow: hidden; }
.m9lb__map.leaflet-container { font: inherit; background: #ddd; }
.m9lb__legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; list-style: none; margin: 0; padding: 0; font-size: 0.85em; }
.m9lb__legend li { margin: 0; padding: 0; display: inline-flex; align-items: center; gap: 0.3rem; }
.m9lb__swatch { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.35); }
.m9lb-dot i { display: block; width: 14px; height: 14px; margin: 1px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }
.m9lb-op span { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: #b3261e; color: #fff; font-size: 16px; line-height: 1; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }
.m9lb-popup { color: #1a1a1a; font-size: 14px; line-height: 1.45; }
.m9lb-popup__call { font-size: 16px; }
.m9lb-popup__groups { margin-top: 0.3rem; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.m9lb .leaflet-popup-content { margin: 10px 12px; }

/* list header */
.m9lb__listbar { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; justify-content: space-between; }
.m9lb__status { margin: 0; }
.m9lb__perpage { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.m9lb__perpage label { font-weight: 600; }

/* table */
.m9lb__tablewrap { overflow-x: auto; max-width: 100%; }
.m9lb__table { width: 100%; border-collapse: collapse; margin: 0; }
.m9lb__table th, .m9lb__table td { padding: 0.5em 0.6em; text-align: left; vertical-align: top; }
.m9lb__table tbody tr.m9lb__row-qso td { border-bottom: 1px solid var(--m9lb-border); }
.m9lb__table th { white-space: nowrap; }
.m9lb__sort, .m9lb__toggle { all: unset; cursor: pointer; font-weight: 600; text-decoration: underline dotted; text-underline-offset: 3px; }
.m9lb__toggle { font-weight: 400; font-size: 0.9em; }
.m9lb__sort:focus-visible, .m9lb__toggle:focus-visible, .m9lb__chip:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.m9lb__table th[aria-sort="ascending"] .m9lb__sort::after { content: " ▲"; font-size: 0.7em; }
.m9lb__table th[aria-sort="descending"] .m9lb__sort::after { content: " ▼"; font-size: 0.7em; }
.m9lb__call strong { letter-spacing: 0.02em; }
.m9lb__ok { color: #2e7d32; }
.m9lb__grid { white-space: nowrap; font-variant-numeric: tabular-nums; }
.m9lb__chip { all: unset; cursor: pointer; display: inline-block; margin: 0 0.25rem 0.25rem 0; padding: 0.05em 0.55em; border: 1px solid var(--m9lb-border); border-radius: 999px; background: var(--m9lb-soft); font-size: 0.85em; line-height: 1.6; }
.m9lb__chip:hover { border-color: currentColor; }
.m9lb-popup .m9lb__chip { color: #1a1a1a; }
.m9lb__more-chip { font-size: 0.85em; opacity: 0.7; }
.m9lb__empty { text-align: center; padding: 1.5rem 0.5rem !important; }
.m9lb__detail > td { background: var(--m9lb-soft); border-bottom: 1px solid var(--m9lb-border); }
.m9lb__detail[hidden] { display: none; }
.m9lb__detail-body { display: grid; gap: 0.75rem; }
.m9lb__dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.5rem 1.25rem; margin: 0; }
.m9lb__dl div { min-width: 0; }
.m9lb__dl dt { font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.7; }
.m9lb__dl dd { margin: 0; overflow-wrap: anywhere; }
.m9lb__detail-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* pager */
.m9lb__pager { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; justify-content: center; }
.m9lb__pg { min-width: 2.4em; padding: 0.35em 0.6em; border: 1px solid var(--m9lb-border); border-radius: 4px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.m9lb__pg:hover:not(:disabled) { border-color: currentColor; }
.m9lb__pg.is-current { font-weight: 700; border-color: currentColor; background: var(--m9lb-soft); }
.m9lb__pg:disabled { opacity: 0.4; cursor: default; }
.m9lb__pginfo { width: 100%; text-align: center; font-size: 0.85em; opacity: 0.75; }

/* phones: each QSO becomes a card */
@media (max-width: 760px) {
	.m9lb__table, .m9lb__table tbody { display: block; }
	.m9lb__table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
	.m9lb__table tr.m9lb__row-qso { display: block; margin-top: 0.6rem; padding: 0.4rem 0.7rem; border: 1px solid var(--m9lb-border); border-radius: 6px; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
	.m9lb__table tr.m9lb__row-qso td { display: flex; justify-content: space-between; gap: 1rem; padding: 0.2rem 0; border: 0; text-align: right; }
	.m9lb__table tr.m9lb__row-qso td::before { content: attr(data-label); font-weight: 600; text-align: left; flex: none; }
	.m9lb__table tr.m9lb__row-qso td.m9lb__tcell { justify-content: flex-end; }
	.m9lb__table tr.m9lb__row-qso td.m9lb__tcell::before { content: none; }
	.m9lb__table tr.m9lb__row-qso td:empty { display: none; }
	.m9lb__chips { text-align: right; }
	.m9lb__table tr.m9lb__detail { display: block; border: 1px solid var(--m9lb-border); border-top: 0; border-radius: 0 0 6px 6px; margin-bottom: 0.6rem; }
	.m9lb__table tr.m9lb__detail[hidden] { display: none; }
	.m9lb__table tr.m9lb__detail > td { display: block; }
	.m9lb__table tr.m9lb__empty-row, .m9lb__table td.m9lb__empty { display: block; }
	.m9lb__stat-value, .m9lb__stat-btn { font-size: 1.6em; }
	.m9lb__map { min-height: 300px; }
	.m9lb__filters { padding: 0.75rem; }
}
@media (prefers-reduced-motion: reduce) {
	.m9lb--loading .m9lb__tablewrap { transition: none; }
}
