/* BI Sidebar — overlay drawer from right */

/* Overlay backdrop */
.bi-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.bi-sidebar--open .bi-sidebar-overlay {
  opacity: 1;
  visibility: visible;
}

/* Panel */
.bi-sidebar-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 100vw;
  background: #111;
  border-left: 1px solid #333;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.bi-sidebar--open .bi-sidebar-panel {
  transform: translateX(0);
}

/* Resize handle */
.bi-sidebar-resize {
  position: absolute;
  top: 0;
  left: -3px;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
  z-index: 1001;
  transition: background 0.15s ease;
}

.bi-sidebar-resize:hover,
.bi-sidebar-resize.dragging {
  background: #36A7E4;
}

/* Header */
.bi-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #2d2d2d;
  flex-shrink: 0;
}

.bi-sidebar-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.bi-sidebar-close {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: #999;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.2s, color 0.2s;
}

.bi-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Content area */
.bi-sidebar-content {
  padding: 24px;
  flex: 1;
}

/* Section labels */
.bi-sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

/* KPI Grid */
.bi-sidebar-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}

.bi-sidebar-kpi-card {
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  border: 1px solid #2d2d2d;
}

.bi-sidebar-kpi-card--blue {
  background: linear-gradient(135deg, rgba(54, 167, 228, 0.08) 0%, rgba(54, 167, 228, 0.02) 100%);
  border-color: rgba(54, 167, 228, 0.2);
}

.bi-sidebar-kpi-card--green {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(34, 197, 94, 0.02) 100%);
  border-color: rgba(34, 197, 94, 0.2);
}

.bi-sidebar-kpi-card--amber {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.02) 100%);
  border-color: rgba(245, 158, 11, 0.2);
}

.bi-sidebar-kpi-card--purple {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.08) 0%, rgba(168, 85, 247, 0.02) 100%);
  border-color: rgba(168, 85, 247, 0.2);
}

.bi-sidebar-kpi-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}

.bi-sidebar-kpi-value--blue { color: #36A7E4; }
.bi-sidebar-kpi-value--green { color: #22c55e; }
.bi-sidebar-kpi-value--amber { color: #f59e0b; }
.bi-sidebar-kpi-value--purple { color: #a855f7; }

.bi-sidebar-kpi-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* Chart section */
.bi-sidebar-chart-wrap {
  margin-top: 4px;
}

.bi-sidebar-chart-wrap canvas {
  width: 100% !important;
  max-height: 220px;
}

/* Toggle button in header */
.bi-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
  color: inherit;
  border: none;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s;
}

.bi-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Mobile */
@media (max-width: 768px) {
  .bi-sidebar-panel {
    width: 100vw !important;
  }

  .bi-sidebar-resize {
    display: none;
  }
}
