/* The map pages: map, side panel, status line, info-window menu and each tool. */

/* Map */
.map-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    /* A shallower title band (base.css .page-band), to leave the map room. */
    padding-top: 1.5rem;
    padding-bottom: 1.25rem;
}

.map-toolbar__title {
    margin: 0;
}

.map-toolbar__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* The map with its panel beside it; below 1100px the panel moves onto the
   map instead (map-sheet.css). minmax(0, ...) lets the map shrink. */
.map-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 15rem;
    gap: 1rem;
}

.map {
    height: 70vh;
    min-height: 420px;
    border-radius: var(--radius-lg);
    border: 1px solid #e5e7eb;
}

.map-legend {
    padding: 1rem;
    font-size: 0.8125rem;
    align-self: start;
    max-height: 70vh;
    overflow-y: auto;
}

.map-legend__head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.map-legend__head .nav__link-button {
    color: var(--brand-red);
    font-size: 0.8125rem;
    padding: 0;
}

.map-legend__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.25rem 0.375rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.map-legend__item:hover {
    background: #f3f4f6;
}

.map-legend__item.is-off {
    opacity: 0.4;
}

.map-legend__status,
.map-legend__hint {
    margin: 0.75rem 0 0;
    color: #6b7280;
}

/* The map pages' status line (wwwroot/js/map-status.js): busy, action
   (the user's turn), error or info, in the panel and as a banner on the map. */
.map-status {
    --tone: #1d4ed8; --tone-bg: #eff6ff; --tone-line: #bfdbfe;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0.75rem 0 0;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--tone-line);
    border-left: 4px solid var(--tone);
    border-radius: var(--radius-sm);
    background: var(--tone-bg);
    color: #111827;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.35;
}
.map-status[hidden], .map-banner[hidden] { display: none; }
.map-status.is-action, .map-banner.is-action { --tone: #b45309; --tone-bg: #fffbeb; --tone-line: #fde68a; }
.map-status.is-error, .map-banner.is-error { --tone: var(--brand-red); --tone-bg: #fef2f2; --tone-line: #fecaca; }
.map-status.is-info, .map-banner.is-info { --tone: #047857; --tone-bg: #ecfdf5; --tone-line: #a7f3d0; }
.map-status.is-action { animation: map-status-nudge 1.6s ease-in-out 2; }

.map-status__text, .map-banner__text { flex: 1; }
.map-status__time, .map-banner__time {
    color: var(--tone);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Spinner while busy; a mark for the other kinds. */
.map-status__icon, .map-banner__icon {
    flex: none;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.05rem;
    border-radius: 50%;
    background: var(--tone);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.125rem;
    text-align: center;
}
.is-action > .map-status__icon::before, .is-action .map-banner__icon::before { content: "\2192"; }
.is-error > .map-status__icon::before, .is-error .map-banner__icon::before { content: "!"; }
.is-info > .map-status__icon::before { content: "\2713"; }
.is-busy > .map-status__icon, .is-busy .map-banner__icon {
    background: none;
    border: 3px solid var(--tone-line);
    border-top-color: var(--tone);
    animation: map-status-spin 0.8s linear infinite;
}

.map-banner {
    --tone: #1d4ed8; --tone-bg: #eff6ff; --tone-line: #bfdbfe;
    margin-top: 0.75rem;
    min-width: 16rem;
    max-width: min(32rem, 80vw);
    overflow: hidden;
    border: 1px solid var(--tone-line);
    border-radius: var(--radius-sm);
    background: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    color: #111827;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
    pointer-events: none;
}
.map-banner__row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    border-left: 4px solid var(--tone);
}
.map-banner__track { height: 4px; background: var(--tone-line); }
.map-banner__track[hidden] { display: none; }
.map-banner__bar { height: 100%; background: var(--tone); transition: width 0.4s ease; }
.map-banner__bar.is-indeterminate { width: 35%; animation: map-status-slide 1.3s ease-in-out infinite; }

@keyframes map-status-spin { to { transform: rotate(360deg); } }
@keyframes map-status-slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
/* A new message: two flashes in its own colour (map-status.js adds is-new). */
.map-status.is-new, .map-banner.is-new { animation: map-status-flash 0.6s ease-in-out 2; }
/* At the top of the side panel (map-status.js moves it): space below, not above. */
.map-status.is-top { margin: 0 0 0.75rem; }
@keyframes map-status-flash {
    0%, 100% { background: var(--tone-bg); box-shadow: none; }
    50% { background: var(--tone-line); box-shadow: 0 0 0 4px var(--tone-line); }
}
@keyframes map-status-nudge { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 0 4px var(--tone-line); } }
@media (prefers-reduced-motion: reduce) {
    .map-status.is-action, .map-status.is-new, .map-banner.is-new, .map-banner__bar.is-indeterminate { animation: none; }
    .is-busy > .map-status__icon, .is-busy .map-banner__icon { animation-duration: 2s; }
}

.map-popup th {
    padding: 0.125rem 0.75rem 0.125rem 0;
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.75rem;
    text-align: left;
    color: #6b7280;
    font-weight: 500;
    border: 0;
}

.map-popup td {
    padding: 0.125rem 0;
    font-size: 0.8125rem;
    border: 0;
}

.map-popup__heading {
    margin: 0.75rem 0 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
}

.map-popup__list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.8125rem;
}

.map-popup__list li {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.125rem 0;
    color: var(--brand-red);
    cursor: pointer;
}

.map-popup__list li.is-current {
    color: #111827;
    font-weight: 600;
    cursor: default;
}

.map-popup__heading:first-child {
    margin-top: 0;
}

/* The tools menu in map info windows (wwwroot/js/map-menu.js): legacy's
   dynamic menu, one tool per row with its icon, in the legacy order. */
.map-menu {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0.375rem 0 0;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 0.0625rem;
    min-width: 15rem;
}

.map-menu__link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.375rem;
    border-radius: var(--radius-sm);
    color: #111827;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.25;
    text-decoration: none;
}

.map-menu__link:hover,
.map-menu__link:focus-visible {
    background: #f3f4f6;
    color: var(--brand-red);
    outline: none;
}

.map-menu__icon {
    width: 16px;
    height: 16px;
    flex: none;
    object-fit: contain;
}

/* The side panel floating over a full-screen map (wwwroot/js/map-fullscreen.js).
   Google's control styles set their own font, so put ours back. */
.map:fullscreen {
    border: 0;
    border-radius: 0;
}

.map-legend.is-floating {
    margin: 10px;
    width: 19rem;
    max-width: calc(100vw - 80px);
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #111827;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* Line of sight */
.los-layout {
    grid-template-columns: minmax(0, 1fr) 19rem;
}

.los-panel {
    max-height: none;
}

.los-panel__point {
    margin: 0 0 0.75rem;
    color: #374151;
}

.los-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}

.los-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
}

.los-grid input,
.los-grid select {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.8125rem;
}

.los-grid input:focus,
.los-grid select:focus {
    outline: none;
    border-color: var(--brand-red);
}

.los-signal {
    margin-bottom: 0.75rem;
}

.los-signal summary {
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.los-operators {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.los-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.los-actions button:disabled {
    opacity: 0.5;
    cursor: default;
}

.los-panel .form-check {
    font-size: 0.8125rem;
    margin-bottom: 0.25rem;
}

.los-scale {
    margin-top: 0.75rem;
}

.los-scale__bar {
    height: 0.5rem;
    border-radius: 0.25rem;
    background: linear-gradient(to right, #ff0000, #ffff00, #00ff00);
}

.los-scale__labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #6b7280;
}

.los-masts__head {
    margin-top: 1rem;
}

.los-mast {
    cursor: default;
}

.los-mast small {
    margin-left: auto;
    color: #6b7280;
}

.los-swatch {
    display: inline-block;
    flex: none;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 2px;
}

/* Coverage key: round, with the generation written in as on the map. */
.coverage-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 50%;
    color: #ffffff;
    font-size: 0.5625rem;
    font-weight: 700;
    line-height: 1;
}

.los-dot {
    display: block;
    width: 12px;
    height: 12px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.6);
    transform: translate(0, 50%);
}

.los-dot.is-selected {
    width: 18px;
    height: 18px;
    box-shadow: 0 0 0 2px #111827, 0 0 4px rgba(0, 0, 0, 0.6);
}

.los-ring-label {
    padding: 0 0.25rem;
    border-radius: 0.25rem;
    background: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    color: #000000;
    transform: translate(50%, 50%);
}

/* Panel controls hidden by script (e.g. lower generations for the best network): over their own display. */
.los-panel [hidden] {
    display: none !important;
}

/* Survey coverage hexagons: how gaps are filled. */
.coverage-spread {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    margin: 0.25rem 0;
}

.coverage-spread select {
    flex: 1;
    min-width: 0;
}

/* Signal forecast */
.fc-opacity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    margin: 0.25rem 0 0.5rem;
}

.fc-opacity input {
    flex: 1;
}

.fc-key ul {
    list-style: none;
    margin: 0.5rem 0;
    padding: 0;
    font-size: 0.75rem;
    color: #374151;
}

.fc-key li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.0625rem 0;
}

.fc-selection {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.5rem;
    margin: 0.5rem 0;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-sm);
    background: #f3f4f6;
    color: #111827;
}

.fc-selection[hidden] {
    display: none;
}

.fc-selection .nav__link-button {
    padding: 0;
    color: var(--brand-red);
    font-size: 0.8125rem;
}

/* 1km grid line of sight */
.grid-dot {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    opacity: 0.9;
}

.grid-operators {
    border: 0;
    margin: 0.5rem 0;
    padding: 0;
}

.grid-operators legend {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

/* Coverage map */
.coverage-logo {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

/* Infrastructure line of sight: the With / Without LOS filter and target list. */
.infra-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    margin: 0.75rem 0 0.5rem;
    font-size: 0.8125rem;
}

.infra-target {
    border-left: 3px solid #ff0000;
}

.infra-target.has-los {
    border-left-color: #00c000;
}

.infra-target__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.infra-target small {
    color: #6b7280;
}

.infra-target__eye {
    flex: none;
    padding: 0 0.25rem;
    border: 0;
    background: none;
    font-size: 0.75rem;
    color: #6b7280;
    cursor: pointer;
}

.infra-filter[hidden],
.infra-target[hidden] {
    display: none;
}
