/* ========================================
   BANDWIDTH CHART
   Range buttons + chart container
   ======================================== */

/* ─── Range Button Group ─── */

.bw-range-group {
  display: flex;
  gap: 0;
  margin-left: auto;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

[data-theme="dark"] .bw-range-group {
  border-color: #374151;
}

.bw-range-btn {
  background: transparent;
  border: none;
  padding: 0.25rem 0.65rem;
  font-size: var(--bulma-size-normal);
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  border-right: 1px solid #e5e7eb;
}

.bw-range-btn:last-child {
  border-right: none;
}

.bw-range-btn:hover {
  background-color: #f3f4f6;
  color: #374151;
}

.bw-range-btn.is-active {
  background-color: #3274d9;
  color: white;
}

.bw-range-btn.is-active:hover {
  background-color: #2563b0;
}

[data-theme="dark"] .bw-range-btn {
  color: #9ca3af;
  border-right-color: #374151;
}

[data-theme="dark"] .bw-range-btn:hover {
  background-color: #374151;
  color: #e5e7eb;
}

[data-theme="dark"] .bw-range-btn.is-active {
  background-color: #5ba1e8;
  color: #111827;
}

[data-theme="dark"] .bw-range-btn.is-active:hover {
  background-color: #4a90d9;
}

/* ─── Fullscreen Button ─── */

.bw-fullscreen-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  margin-left: 0.5rem;
  color: #6b7280;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.bw-fullscreen-btn:hover {
  background-color: #f3f4f6;
  color: #374151;
}

[data-theme="dark"] .bw-fullscreen-btn {
  border-color: #374151;
  color: #9ca3af;
}

[data-theme="dark"] .bw-fullscreen-btn:hover {
  background-color: #374151;
  color: #e5e7eb;
}

/* ─── Fullscreen Mode ─── */

.bw-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 51;
  background: var(--bulma-scheme-main);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.bw-fullscreen .bw-chart-body {
  flex: 1;
  min-height: 0;
}

.bw-fullscreen .bw-chart-body canvas {
  height: 100% !important;
}

/* ─── Chart Container ─── */

.bw-chart-body {
  position: relative;
  min-height: 280px;
}

.bw-chart-body canvas {
  width: 100% !important;
  height: 280px !important;
}

.bw-chart-body-tall {
  min-height: 60vh;
}

.bw-chart-body-tall canvas {
  height: 60vh !important;
}

/* ─── Loading State ─── */

.bw-chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #9ca3af;
  font-size: var(--bulma-size-6);
}

/* ─── Empty State ─── */

.bw-chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #9ca3af;
}

.bw-chart-empty .icon {
  font-size: var(--bulma-size-3);
  opacity: 0.4;
}

.bw-chart-empty p {
  font-size: var(--bulma-size-6);
}

/* ─── Stats Bar ─── */

.bw-stats {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid #e5e7eb;
}

.bw-stats:empty {
  display: none;
}

[data-theme="dark"] .bw-stats {
  border-top-color: #374151;
}

.bw-stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bw-stat-label {
  font-size: var(--bulma-size-7);
  color: #6b7280;
}

[data-theme="dark"] .bw-stat-label {
  color: #9ca3af;
}

.bw-stat-value {
  font-size: var(--bulma-size-7);
  font-weight: 600;
}

.bw-stat-inbound {
  color: #3274d9;
}

[data-theme="dark"] .bw-stat-inbound {
  color: #5ba1e8;
}

.bw-stat-outbound {
  color: #56a64b;
}

[data-theme="dark"] .bw-stat-outbound {
  color: #6ecf72;
}

.bw-stat-percentile {
  color: #f59e0b;
}

[data-theme="dark"] .bw-stat-percentile {
  color: #ffb74d;
}

/* ─── Responsive ─── */

@media (max-width: 768px) {
  .bw-chart-body {
    min-height: 220px;
  }

  .bw-chart-body canvas {
    height: 220px !important;
  }

  .bw-chart-body-tall {
    min-height: 60vh;
  }

  .bw-chart-body-tall canvas {
    height: 60vh !important;
  }

  .bw-range-group {
    margin-left: 0;
    margin-top: 0.5rem;
  }

  .vm-detail-card-header:has(.bw-range-group) {
    flex-wrap: wrap;
  }

  .bw-stats {
    flex-wrap: wrap;
    gap: 1rem;
  }
}
