.chart {
  width: 100%;
  max-width: 100%;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  padding: 24px;
  /* border-width: 1px 1px 8px 1px; */
  /* border-style: solid; */
  /* border-color: #e8e8e8; */
  position: relative;

  >* {
    width: 100%;
  }
}

#cryptoChart {
  z-index: 0;
  position: relative;
}

.chart__controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chart__controls-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
}

.chart__controls .chart__button {
  font-size: 14px;
  line-height: 20px;
  font-weight: bold;
  background: none;
  border: none;
  border: 1px solid #FBC6CE;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  color: #211b2e;
  margin: 0;
  z-index: 1;
  white-space: nowrap;
  background-color: #ffffff;
}

.chart__button.chart__button--linear {
  margin-left: 15px;
}

/* Hover and active states */
.chart__button:hover,
.chart__button.active {
  color: #D00120;
  border-bottom: 1px solid #FBC6CE;
  background-color: #FBC6CE;
}

.chart__container {
  position: relative;
  width: 100%;
  height: 400px;
}

.chart__canvas {
  flex: 1;
}

.chart__volume {
  position: absolute;
  top: 0;
  left: 0;
  height: 20%;
  width: 100%;
  pointer-events: none;
}

.crypto-events h3[id] {
  scroll-margin-top: 50px;
}

.chart-tooltip {
  cursor: pointer;
  user-select: none;
  background: #ffffff;
  border: 1px solid #d9dfeb;
  color: #031129;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(3, 17, 41, 0.12);
  padding: 12px 16px;
  max-width: min(200px, calc(100% - 16px));
  width: max-content;
  white-space: normal;
  line-height: 1.4;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  pointer-events: auto;
  text-align: left;
  z-index: 5;
}


.chart-tooltip--compact {
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  text-align: center;
}

.chart-tooltip--expanded {
  padding: 12px 16px;
}

.chart-tooltip--active {
  border-color: #D9DFEB;
}

.chart-tooltip__date {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 4px;
  color: #031129;
}

.chart-tooltip__title {
  font-weight: 500;
  font-size: 12px;
  word-break: break-word;
  color: #031129;
}

.chart-tooltip__badge {
  font-weight: 600;
  font-size: 12px;
  display: inline-block;
  color: #031129;
}

.chart-tooltip__connector {
  width: 2px;
  background: #D9DFEB;
  pointer-events: none;
  z-index: 0;
  transform: translateX(-50%);
  border-radius: 2px;
  height: 0;
}

.view-event-btn {
  border: none;
  color: var(--wp--preset--color--red-500);
  margin-bottom: 10px;
  padding: 0;
  border-bottom: 2px solid var(--wp--preset--color--red-500);
  background-color: transparent;
  cursor: pointer;
}

.event-content {
  word-wrap: break-word;
}

.event-content a {
  word-break: break-word;
}

.chart__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.chart__info {
  display: grid;
  align-items: center;
  justify-content: start;
  column-gap: 12px;
  row-gap: 6px;
  grid-template-areas:
    "info"
    "price"
    "marketcap";
}

.chart__info-icon {
  grid-area: info;
  display: flex;
  align-items: center;
  overflow: hidden;
  min-height: 40px;
  gap: 10px;
}

.chart__info-icon img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: contain;
  display: block;
}

.chart__info-name {
  font-weight: bold;
  font-size: 20px;
  line-height: 1.2;
}

.chart__info-symbol {
  font-size: 14px;
  color: #777;
  text-transform: uppercase;
}

.chart__info-current {
  grid-area: price;
  display: flex;
  gap: 12px;
}

.chart__info-extra {
  grid-area: marketcap;
  display: flex;
  gap: 12px;
}

.chart__info-price {
  font-size: 28px;
  font-family: 'Outfit', sans-serif;
  line-height: 28px;
  font-weight: 600;
  color: #211b2e;
}

.chart__info-change {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #211b2e;
}

.chart__info-change-icon {
  display: inline-flex;
  line-height: 0;
}

.chart__info-change svg {
  display: block;
  width: 12px;
  height: 6px;
  max-width: unset;
}

.chart__info-change-text {
  display: inline-block;
}

.chart__info-change-text--h {
  font-size: 12px;
  font-weight: 400;
}

.chart__info-change.is-positive {
  color: #119f59;
  border-bottom: 1px solid #C6F6D5;
  background-color: #C6F6D5;
  border-radius: 4px;
  padding: 0 6px;
}

.chart__info-change.is-positive .chart__info-change-icon {
  transform: rotate(180deg);
}

.chart__info-change.is-negative {
  color: #D00120;
  border-bottom: 1px solid #FBC6CE;
  background-color: #FBC6CE;
  border-radius: 4px;
  padding: 0 6px;
}

.chart__info-change.is-neutral .chart__info-change-icon {
  display: none;
}

.chart__info-marketcap {
  font-size: 14px;
  white-space: nowrap;
}

.chart__info-label {
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 800px) {
  .chart__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart__controls {
    width: 100%;
  }

  .chart__info {
    align-self: flex-start;
  }

  .chart {
    padding: 0;
  }

  .chart__container {
    height: 300px;
  }
}
