:root {
  --primary-dark: #000000;
  --primary: #179486;
  --accent: #DE9E35;
  --text-light: #ffffff;
  --text-dark: #1f1f1f;
  --chart-bg: #2e3a46;
  --card-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Contenedor principal del gráfico */
.chart-container {
  width: 100%;
  margin-bottom: 24px;
  background-color: var(--chart-bg);
  border-radius: 6px;
  border: 1px solid var(--primary-dark);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  position: relative;
  transition: box-shadow 0.3s ease;
}

.chart-container:hover {
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
}

#chart-main {
  height: 400px;
}
#chart-rsi, #chart-macd {
  height: 150px;
}

/* Cabecera del gráfico */
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--primary-dark);
  padding: 12px 20px;
  color: var(--text-light);
  border-bottom: 1px solid var(--primary);
}

/* Branding del gráfico */
.chart-branding {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.chart-branding a {
  color: var(--accent);
  text-decoration: none;
}
.chart-branding a:hover {
  text-decoration: underline;
}

/* Precio actual */
.current-price-display {
  font-weight: bold;
  font-size: 18px;
}
.price-value {
  color: var(--card-shadow);
  margin-left: 6px;
  margin-top: 9px;
}
.price-falling .price-value {
  color: #FF6B0E;
}

/* Última actualización */
.last-update {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  opacity: 1;
}
.last-update span {
  color: var(--text-light);
  margin-left: 4px;
}

/* Controles */
.chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--primary-dark);
  background-color: var(--primary-dark);
}

/* Botones de timeframe */
.timeframe-button,
.chart-view-button {
  padding: 6px 14px;
  background: var(--chart-bg);
  color: var(--text-light);
  border: 1px solid var(--text-light);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s, transform 0.2s;
}

.timeframe-button:hover,
.chart-view-button:hover {
  background: var(--primary);
  transform: scale(1.03);
}

.timeframe-button.active,
.chart-view-button.active {
  background: var(--text-light);
  color: var(--text-dark);
  border-color: var(--accent);
}

/* Indicadores */
.indicator-toggle {
  display: flex;
  align-items: center;
  margin-left: 12px;
}

.indicator-toggle label {
  margin-left: 6px;
  font-size: 14px;
  color: var(--text-light);
}

/* Switch personalizado */
.indicator-toggle input[type="checkbox"] {
  appearance: none;
  width: 40px;
  height: 20px;
  background: var(--primary-dark);
  border: 1px solid var(--primary);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
}
.indicator-toggle input[type="checkbox"]::before {
  content: '';
  width: 16px;
  height: 16px;
  background: var(--text-light);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: 0.3s;
}
.indicator-toggle input[type="checkbox"]:checked {
  background: var(--primary);
}
.indicator-toggle input[type="checkbox"]:checked::before {
  left: 22px;
}

/* Leyenda */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  padding: 12px 20px;
  background-color: var(--primary-dark);
  color: var(--text-light);
  border-top: 1px solid var(--primary);
  border-radius: 0 0 6px 6px;
  font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
  .chart-controls {
    flex-direction: column;
  }
  .chart-view-controls {
    margin-top: 10px;
    display: flex;
    gap: 8px;
  }
  .chart-header {
    flex-direction: column;
    gap: 8px;
    padding: 10px;
  }
  .chart-branding,
  .current-price-display,
  .last-update {
    text-align: center;
  }
  .chart-legend {
    flex-direction: column;
    gap: 8px;
  }
}

/* Modo oscuro */
body[data-theme="dark"] .container {
  background-color: transparent;
}
body[data-theme="dark"] .chart-container,
body[data-theme="dark"] .main-content,
body[data-theme="dark"] .chart-legend {
  background-color: var(--primary-dark);
}

/* Enlaces de precio */
.price-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}
.price-link:hover {
  color: var(--accent);
  text-decoration: underline;
}
