/* ============================================
   DARK THEME
   ============================================ */
.theme-dark,
.theme-dark:not(.chart-page),
.theme-dark .chart-page {
  background-color: #05080f !important;
}

.theme-dark {
  --tv-color-platform-background: #05080f;
  --tv-color-pane-background: #05080f;
  --tv-color-popup-background: rgba(15, 23, 35, 0.92);
  --tv-color-popup-element-background: rgba(15, 23, 35, 0.92);

  /* Price scale and time scale backgrounds */
  --tv-color-price-scale-background: rgba(0, 0, 0, 0);
  --tv-color-time-scale-background: rgba(0, 0, 0, 0);

  --tv-color-toolbar-button-text: rgba(168, 176, 186, 0.8);
  --tv-color-toolbar-button-text-hover: #FFFFFF;
  --tv-color-toolbar-button-text-active: #FFFFFF;
  --tv-color-toolbar-button-background: rgba(0, 0, 0, 0);
  --tv-color-toolbar-button-background-hover: rgba(79, 201, 218, 0.12);
  --tv-color-toolbar-button-background-expanded: rgba(79, 201, 218, 0.12);
  --tv-color-toolbar-button-background-active: rgba(79, 201, 218, 0.18);
  --tv-color-toolbar-toggle-button-background-active: rgba(79, 201, 218, 0.18);
  --tv-color-toolbar-toggle-button-background-active-hover: rgba(79, 201, 218, 0.22);

  /* Item states */
  --tv-color-item-active-text: #FFFFFF;

  /* Borders */
  --tv-color-toolbar-divider-background: rgba(255, 255, 255, 0.08);
}

/* Dark theme toolbar backgrounds */
.theme-dark .layout__area--top,
.theme-dark .layout__area--left,
.theme-dark .layout__area--right,
.theme-dark .layout__area--bottom,
.theme-dark [class*="toolbar"],
.theme-dark [class*="header"] {
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.075) 0%,
      rgba(255, 255, 255, 0.025) 50%,
      rgba(255, 255, 255, 0.015) 100%
    ),
    linear-gradient(145deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.6) 100%) !important;
  backdrop-filter: blur(24px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(160%) !important;
}

/* Dark control bar (indicators/timeframe row) */
.theme-dark [class*="controlBar"],
.theme-dark [class*="control-bar"],
.theme-dark [class*="inner-"] {
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.06) 0%,
      rgba(255, 255, 255, 0.02) 100%
    ),
    rgba(10, 15, 25, 0.85) !important;
  backdrop-filter: blur(16px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(160%) !important;
}

/* Price scale (right side) and time scale (bottom) backgrounds */
.theme-dark [class*="price-axis"],
.theme-dark [class*="priceAxis"],
.theme-dark [class*="time-axis"],
.theme-dark [class*="timeAxis"],
.theme-dark [class*="pane-separator"],
.theme-dark [class*="chart-markup-table"],
.theme-dark canvas + div,
.theme-dark [class*="scales"],
.theme-dark [class*="pricescale"],
.theme-dark [class*="timescale"] {
  background: rgba(10, 15, 25, 0.55) !important;
  backdrop-filter: blur(16px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(160%) !important;
}

/* Chart container and wrapper backgrounds */
.theme-dark [class*="chart-container"],
.theme-dark [class*="chartContainer"],
.theme-dark [class*="chart-gui-wrapper"],
.theme-dark [class*="pane"],
.theme-dark [class*="chart-markup-table"] pane {
  background-color: #05080f !important;
}

/* ============================================
   LIGHT THEME
   ============================================ */
.theme-light,
.theme-light:not(.chart-page),
.theme-light .chart-page {
  background-color: #05080f !important;
}

.theme-light {
  /* Core backgrounds */
  --tv-color-platform-background: #05080f;
  --tv-color-pane-background: #05080f;
  --tv-color-popup-background: rgba(15, 23, 35, 0.92);
  --tv-color-popup-element-background: rgba(15, 23, 35, 0.92);

  /* Price scale and time scale backgrounds */
  --tv-color-price-scale-background: rgba(0, 0, 0, 0);
  --tv-color-time-scale-background: rgba(0, 0, 0, 0);

  /* Toolbar styling */
  --tv-color-toolbar-button-text: rgba(168, 176, 186, 0.8);
  --tv-color-toolbar-button-text-hover: #FFFFFF;
  --tv-color-toolbar-button-text-active: #FFFFFF;
  --tv-color-toolbar-button-background: rgba(0, 0, 0, 0);
  --tv-color-toolbar-button-background-hover: rgba(79, 201, 218, 0.12);
  --tv-color-toolbar-button-background-expanded: rgba(79, 201, 218, 0.12);
  --tv-color-toolbar-button-background-active: rgba(79, 201, 218, 0.18);
  --tv-color-toolbar-toggle-button-background-active: rgba(79, 201, 218, 0.18);
  --tv-color-toolbar-toggle-button-background-active-hover: rgba(79, 201, 218, 0.22);

  /* Item states */
  --tv-color-item-active-text: #FFFFFF;

  /* Borders */
  --tv-color-toolbar-divider-background: rgba(255, 255, 255, 0.08);
}

/* Light theme toolbar backgrounds */
.theme-light .layout__area--top,
.theme-light .layout__area--left,
.theme-light .layout__area--right,
.theme-light .layout__area--bottom,
.theme-light [class*="toolbar"],
.theme-light [class*="header"] {
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.075) 0%,
      rgba(255, 255, 255, 0.025) 50%,
      rgba(255, 255, 255, 0.015) 100%
    ),
    linear-gradient(145deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.6) 100%) !important;
  backdrop-filter: blur(24px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(160%) !important;
}

/* Light control bar */
.theme-light [class*="controlBar"],
.theme-light [class*="control-bar"],
.theme-light [class*="inner-"] {
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.06) 0%,
      rgba(255, 255, 255, 0.02) 100%
    ),
    rgba(10, 15, 25, 0.85) !important;
  backdrop-filter: blur(16px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(160%) !important;
}

/* Price scale (right side) and time scale (bottom) backgrounds */
.theme-light [class*="price-axis"],
.theme-light [class*="priceAxis"],
.theme-light [class*="time-axis"],
.theme-light [class*="timeAxis"],
.theme-light [class*="pane-separator"],
.theme-light [class*="chart-markup-table"],
.theme-light canvas + div,
.theme-light [class*="scales"],
.theme-light [class*="pricescale"],
.theme-light [class*="timescale"] {
  background: rgba(10, 15, 25, 0.55) !important;
  backdrop-filter: blur(16px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(160%) !important;
}

/* Chart container and wrapper backgrounds */
.theme-light [class*="chart-container"],
.theme-light [class*="chartContainer"],
.theme-light [class*="chart-gui-wrapper"],
.theme-light [class*="pane"],
.theme-light [class*="chart-markup-table"] pane {
  background-color: #05080f !important;
}

/* ============================================
   SHARED STYLES
   ============================================ */

/* Hide the annoying zoom hint popup */
div[class^="container-"][class*="HCG"] {
  display: none !important;
}

/* Hide study/indicator legends (EMA, Volume, etc.) while keeping main series legend */
[data-name="legend-source-item"]:not([data-name="legend-series-item"]),
[class*="sourcesWrapper"],
[class*="sources-"],
div[class*="legend"] > div:not(:first-child),
.study-legend,
[data-study-id] {
  display: none !important;
}

/* Ensure all layout areas have no gaps */
.layout__area--top,
.layout__area--left,
.layout__area--right,
.layout__area--bottom {
  border: none !important;
}

/* Remove any gradient or multi-background effects without hiding drawings */
[class*="backgroundDrawingsContainer"] {
  background: none !important;
}

/* ============================================
   BOTTOM CONTROL BAR (zoom/scroll buttons)
   Make transparent by default, show on hover
   ============================================ */

/* Target the floating scroll/zoom control bar overlay */
[class*="scrollWrap"],
[class*="chart-controls"],
[class*="time-axis-controls"],
[class*="bottom-toolbar"],
div[class*="control"][class*="wrap"],
div[class*="controls-"][class*="bar"] {
  background: transparent !important;
  background-color: transparent !important;
  opacity: 0;
  transition: opacity 0.2s ease;
}

[class*="scrollWrap"]:hover,
[class*="chart-controls"]:hover,
[class*="time-axis-controls"]:hover,
[class*="bottom-toolbar"]:hover,
div[class*="control"][class*="wrap"]:hover,
div[class*="controls-"][class*="bar"]:hover {
  opacity: 1;
}

/* Also try targeting by the inner structure */
div[class*="inner-"][class*="wrap"] {
  background: transparent !important;
  background-color: transparent !important;
}

/* Target the bottom layout area */
.layout__area--bottom {
  background: transparent !important;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.layout__area--bottom:hover {
  opacity: 1;
}

/* Ensure left sidebar and top bar are always visible */
.layout__area--left,
.layout__area--top {
  opacity: 1 !important;
}

.layout__area--left *,
.layout__area--top * {
  opacity: 1 !important;
}

/* ============================================
   HIDE SAVE BUTTON
   ============================================ */
[data-name="save-load-menu"],
[class*="saveLoad"],
button[data-tooltip="Save"] {
  display: none !important;
}