/* ==========================================================================
   Site Locator - base styles, components and forms.
   Colours/sizes are CSS variables so the look can be changed in one place.
   ========================================================================== */
:root {
    --brand: #b70b9b;
    --brand-dark: #8f087a;
    --brand-tint: #fbeaf8;
    --ink: #1f2430;
    --muted: #667085;
    --line: #e4e7ec;
    --bg: #f5f6f8;
    --card: #ffffff;
    --danger: #c62828;
    --ok: #1b7f3b;
    --radius: 10px;
    --shadow: 0 2px 10px rgba(16, 24, 40, .18);
    --header-h: 56px;
    --tap: 44px; /* minimum touch target */
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: var(--ink);
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; }
a { color: var(--brand-dark); }
h1 { font-size: 1.4rem; margin: 0 0 .6rem; }
h2 { font-size: 1.1rem; margin: 0; }
h3 { font-size: 1rem; margin: .2rem 0 .6rem; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- buttons */
.btn, button.btn, a.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: var(--tap); padding: .45rem 1rem;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: #fff; color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: #c9ced6; background: #fafafa; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-light { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .4); color: #fff; }
.btn-light:hover { background: rgba(255, 255, 255, .28); }
.btn-danger { color: var(--danger); border-color: #f1c0c0; }
.btn-small { min-height: 36px; padding: .25rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; font-size: 1.5rem; line-height: 1; cursor: pointer; color: inherit;
}
.icon-btn:hover { background: rgba(0, 0, 0, .07); }
.icon-btn img { width: 18px; height: 18px; }

button.link { border: 0; background: none; padding: 0; font: inherit; color: var(--brand-dark); text-decoration: underline; cursor: pointer; text-align: left; }

:focus-visible { outline: 3px solid #2f6fed; outline-offset: 2px; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: .25rem; margin: 0 0 .8rem; }
.field > span, .field-group legend { font-size: .85rem; font-weight: 600; color: var(--muted); }

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
    width: 100%; min-height: var(--tap); padding: .5rem .7rem;
    border: 1px solid #c9ced6; border-radius: var(--radius); background: #fff; font: inherit; color: inherit;
}
textarea { min-height: 5rem; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 2px solid var(--brand-tint); }
input[type="file"] { max-width: 100%; margin: .3rem 0 1rem; }

.check { display: flex; align-items: center; gap: .55rem; min-height: var(--tap); margin: 0; cursor: pointer; }
.check input { width: 20px; height: 20px; flex: none; }

.field-group { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem .2rem; margin: 0 0 .8rem; }
.dms { display: flex; align-items: center; gap: .3rem; }
.dms input { width: 100%; min-width: 0; }
.coord-editor { margin-bottom: .6rem; }

.form-error { color: var(--danger); margin: .3rem 0 .8rem; font-weight: 600; }
.form-success { color: var(--ok); font-weight: 600; }
.validation-message { color: var(--danger); font-size: .85rem; }
.validation-errors { color: var(--danger); padding-left: 1.2rem; }
.hint { color: var(--muted); font-size: .85rem; margin: .2rem 0 .8rem; }
.stack > * + * { margin-top: .8rem; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------------------- pages without the map */
.message-page, .form-page { max-width: 640px; margin: 0 auto; padding: 1.2rem; }
.message-card { background: var(--card); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); text-align: center; }
.captcha { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; }
.captcha-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.captcha-image svg { display: block; border-radius: 6px; }

/* ---------------------------------------------------------------- app header */
.app-header {
    display: flex; align-items: center; justify-content: space-between; gap: .6rem;
    min-height: var(--header-h); padding: 0 .8rem; padding-top: env(safe-area-inset-top);
    background: var(--brand); color: #fff;
}
.brand { display: flex; align-items: center; height: 100%; }
.brand img { height: calc(var(--header-h) - 14px); width: auto; display: block; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .3rem .5rem; }
.header-actions .btn { min-height: 38px; padding: .25rem .8rem; font-size: .85rem; }
.mobile-apps { display: none; flex-direction: column; font-size: .7rem; line-height: 1.25; }
.mobile-apps a { color: #fff; }
@media (min-width: 900px) { .mobile-apps { display: flex; } }
.user-badge { font-size: .8rem; padding: .2rem .6rem; border-radius: 999px; background: rgba(255, 255, 255, .2); max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .user-badge { display: none; } .header-actions .btn { padding: .25rem .55rem; } }

.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; width: min(86vw, 290px);
    display: flex; flex-direction: column; gap: .5rem; padding: .8rem; border-radius: var(--radius);
    background: #fff; color: var(--ink); box-shadow: var(--shadow); font-size: .9rem;
}
.dropdown-panel p { margin: 0; }

/* ---------------------------------------------------------------- modal dialogs */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
    padding: 1rem; background: rgba(16, 24, 40, .55);
}
.modal-card {
    display: flex; flex-direction: column; width: min(100%, 520px); max-height: min(92dvh, 820px);
    background: var(--card); border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
.modal-card.modal-narrow { width: min(100%, 440px); }
.modal-card.modal-wide { width: min(100%, 760px); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.modal-body { padding: 1rem; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-footer { padding: .8rem 1rem; border-top: 1px solid var(--line); }
@media (max-width: 560px) {
    .modal-backdrop { align-items: flex-end; padding: 0; }
    .modal-card, .modal-card.modal-narrow, .modal-card.modal-wide { width: 100%; max-height: 92dvh; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}

.aup { display: flex; flex-direction: column; gap: .8rem; font-size: .85rem; line-height: 1.55; }
.aup p { margin: 0 0 .7rem; }
.aup p:last-child { margin-bottom: 0; }
.aup-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.aup-card-head { display: flex; align-items: center; gap: .7rem; padding: .55rem .9rem; background: var(--brand-tint); border-bottom: 1px solid var(--line); }
.aup-card-head strong { display: block; color: var(--brand-dark); font-size: .95rem; line-height: 1.2; }
.aup-card-head small { color: var(--muted); }
.aup-lang {
    display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: #fff;
    font-weight: 700; font-size: .8rem; letter-spacing: .04em; flex: none;
}
.aup-card-body { padding: .8rem .95rem; }

.tabs { display: flex; gap: .3rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tab { flex: 1; min-height: var(--tap); border: 0; border-bottom: 3px solid transparent; background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); }

.result-list { list-style: none; margin: 1rem 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); max-height: 40dvh; overflow-y: auto; }
.result-list li + li { border-top: 1px solid var(--line); }
.result-list button { width: 100%; min-height: var(--tap); padding: .5rem .8rem; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.result-list button:hover { background: var(--brand-tint); }

.radius-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .2rem .6rem; margin-bottom: .8rem; }

/* ---------------------------------------------------------------- tables */
.table-scroll { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { padding: .5rem .7rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table th { background: #f0f1f4; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.data-table .num { text-align: right; }

/* ---------------------------------------------------------------- legend + points panels (used inside the map side panels) */
.panel-body { padding: .8rem; overflow-y: auto; }
.panel-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.legend-list, .legend-children, .point-list { list-style: none; margin: 0; padding: 0; }
.legend-item { display: flex; align-items: center; gap: .6rem; min-height: var(--tap); cursor: pointer; }
.legend-item input { width: 20px; height: 20px; flex: none; }
.legend-item img { width: 22px; height: 22px; object-fit: contain; flex: none; }
.legend-children { margin-left: 2.1rem; }
.legend-item.static { cursor: default; min-height: 32px; color: var(--muted); }

.point-list li { display: grid; grid-template-columns: 1fr auto; gap: 0 .5rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.point-list .coords { grid-column: 1; color: var(--muted); font-size: .8rem; }
.point-list .row-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; }
.point-editor { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; margin-bottom: .8rem; background: #fcfcfd; }
.confirm { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .6rem; padding: .5rem; border-radius: var(--radius); background: #fff4f4; }

/* ---------------------------------------------------------------- error banner (Blazor) */
#blazor-error-ui {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 2000; padding: .7rem 1rem;
    background: #fff3cd; color: #5c4400; box-shadow: 0 -2px 6px rgba(0, 0, 0, .2);
}
#blazor-error-ui:not([hidden]) { display: block; }

/* Notice for external visitors in the header */
@media (max-width: 900px) { 
/* Notice strip under the header for external visitors: centred, single line, amber */
.intl-banner {
    display: block; width: 100%; box-sizing: border-box; padding: .25rem .6rem; text-align: right !important;
    background: #fff4d6; color: #6b4600; border-bottom: 1px solid #f1d58c;
    font-size: clamp(.55rem, 2.5vw, .72rem); font-weight: 600; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: clip;
}
.intl-banner-icon {
    display: inline-grid; place-items: center; width: 1.3em; height: 1.3em; margin-right: .45em; vertical-align: middle; border-radius: 50%;
    background: #f0a500; color: #fff; font-weight: 800; font-size: .85em; line-height: 1;
}

/* "I Accept" button in the Acceptable Use Policy popup: unmistakably a button */
.aup-accept {
    display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; min-height: 52px; padding: .6rem 1rem;
    border: 0; border-bottom: 4px solid #136b2c; border-radius: 12px; background: linear-gradient(#27a844, #1d8f37); color: #fff;
    font: inherit; font-size: 1.05rem; font-weight: 700; letter-spacing: .01em; cursor: pointer;
    box-shadow: 0 4px 10px rgba(29, 143, 55, .35); transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
}
.aup-accept:hover { filter: brightness(1.08); box-shadow: 0 6px 14px rgba(29, 143, 55, .45); }
.aup-accept:active { transform: translateY(2px); border-bottom-width: 2px; box-shadow: 0 2px 5px rgba(29, 143, 55, .35); }
.aup-accept:focus-visible { outline: 3px solid #b9e6c4; outline-offset: 2px; }
.aup-accept-check { display: grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; background: rgba(255, 255, 255, .25); font-size: .95em; }
