/* =========================================
   BROADCAST SITES PAGE
   Vertical tab sidebar + map layout — same design language as
   the Drive Measurement page (green accent, dark theme).
   ========================================= */

/* ---- CSS Variables ---- */
:root {
    --bc-bg-base: var(--ls-bg-base);
    --bc-bg-panel: rgba(30, 30, 30, 0.95);
    --bc-bg-card: var(--ls-bg-card);
    --bc-bg-input: var(--ls-bg-input);
    --bc-bg-hover: #2a2a2a;
    --bc-border: #333333;
    --bc-border-light: #444;
    --bc-text: #ffffff;
    --bc-text-muted: #a0a0a0;
    --bc-accent: var(--ls-accent);
    --bc-accent-glow: var(--ls-accent-glow);
    --bc-danger: var(--ls-danger);
    --bc-info: #3498db;
    --bc-tab-width: 48px;
    --bc-panel-width: 360px;
    --bc-sidebar-width: calc(var(--bc-tab-width) + var(--bc-panel-width));
    --bc-right-panel-width: 380px;
}

/* ---- Page Layout ---- */
body.broadcast-page {
    overflow: hidden !important;
    margin: 0;
    padding: 0;
}

.bc-container {
    position: fixed;
    top: var(--ls-nav-height); /* below navbar */
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    background: var(--bc-bg-base);
}

/* Broadcast's map area stacks a metrics bar + map wrapper, so it needs flex column */
.bc-map-area {
    display: flex;
    flex-direction: column;
}

/* The map element needs absolute positioning inside its wrapper because flex
   sizing on a Leaflet container is unreliable — Leaflet measures layout
   before flex resolves and ends up with zero height. */
.bc-map-wrapper #map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ---- Top Metrics Bar (above the map) ---- */
.bc-metrics-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    background: var(--bc-bg-base);
    border-bottom: 1px solid var(--bc-border);
    flex-shrink: 0;
}

.bc-metric-card {
    background: var(--bc-bg-card);
    border: 1px solid var(--bc-border);
    border-radius: 6px;
    padding: 0.55rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bc-metric-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    background: rgba(0, 188, 140, 0.12);
    color: var(--bc-accent);
    border: 1px solid rgba(0, 188, 140, 0.3);
}

.bc-metric-icon.icon-info {
    background: rgba(52, 152, 219, 0.12);
    color: var(--bc-info);
    border-color: rgba(52, 152, 219, 0.3);
}

.bc-metric-icon.icon-warning {
    background: rgba(241, 196, 15, 0.12);
    color: #f1c40f;
    border-color: rgba(241, 196, 15, 0.3);
}

.bc-metric-text {
    flex: 1;
    min-width: 0;
}

.bc-metric-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--bc-text);
    line-height: 1.2;
}

.bc-metric-label {
    font-size: 0.65rem;
    color: var(--bc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1px;
}

/* The map sits inside a wrapper so the floating search overlays correctly */
.bc-map-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* ---- Floating Map Search Bar (top-center, Mobile-Sites style) ---- */
.bc-map-search-container {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 550;
    width: 90%;
    max-width: 480px;
    pointer-events: none;
}

.bc-map-search-bar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(22, 22, 22, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--ls-border-medium);
    border-radius: 10px;
    padding: 0.45rem 0.55rem;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.bc-map-search-icon {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
    padding: 0 0.4rem 0 0.25rem;
    flex-shrink: 0;
}

.bc-map-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #f8f9fa;
    font-size: 0.85rem;
    padding: 0.45rem 0;
    min-width: 0;
    outline: none;
}

.bc-map-search-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.bc-map-search-divider {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.bc-map-search-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.bc-map-search-action:hover {
    background: var(--bc-accent);
    color: #000;
}

/* Expanded right panel — widens in place to ~60% of the map area */
.bc-right-panel.modal-expanded {
    width: min(60%, 800px);
}

/* ---- Polarization buttons (radio-style) ---- */
.bc-polarization-btns {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.bc-polarization-btn {
    flex: 1;
    min-width: 60px;
    padding: 0.35rem 0.25rem;
    border: 1px solid var(--bc-border-light);
    border-radius: 6px;
    background: transparent;
    color: var(--bc-text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.bc-polarization-btn:hover {
    background: var(--bc-bg-hover);
    color: var(--bc-text);
}

.bc-polarization-btn.active {
    background: var(--bc-accent);
    color: #000;
    border-color: var(--bc-accent);
}

/* ---- Frequency / range inputs grouped ---- */
.bc-range-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.bc-range-group .bc-input {
    flex: 1;
}

.bc-range-group .bc-range-sep {
    color: var(--bc-text-muted);
    font-size: 0.75rem;
}

/* ---- Site Visibility List (alphabetical groups) ---- */

/* Section title row — inline title + icon actions */
.bc-section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.bc-section-title-row .bc-section-title {
    margin-bottom: 0;
    flex: 1;
}

.bc-site-visibility {
    background: var(--bc-bg-card);
    border: 1px solid var(--bc-border);
    border-radius: 6px;
    padding: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
}

.bc-site-summary {
    font-size: 0.7rem;
    color: var(--bc-text-muted);
    margin-top: 0.4rem;
    text-align: center;
}

.bc-visibility-actions {
    display: flex;
    gap: 0.35rem;
}

/* ---- Site Visibility toggle button (single button reflecting state) ---- */
.bc-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 14px;
    border: 1px solid var(--bc-border-light);
    background: rgba(255, 255, 255, 0.04);
    color: var(--bc-text-muted);
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.bc-toggle-btn i {
    font-size: 0.78rem;
}

.bc-toggle-btn:hover {
    background: var(--ls-border-subtle);
    color: var(--bc-text);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Active = all sites currently visible */
.bc-toggle-btn.active {
    background: var(--ls-accent-bg);
    color: var(--bc-accent);
    border-color: rgba(0, 188, 140, 0.45);
}

.bc-toggle-btn.active:hover {
    background: rgba(0, 188, 140, 0.22);
    border-color: var(--bc-accent);
}

/* ---- Override the JS-built alphabetical group sections (.toggle-section / .section-header / .site-toggle-item) ---- */

body.broadcast-page .bc-site-visibility .toggle-section {
    margin-bottom: 0.4rem;
}

body.broadcast-page .bc-site-visibility .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.55rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--ls-border-subtle);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--bc-text);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    transition: all 0.15s ease;
}

body.broadcast-page .bc-site-visibility .section-header:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--ls-accent-border);
}

body.broadcast-page .bc-site-visibility .section-header > span {
    color: var(--bc-accent) !important;
}

body.broadcast-page .bc-site-visibility .section-header i {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

body.broadcast-page .bc-site-visibility .section-header.expanded i {
    transform: rotate(180deg);
}

body.broadcast-page .bc-site-visibility .section-content {
    padding: 0.35rem 0.25rem 0.25rem 0.5rem;
    display: none;
}

body.broadcast-page .bc-site-visibility .section-content.show {
    display: block;
}

body.broadcast-page .bc-site-visibility .site-toggle-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.35rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--bc-text);
    transition: background 0.15s ease;
    cursor: pointer;
}

body.broadcast-page .bc-site-visibility .site-toggle-item:hover {
    background: var(--bc-bg-hover);
}

body.broadcast-page .bc-site-visibility .site-toggle-item input[type="checkbox"] {
    accent-color: var(--bc-accent);
    cursor: pointer;
}

body.broadcast-page .bc-site-visibility .site-toggle-item label {
    cursor: pointer;
    flex: 1;
    margin: 0;
}

/* ---- Campaign Cards (Campaigns tab) ---- */
.bc-campaign-card {
    background: var(--bc-bg-card);
    border: 1px solid var(--bc-border);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bc-campaign-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bc-text);
}

.bc-campaign-meta {
    font-size: 0.7rem;
    color: var(--bc-text-muted);
    margin-top: 2px;
}

/* (site-visibility list + right-panel scrollbars use the shared .ls-scroll utility) */

/* ---- Map Controls (Leaflet overrides) ---- */
.bc-map-area .leaflet-bar a {
    background-color: var(--bc-bg-card);
    color: var(--bc-text);
    border-color: var(--bc-border);
}

.bc-map-area .leaflet-bar a:hover {
    background-color: var(--bc-bg-hover);
}

.bc-map-area .leaflet-control-layers-expanded {
    background: var(--bc-bg-card);
    color: var(--bc-text);
    border: 1px solid var(--bc-border);
    border-radius: 6px;
}

.bc-map-area .leaflet-control-layers label {
    color: var(--bc-text);
}

.bc-map-area .leaflet-control-layers input[type="radio"] {
    accent-color: var(--bc-accent);
}

/* ---- Loading Overlay ---- */
.bc-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.bc-loading.show {
    display: flex;
}

.bc-loading-content {
    text-align: center;
    color: var(--bc-text);
}

.bc-loading-content .spinner-border {
    width: 2rem;
    height: 2rem;
    margin-bottom: 0.5rem;
}

.bc-loading-text {
    font-size: 0.85rem;
    color: var(--bc-text-muted);
}

/* ===========================================================
   Right Panel (Site Analysis) — slides in when a site is clicked
   Keeps the broadcast-specific antenna pattern radar charts
   =========================================================== */

.bc-right-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--bc-right-panel-width);
    background: rgba(22, 22, 22, 0.97);
    backdrop-filter: blur(10px);
    border-left: 1px solid var(--bc-border);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.bc-right-panel.active {
    transform: translateX(0);
}

.bc-right-panel.modal-expanded {
    width: 60%;
}

.bc-right-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--bc-border);
}

.bc-right-panel-title {
    color: var(--bc-text);
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bc-right-panel-controls {
    display: flex;
    gap: 0.4rem;
}

.bc-right-panel-controls button {
    background: transparent;
    border: 1px solid var(--bc-border-light);
    color: var(--bc-text-muted);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bc-right-panel-controls button:hover {
    background: var(--bc-bg-hover);
    color: var(--bc-text);
}

.bc-right-panel-controls button.bc-close-btn:hover {
    background: var(--bc-danger);
    color: #fff;
    border-color: var(--bc-danger);
}

.bc-right-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .bc-sidebar {
        width: 320px;
    }

    .bc-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bc-right-panel {
        width: 320px;
    }
}

@media (max-width: 768px) {
    .bc-tab-bar {
        width: 40px;
    }

    .bc-sidebar {
        width: 280px;
    }

    .bc-tab-btn {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }

    .bc-right-panel {
        width: 100%;
    }
}

/* ===========================================================
   Click-to-copy coordinates row
   Used in both the Leaflet popup and the right panel header.
   =========================================================== */

.bc-coords-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 8px 0;
    background: rgba(0, 188, 140, 0.08);
    border: 1px solid rgba(0, 188, 140, 0.3);
    border-radius: 6px;
    color: var(--bc-text);
    font-size: 0.78rem;
    font-family: 'Consolas', 'Monaco', monospace;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.bc-coords-row:hover {
    background: var(--ls-accent-bg);
    border-color: rgba(0, 188, 140, 0.5);
}

.bc-coords-row.bc-copied {
    background: rgba(0, 188, 140, 0.25);
    border-color: var(--bc-accent);
}

.bc-coords-row > i:first-child {
    color: var(--bc-accent);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.bc-coords-row .bc-coords-text {
    flex: 1;
    color: rgba(255, 255, 255, 0.9);
}

.bc-coords-row .bc-coords-copy {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    transition: color 0.15s ease;
    flex-shrink: 0;
}

.bc-coords-row:hover .bc-coords-copy {
    color: var(--bc-accent);
}

.bc-coords-row.bc-copied .bc-coords-copy {
    color: var(--bc-accent);
}

/* ===========================================================
   Leaflet popup overrides for the broadcast page
   Forces the dark + green-accent theme over the legacy blue.
   =========================================================== */

body.broadcast-page .leaflet-popup-content-wrapper {
    background: var(--ls-bg-popup) !important;
    color: #f0f0f0 !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 10px !important;
    padding: 0 !important;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.6),
        0 8px 28px rgba(0, 0, 0, 0.7) !important;
}

body.broadcast-page .leaflet-popup-content {
    margin: 0 !important;
    line-height: 1.4 !important;
    color: #f0f0f0 !important;
    width: 320px !important;
}

body.broadcast-page .leaflet-popup-tip {
    background: var(--ls-bg-popup) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
}

body.broadcast-page .leaflet-popup-close-button {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 18px !important;
    top: 6px !important;
    right: 8px !important;
}

body.broadcast-page .leaflet-popup-close-button:hover {
    color: #fff !important;
}

/* ---- Popup card body overrides ---- */

body.broadcast-page .site-tooltip-card {
    background: transparent !important;
    color: #f0f0f0 !important;
    border-radius: 10px;
    overflow: hidden;
}

body.broadcast-page .site-tooltip-card .tooltip-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
}

body.broadcast-page .site-tooltip-card .header-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ls-accent-bg);
    color: var(--bc-accent);
    border: 1px solid rgba(0, 188, 140, 0.3);
    flex-shrink: 0;
}

body.broadcast-page .site-tooltip-card .header-content {
    flex: 1;
    min-width: 0;
}

body.broadcast-page .site-tooltip-card .site-name {
    color: #fff !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.broadcast-page .site-tooltip-card .site-id {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 0.7rem !important;
}

body.broadcast-page .site-tooltip-card .tooltip-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.broadcast-page .site-tooltip-card .tooltip-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

body.broadcast-page .site-tooltip-card .tooltip-body {
    padding: 0 12px 8px;
}

body.broadcast-page .site-tooltip-card .tooltip-footer {
    padding: 8px 12px 12px;
    border-top: 1px solid var(--ls-border-subtle);
}

body.broadcast-page .site-tooltip-card .details-btn {
    width: 100%;
    background: var(--bc-accent);
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: filter 0.15s ease;
}

body.broadcast-page .site-tooltip-card .details-btn:hover {
    filter: brightness(1.15);
}

/* ---- Accordion in popup ---- */

body.broadcast-page .accordion-modern,
body.broadcast-page .accordion-item-modern {
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
}

body.broadcast-page .accordion-btn-modern {
    background: rgba(255, 255, 255, 0.04) !important;
    color: #f0f0f0 !important;
    border: 1px solid var(--ls-border-subtle) !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    margin-top: 6px !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    width: 100%;
    display: flex !important;
    align-items: center;
    gap: 8px;
    box-shadow: none !important;
}

body.broadcast-page .accordion-btn-modern:hover,
body.broadcast-page .accordion-btn-modern:focus {
    background: var(--ls-border-subtle) !important;
    border-color: var(--ls-accent-border) !important;
    color: #fff !important;
}

body.broadcast-page .accordion-btn-modern .accordion-icon {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ls-accent-bg);
    color: var(--bc-accent);
    font-size: 0.7rem;
    flex-shrink: 0;
}

body.broadcast-page .accordion-btn-modern span {
    flex: 1;
    text-align: left;
}

body.broadcast-page .accordion-btn-modern .accordion-chevron {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

body.broadcast-page .accordion-btn-modern[aria-expanded="true"] .accordion-chevron {
    transform: rotate(180deg);
}

body.broadcast-page .accordion-content-modern {
    padding: 10px 4px 4px !important;
    background: transparent !important;
    color: #f0f0f0 !important;
}

body.broadcast-page .info-section {
    margin-bottom: 12px;
}

body.broadcast-page .info-section .section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--bc-text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

body.broadcast-page .info-section .section-header i {
    color: var(--bc-accent);
}

body.broadcast-page .info-grid {
    display: grid;
    gap: 4px;
}

body.broadcast-page .info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.75rem;
}

body.broadcast-page .info-item .label {
    color: rgba(255, 255, 255, 0.5);
}

body.broadcast-page .info-item .value {
    color: #f0f0f0;
    font-weight: 500;
}

body.broadcast-page .info-item .value a {
    color: var(--bc-accent);
    text-decoration: none;
}

body.broadcast-page .info-item .value a:hover {
    text-decoration: underline;
}

body.broadcast-page hr {
    border-color: var(--ls-border-subtle);
    margin: 8px 0;
}

body.broadcast-page .empty-state {
    text-align: center;
    padding: 16px 8px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.75rem;
}

body.broadcast-page .empty-state i {
    font-size: 1.4rem;
    margin-bottom: 6px;
    display: block;
    color: var(--bc-info);
}

body.broadcast-page .empty-state p {
    margin: 0;
}

body.broadcast-page .loading-state {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    padding: 8px 0;
}

body.broadcast-page .loading-state .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--ls-border-medium);
    border-top-color: var(--bc-accent);
    border-radius: 50%;
    animation: bc-spin 0.8s linear infinite;
}

@keyframes bc-spin {
    to { transform: rotate(360deg); }
}

/* ===========================================================
   Right Panel content overrides (built dynamically by broadcast-map.js)
   =========================================================== */

body.broadcast-page .site-details-container {
    color: #f0f0f0;
}

body.broadcast-page .site-details-container .site-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ls-border-subtle);
}

body.broadcast-page .site-details-container .site-title {
    color: #fff !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    margin: 0 !important;
}

body.broadcast-page .site-details-container .site-id {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 0.72rem !important;
}

body.broadcast-page .site-details-container .section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--bc-text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin: 12px 0 8px;
}

body.broadcast-page .site-details-container .section-title i {
    color: var(--bc-accent);
}

body.broadcast-page .overview-section {
    margin-bottom: 14px;
}

body.broadcast-page .overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

body.broadcast-page .overview-card {
    background: var(--bc-bg-card) !important;
    border: 1px solid var(--bc-border) !important;
    border-radius: 6px !important;
    padding: 10px !important;
    text-align: center;
    box-shadow: none !important;
}

body.broadcast-page .overview-value {
    color: #fff !important;
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    line-height: 1.1;
}

body.broadcast-page .overview-label {
    color: var(--bc-text-muted) !important;
    font-size: 0.65rem !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

body.broadcast-page .source-card {
    background: var(--bc-bg-card) !important;
    border: 1px solid var(--bc-border) !important;
    border-radius: 6px !important;
    margin-bottom: 8px !important;
    overflow: hidden;
    box-shadow: none !important;
}

body.broadcast-page .source-card .source-header {
    padding: 10px 12px !important;
    cursor: pointer;
    background: transparent !important;
    border: none !important;
    transition: background 0.15s ease;
}

body.broadcast-page .source-card .source-header:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

body.broadcast-page .source-card .source-name {
    color: #fff !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
}

body.broadcast-page .source-card .source-info,
body.broadcast-page .source-card .source-details {
    color: rgba(255, 255, 255, 0.65) !important;
    font-size: 0.72rem !important;
}

body.broadcast-page .source-card .source-stats,
body.broadcast-page .source-card .pattern-count,
body.broadcast-page .source-card .badge {
    background: var(--ls-accent-bg) !important;
    color: var(--bc-accent) !important;
    border: 1px solid rgba(0, 188, 140, 0.3) !important;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 600;
}

body.broadcast-page .pattern-section {
    padding: 8px 12px 12px !important;
    border-top: 1px solid var(--ls-border-subtle) !important;
    background: rgba(0, 0, 0, 0.2) !important;
}

body.broadcast-page .pattern-chart-container {
    background: var(--bc-bg-base) !important;
    border-radius: 6px;
    padding: 10px;
    margin-top: 8px;
}

body.broadcast-page .charts-placeholder,
body.broadcast-page .empty-patterns {
    background: var(--bc-bg-base) !important;
    color: var(--bc-text-muted) !important;
    border-radius: 6px;
    padding: 16px;
    text-align: center;
}

body.broadcast-page .charts-placeholder i,
body.broadcast-page .empty-patterns i {
    color: var(--bc-info) !important;
}

/* ===========================================================
   New simplified popup (.bc-popup) — flat, neat, no accordion
   =========================================================== */

.bc-popup {
    color: #f0f0f0;
    font-size: 0.78rem;
    line-height: 1.4;
}

.bc-popup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--ls-border-subtle);
}

.bc-popup-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ls-accent-bg);
    color: var(--bc-accent);
    border: 1px solid rgba(0, 188, 140, 0.3);
    flex-shrink: 0;
    font-size: 0.85rem;
}

.bc-popup-title {
    flex: 1;
    min-width: 0;
}

.bc-popup-name {
    color: #fff;
    font-size: 0.92rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bc-popup-meta {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.68rem;
    margin-top: 1px;
}

/* Coordinates row in popup uses the same .bc-coords-row component but tighten margins */
.bc-popup .bc-coords-row {
    margin: 10px 14px;
}

/* Quick stat row (e.g. Altitude) — always visible inline */
.bc-popup-quickstat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
}

.bc-popup-quickstat > i {
    color: var(--bc-accent);
    font-size: 0.78rem;
    width: 14px;
    text-align: center;
}

.bc-popup-quickstat-label {
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-size: 0.66rem;
    flex: 1;
}

.bc-popup-quickstat-value {
    color: #f0f0f0;
    font-weight: 600;
    font-size: 0.78rem;
}

/* Collapsible "More info" section using HTML5 details/summary */
.bc-popup-details {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.bc-popup-details > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    transition: background 0.15s ease;
}

.bc-popup-details > summary::-webkit-details-marker {
    display: none;
}

.bc-popup-details > summary:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
}

.bc-popup-details > summary > i:first-child {
    color: var(--bc-accent);
    font-size: 0.78rem;
}

.bc-popup-details > summary > span {
    flex: 1;
}

.bc-popup-details-chevron {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.2s ease;
}

.bc-popup-details[open] .bc-popup-details-chevron {
    transform: rotate(180deg);
}

.bc-popup-rows {
    padding: 4px 14px 10px;
}

/* Placeholder content inside a collapsed details section (e.g. Survey info) */
.bc-popup-rows .bc-popup-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 2px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.72rem;
    font-style: italic;
}

.bc-popup-rows .bc-popup-empty i {
    color: var(--bc-info);
}

.bc-popup-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.bc-popup-row:last-child {
    border-bottom: none;
}

.bc-popup-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}

.bc-popup-value {
    color: #f0f0f0;
    font-size: 0.78rem;
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

.bc-popup-link {
    color: var(--bc-accent);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.bc-popup-link:hover {
    text-decoration: underline;
}

.bc-popup-footer {
    padding: 10px 14px 12px;
    border-top: 1px solid var(--ls-border-subtle);
}

.bc-popup-action {
    width: 100%;
    background: var(--bc-accent);
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: filter 0.15s ease;
}

.bc-popup-action:hover {
    filter: brightness(1.15);
}

/* ---- Sources/patterns rendered into the popup by JS ---- */

/* The JS builds .source-item / .item-header / .item-title / .item-badge etc. */
body.broadcast-page .bc-popup .source-item,
body.broadcast-page .bc-popup .pattern-group {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--ls-border-subtle) !important;
    border-radius: 6px !important;
    padding: 6px 9px !important;
    margin-bottom: 5px !important;
    box-shadow: none !important;
}

body.broadcast-page .bc-popup .item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

body.broadcast-page .bc-popup .item-title {
    color: #fff !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
}

body.broadcast-page .bc-popup .item-subtitle {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 0.68rem !important;
    margin-top: 2px;
}

body.broadcast-page .bc-popup .item-badge,
body.broadcast-page .bc-popup .frequency-badge {
    background: var(--ls-accent-bg) !important;
    color: var(--bc-accent) !important;
    border: 1px solid rgba(0, 188, 140, 0.3) !important;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.62rem;
    font-weight: 600;
    white-space: nowrap;
}

body.broadcast-page .bc-popup .badge-h {
    background: var(--ls-accent-bg) !important;
    color: var(--bc-accent) !important;
    border-color: rgba(0, 188, 140, 0.3) !important;
}

body.broadcast-page .bc-popup .badge-v {
    background: rgba(155, 81, 224, 0.15) !important;
    color: #c597f5 !important;
    border: 1px solid rgba(155, 81, 224, 0.3) !important;
}

body.broadcast-page .bc-popup .total-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 9px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--ls-border-subtle) !important;
    border-radius: 6px;
    margin-bottom: 5px;
}

body.broadcast-page .bc-popup .total-summary .label {
    color: rgba(255, 255, 255, 0.55) !important;
    font-size: 0.7rem !important;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

body.broadcast-page .bc-popup .total-summary .badge {
    background: var(--ls-accent-glow) !important;
    color: var(--bc-accent) !important;
    border: 1px solid var(--ls-accent-border) !important;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 0.7rem;
    font-weight: 700;
}

/* Make the leaflet popup tight to the new flat layout */
body.broadcast-page .leaflet-popup-content {
    width: 280px !important;
}

/* ===========================================================
   Right-panel: SOURCE CARD overrides (the JS-built ones with
   the orange MHz badge and yellow left border)
   =========================================================== */

body.broadcast-page .source-card {
    background: var(--bc-bg-card) !important;
    border: 1px solid var(--bc-border) !important;
    border-left: 3px solid var(--bc-accent) !important;
    border-radius: 6px !important;
    margin-bottom: 8px !important;
    box-shadow: none !important;
    overflow: hidden;
}

body.broadcast-page .source-card .source-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px !important;
    cursor: pointer;
    background: transparent !important;
    border: none !important;
    transition: background 0.15s ease;
}

body.broadcast-page .source-card .source-header:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

body.broadcast-page .source-card .source-info {
    flex: 1;
    min-width: 0;
}

body.broadcast-page .source-card .source-name {
    color: #fff !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    margin-bottom: 2px;
}

body.broadcast-page .source-card .source-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.7rem;
}

body.broadcast-page .source-card .source-meta .frequency {
    color: var(--bc-accent) !important;
    font-weight: 600;
    background: rgba(0, 188, 140, 0.12) !important;
    border: 1px solid rgba(0, 188, 140, 0.3) !important;
    border-radius: 10px;
    padding: 1px 8px;
}

body.broadcast-page .source-card .source-meta .polarization {
    color: rgba(255, 255, 255, 0.55) !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    text-transform: capitalize;
}

body.broadcast-page .source-card .source-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

body.broadcast-page .source-card .pattern-count {
    background: var(--ls-accent-bg) !important;
    color: var(--bc-accent) !important;
    border: 1px solid rgba(0, 188, 140, 0.3) !important;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 600;
}

body.broadcast-page .source-card .toggle-icon {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

body.broadcast-page .source-card .source-details {
    padding: 10px 12px !important;
    background: rgba(0, 0, 0, 0.25) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
}

body.broadcast-page .source-card .pattern-summary {
    margin-bottom: 8px;
}

body.broadcast-page .source-card .pattern-badges {
    display: flex;
    gap: 6px;
}

body.broadcast-page .source-card .pattern-badge {
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 600;
}

body.broadcast-page .source-card .pattern-badge.horizontal {
    background: var(--ls-accent-bg) !important;
    color: var(--bc-accent) !important;
    border: 1px solid rgba(0, 188, 140, 0.3) !important;
}

body.broadcast-page .source-card .pattern-badge.vertical {
    background: rgba(155, 81, 224, 0.15) !important;
    color: #c597f5 !important;
    border: 1px solid rgba(155, 81, 224, 0.3) !important;
}

/* ===========================================================
   Right-panel: PATTERN CHART CONTAINER
   The blue Horizontal_Polarization card and dark canvas
   =========================================================== */

body.broadcast-page .pattern-chart-container {
    background: var(--ls-bg-panel) !important;
    border: 1px solid var(--bc-border) !important;
    border-radius: 6px !important;
    padding: 10px 12px !important;
    margin-bottom: 10px !important;
    box-shadow: none !important;
}

body.broadcast-page .pattern-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px 0 !important;
    padding: 0 0 8px 0 !important;
    background: transparent !important;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

body.broadcast-page .pattern-chart-header .chart-title {
    color: #fff !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

body.broadcast-page .pattern-metadata {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

body.broadcast-page .pattern-metadata .metadata-badge {
    background: rgba(255, 255, 255, 0.06) !important;
    color: rgba(255, 255, 255, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: capitalize;
}

body.broadcast-page .pattern-metadata .metadata-badge.badge-h {
    background: var(--ls-accent-bg) !important;
    color: var(--bc-accent) !important;
    border-color: rgba(0, 188, 140, 0.3) !important;
}

body.broadcast-page .pattern-metadata .metadata-badge.badge-v {
    background: rgba(155, 81, 224, 0.15) !important;
    color: #c597f5 !important;
    border-color: rgba(155, 81, 224, 0.3) !important;
}

body.broadcast-page .pattern-metadata .metadata-badge.badge-altitude {
    background: rgba(255, 255, 255, 0.06) !important;
    color: rgba(255, 255, 255, 0.75) !important;
    border-color: var(--ls-border-medium) !important;
}

/* Chart canvas wrapper: lighter background + breathing room around the polar plot */
body.broadcast-page .chart-wrapper {
    background: #232323 !important;
    border-radius: 6px;
    padding: 14px 8px 8px;
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.broadcast-page .chart-wrapper canvas {
    max-width: 100% !important;
    height: auto !important;
}
