/* ==========================================================================
   Chart Workstation Slide-In Drawer Styles (Zero-Duplicate Header)
   The chart inside iframe already has the header, so outer header is removed!
   ========================================================================== */

.chart-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(6px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.chart-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.chart-drawer {
  position: fixed;
  top: 0;
  right: 44px;
  width: 1060px;
  max-width: calc(100vw - 44px);
  height: 100vh;
  background: #070d1c;
  color: #f8fafc;
  z-index: 9999;
  transform: translateX(calc(100% + 44px));
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -15px 0 45px rgba(0, 0, 0, 0.75), 0 0 25px rgba(56, 189, 248, 0.15);
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  overflow: hidden;
  border-left: 1px solid rgba(56, 189, 248, 0.3);
}

body.sidebar-hidden .chart-drawer {
  right: 0 !important;
  max-width: 100vw;
}

.chart-drawer.open {
  transform: translateX(0);
}

/* Floating Clean Close Button (Top-Right of Drawer) */
.chart-drawer-close-float {
  position: absolute;
  top: 6px;
  right: 12px;
  z-index: 100;
  background: rgba(10, 22, 40, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.chart-drawer-close-float:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  transform: scale(1.06);
}

/* Full-Height Body */
.chart-drawer-body {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100vh;
  background: #070d1c;
  overflow: hidden;
}

.chart-drawer-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.chart-drawer-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #070d1c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.chart-drawer-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: chartSpin 0.7s linear infinite;
}

@keyframes chartSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .chart-drawer {
    width: 100vw;
    max-width: 100vw;
  }
}

/* =======================================================
   CHART DRAWER - LIGHT THEME (MODE SIANG)
   ======================================================= */
body.theme-light .chart-drawer-backdrop {
  background: rgba(15, 23, 42, 0.35);
}

body.theme-light .chart-drawer {
  background: #ffffff;
  border-left: 1px solid #cbd5e1;
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.12);
  color: #0f172a;
}

body.theme-light .chart-drawer-close-float {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #cbd5e1;
  color: #64748b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.theme-light .chart-drawer-close-float:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #ef4444;
}

body.theme-light .chart-drawer-body {
  background: #ffffff;
}

body.theme-light .chart-drawer-loading {
  background: #ffffff;
}

