/* =========================================
   3. Chart Sidebar Controls (Compact Right)
   ========================================= */
.chart-sidebar {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 110px;
  padding: 15px 10px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  
  /* ALIGN TO TOP (Fixed) */
  justify-content: flex-start;
  padding-top: 50px; /* Push down slightly so it aligns with chart top area */
  
  z-index: 10;
  border-left: 1px solid rgba(127,127,127, 0.1); 
  background: rgba(255,255,255,0.02);
}

.group.vertical {
  display: flex;
  flex-direction: column;
  background: var(--track-bg);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  border: 1px solid rgba(127,127,127,0.1);
}

.group.vertical > label:first-child {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--muted);
  opacity: 0.7;
  padding: 4px 0 2px;
  border-bottom: 1px solid rgba(127,127,127,0.1);
  margin-bottom: 2px;
}

.group.vertical label:not(:first-child) {
  position: relative;
  text-align: center;
  padding: 6px 4px;
  border-radius: 8px;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  display: block;
}

.group input[type="radio"] { appearance: none; position: absolute; width: 0; height: 0; opacity: 0; }

.group label:has(input:checked) {
  background: var(--active-bg);
  color: var(--ink);
  font-weight: 700;
  box-shadow: var(--active-shadow);
}


/* =========================================
   4. Chart Area & Pills (Updated)
   ========================================= */
.chart-wrap { position: relative; height: 72vh; margin-top: 10px; }
.chart-wrap::before{
  content:""; position:absolute; inset:0; z-index:0;
  background: radial-gradient(900px 600px at 75% 10%, rgba(60,110,200,.10), rgba(255,255,255,0) 60%);
  pointer-events:none;
}

.chart-controls-left { position: absolute; left: 16px; top: 16px; z-index: 20; }
.chart-controls-center { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); z-index: 20; }

.pill-switch {
  display: flex; background: var(--track-bg); backdrop-filter: blur(10px);
  border: 1px solid rgba(127,127,127, 0.1); border-radius: 20px; padding: 3px; gap: 4px;
}
.pill-switch span {
  padding: 6px 12px; border-radius: 16px; font-size: 0.8rem; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: all 0.2s; user-select: none;
  display: flex; align-items: center; gap: 6px; /* Icon spacing */
}
.pill-switch span.active { background: var(--active-bg); color: var(--ink); box-shadow: var(--active-shadow); }

/* SVG Icon styles */
.pill-switch span svg { opacity: 0.7; }
.pill-switch span.active svg { opacity: 1; }

.flip-card { position: relative; width: 100%; height: 100%; }
.face {
  position: absolute; inset: 0; border-radius: 12px; overflow: hidden;
  opacity: 0; pointer-events: none; transform: translateY(10px); transition: 0.3s;
}
.face.active { opacity: 1; pointer-events: auto; transform: translateY(0); }

.face.glass {
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
  backdrop-filter: blur(10px) saturate(1.1);
  border: 1px solid rgba(255,255,255,0.3); border-top-color: rgba(255,255,255,0.6);
  box-shadow: 0 20px 50px rgba(0,0,0,0.05), inset 0 0 0 1px rgba(255,255,255,0.1);
}
body.dark .face.glass {
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.01));
  border-color: rgba(255,255,255,0.1);
}

#priceChart, #barsChart {
  position: absolute;
  top: 50px; left: 10px; bottom: 10px;
  right: 120px; 
  z-index: 1;
}