/* ═══════════════════════════════════════════════════════════════
   BUBBELS.CSS  —  Yuverta Bubbelmap
   ═══════════════════════════════════════════════════════════════ */

/* ── Layout: break out of Bootstrap container ────────────────── */
.bubbles-page-override {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-top: 0 !important;
}

.bubbles-wrapper {
    background: #03091a;
    min-height: calc(100vh - 58px);
    display: flex;
    flex-direction: column;
    position: relative;
    font-family: 'DM Sans', sans-serif;
}

/* ── Control bar ─────────────────────────────────────────────── */
.bbl-controls {
    background: #060d1f;
    border-bottom: 1px solid #112040;
    padding: 10px 18px 8px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex-shrink: 0;
    z-index: 10;
}

.bbl-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bbl-section-label {
    color: #2e4a70;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
    margin-right: 2px;
    flex-shrink: 0;
}

.bbl-btn-group {
    display: flex;
    gap: 2px;
    background: #09142a;
    border-radius: 8px;
    padding: 3px;
    border: 1px solid #112040;
}

.bbl-btn {
    background: transparent;
    border: none;
    color: #4a6888;
    font-size: 12.5px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    padding: 5px 11px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    line-height: 1;
}
.bbl-btn:hover {
    background: #142040;
    color: #c0d4f0;
}
.bbl-btn.active {
    background: #0f2a5a;
    color: #A7FF00;
    font-weight: 600;
}

.bbl-divider {
    width: 1px;
    height: 22px;
    background: #112040;
    flex-shrink: 0;
}

/* Search */
.bbl-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.bbl-search-wrap svg {
    position: absolute;
    left: 9px;
    color: #2e4a70;
    pointer-events: none;
}
.bbl-search {
    background: #09142a;
    border: 1px solid #112040;
    border-radius: 8px;
    color: #c0d4f0;
    font-family: 'DM Sans', sans-serif;
    font-size: 12.5px;
    padding: 5px 10px 5px 30px;
    outline: none;
    width: 155px;
    transition: border-color 0.15s, width 0.2s;
}
.bbl-search::placeholder { color: #2e4a70; }
.bbl-search:focus {
    border-color: #1d4080;
    width: 190px;
}

/* Toggle switch */
.bbl-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    color: #4a6888;
    font-size: 12.5px;
    user-select: none;
    white-space: nowrap;
}
.bbl-toggle input { display: none; }
.bbl-toggle-track {
    width: 30px;
    height: 17px;
    background: #09142a;
    border-radius: 9px;
    border: 1px solid #112040;
    position: relative;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
}
.bbl-toggle input:checked ~ .bbl-toggle-track {
    background: #0f2a5a;
    border-color: #1d4080;
}
.bbl-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #2e4a70;
    transition: transform 0.2s, background 0.2s;
}
.bbl-toggle input:checked ~ .bbl-toggle-track::after {
    transform: translateX(13px);
    background: #A7FF00;
}
.bbl-toggle:has(input:checked) {
    color: #8ab0d8;
}

/* ── Stats bar ───────────────────────────────────────────────── */
.bbl-stats {
    background: #030910;
    border-bottom: 1px solid #0a1428;
    padding: 5px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 11.5px;
    color: #2e4a70;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.bbl-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}
.bbl-stat-val   { color: #6a90b8; font-weight: 600; }
.bbl-stat-alert { color: #FF2F00; font-weight: 700; }
.bbl-stat-ok    { color: #A7FF00; font-weight: 600; }
.bbl-stat-info  { color: #4a6888; }

.bbl-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #A7FF00;
    animation: bbl-live 2.2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes bbl-live {
    0%,100% { opacity: 1; transform: scale(1);   }
    50%      { opacity: 0.3; transform: scale(0.7); }
}

.bbl-refresh-ring {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid #2e4a70;
    border-top-color: #A7FF00;
    animation: bbl-spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s;
}
.bbl-refresh-ring.spinning { opacity: 1; }
@keyframes bbl-spin { to { transform: rotate(360deg); } }

/* ── Bubble canvas ───────────────────────────────────────────── */
#bubble-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 400px;
}
#bubble-svg {
    width: 100%;
    height: 100%;
    display: block;
    cursor: default;
}

/* ── SVG elements ────────────────────────────────────────────── */
.bbl-node {
    cursor: pointer;
    transition: opacity 0.4s;
}
.bbl-node.dimmed {
    opacity: 0.08 !important;
}
.bbl-node.highlighted circle.bbl-circle {
    filter: brightness(1.2);
}

.bbl-circle {
    transition: r 0.7s, fill 0.7s;
}

.bbl-glow {
    fill: none;
    pointer-events: none;
    animation: bbl-glow-pulse 2s ease-out infinite;
}
@keyframes bbl-glow-pulse {
    0%   { opacity: 0.8; }
    100% { opacity: 0; transform: scale(1.4); transform-origin: center; }
}

.bbl-lbl-name   {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    fill: rgba(255,255,255,0.88);
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}
.bbl-lbl-value  {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    fill: #ffffff;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}
.bbl-lbl-change {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}
.bbl-lbl-change.pos { fill: #A7FF00; }
.bbl-lbl-change.neg { fill: #ff7777; }
.bbl-lbl-change.neu { fill: rgba(255,255,255,0.35); }

.bbl-lbl-inactive {
    font-family: 'DM Sans', sans-serif;
    font-style: italic;
    fill: rgba(255,255,255,0.28);
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

.school-bg-label {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-weight: 700;
    fill: rgba(255,255,255,0.04);
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
    user-select: none;
    letter-spacing: 0.04em;
}

/* ── Loading overlay ─────────────────────────────────────────── */
.bbl-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(3,9,26,0.82);
    z-index: 20;
    gap: 10px;
    color: #4a6888;
    font-size: 13px;
    transition: opacity 0.3s;
}
.bbl-loading.hidden {
    opacity: 0;
    pointer-events: none;
}
.bbl-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #112040;
    border-top-color: #A7FF00;
    border-radius: 50%;
    animation: bbl-spin 0.75s linear infinite;
    flex-shrink: 0;
}

/* ── Tooltip ─────────────────────────────────────────────────── */
.bbl-tooltip {
    position: fixed;
    background: #060d1f;
    border: 1px solid #1a3060;
    border-radius: 12px;
    padding: 13px 15px;
    pointer-events: none;
    z-index: 200;
    min-width: 215px;
    max-width: 275px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.7), 0 0 0 1px rgba(167,255,0,0.07);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.18s, transform 0.18s;
    font-family: 'DM Sans', sans-serif;
}
.bbl-tooltip.vis {
    opacity: 1;
    transform: translateY(0);
}

.bbl-tt-header {
    margin-bottom: 9px;
    padding-bottom: 8px;
    border-bottom: 1px solid #112040;
}
.bbl-tt-name {
    font-size: 15px;
    font-weight: 700;
    color: #e8f0ff;
}
.bbl-tt-school {
    font-size: 10.5px;
    color: #2e4a70;
    margin-top: 2px;
}
.bbl-tt-badges {
    display: flex;
    gap: 5px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.bbl-tt-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
}
.bbl-tt-badge.health  { background: #0a2010; color: #A7FF00; border: 1px solid #1a4020; }
.bbl-tt-badge.alert   { background: #2a0800; color: #FF6666; border: 1px solid #4a1000; }
.bbl-tt-badge.inactive{ background: #141414; color: #666; border: 1px solid #222; }

.bbl-tt-sensor {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
    border-bottom: 1px solid rgba(17,32,64,0.6);
}
.bbl-tt-sensor:last-of-type { border-bottom: none; }
.bbl-tt-sname {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #4a6888;
}
.bbl-tt-sname .icon { font-size: 11px; }
.bbl-tt-sright {
    display: flex;
    align-items: center;
    gap: 7px;
}
.bbl-tt-val  { color: #d8e8ff; font-weight: 600; }
.bbl-tt-chg  { font-size: 10.5px; font-weight: 500; }
.bbl-tt-chg.pos { color: #A7FF00; }
.bbl-tt-chg.neg { color: #FF7777; }
.bbl-tt-chg.neu { color: #2e4a70; }
.bbl-tt-dot  { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.bbl-tt-dot.ok   { background: #A7FF00; box-shadow: 0 0 5px #A7FF0080; }
.bbl-tt-dot.warn { background: #FF2F00; box-shadow: 0 0 5px #FF2F0060; }
.bbl-tt-dot.null { background: #2e4a70; }

.bbl-tt-footer {
    margin-top: 9px;
    padding-top: 7px;
    border-top: 1px solid #112040;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10.5px;
    color: #2e4a70;
}
.bbl-tt-footer a { color: #4a7ab8; text-decoration: none; }
.bbl-tt-footer a:hover { color: #A7FF00; }

/* ── Legend ──────────────────────────────────────────────────── */
.bbl-legend {
    position: absolute;
    bottom: 14px;
    right: 16px;
    background: rgba(6,13,31,0.93);
    border: 1px solid #112040;
    border-radius: 10px;
    padding: 10px 13px;
    z-index: 10;
    backdrop-filter: blur(6px);
}
.bbl-legend-title {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #2e4a70;
    margin-bottom: 7px;
    font-weight: 600;
}
.bbl-legend-scale {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.bbl-legend-grad {
    width: 80px;
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(to right, #FF2F00, #FF8800, #444, #88cc00, #A7FF00);
}
.bbl-legend-lo, .bbl-legend-hi {
    font-size: 9.5px;
    color: #2e4a70;
}
.bbl-legend-items { display: flex; flex-direction: column; gap: 4px; }
.bbl-legend-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    color: #4a6888;
}
.bbl-legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Empty state ─────────────────────────────────────────────── */
.bbl-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #2e4a70;
    font-size: 14px;
    gap: 8px;
    display: none;
}
.bbl-empty svg { opacity: 0.3; }

/* ── No-data badge inside bubble ────────────────────────────── */
.bbl-no-data-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 9px;
    fill: rgba(255,255,255,0.25);
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
    font-style: italic;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .bbl-controls { padding: 7px 10px 6px; gap: 6px; }
    .bbl-btn { font-size: 11.5px; padding: 4px 8px; }
    .bbl-search { width: 110px; }
    .bbl-legend { display: none; }
    .bbl-section-label { display: none; }
}

@media (max-width: 480px) {
    .bbl-btn { font-size: 11px; padding: 4px 6px; }
    .bbl-search { width: 90px; font-size: 11px; }
}
