:host {
  display: flex;
  flex-direction: column;
  position: relative;
}

.tooltip.hide {
  opacity: 0 !important;
}

.tooltip .pin {
  height: 6px;
  width: 6px;
  background: var(--fc-chart-tooltip-color, var(--fc-gray-500));
  border: 6px var(--fc-color-surface-primary) solid;
  box-shadow: var(--fc-shadow-card);
  border-radius: 50%;
  align-self: center;
}

.tooltip .card {
  min-width: 140px;
  width: max-content;
  height: fit-content;
  box-shadow: var(--fc-shadow-card);
  border: 0.5px solid var(--fc-color-border-primary);
  border-radius: 10px;
  background: transparent;
  padding: 4px;
  box-sizing: border-box;
  gap: var(--fc-spacing-sm);
  display: flex;
  flex-direction: column;
  position: relative;
}

.tooltip.align-right .card {
  transform: translateX(-50%);
}

.tooltip.align-left .card {
  transform: translateX(50%);
}

.card[data-card-position="top"] {
  top: -110px;
}

:host([preview-mode]) .tooltip .card {
  padding: 4px;
}

.tooltip .card * {
  position: relative;
}

.tooltip .card::before {
  position: absolute;
  border-radius: inherit;
  width: 100%;
  height: 100%;
  content: '';
  top: 0;
  left: 0;
  opacity: 96%;
  background: var(--fc-color-surface-secondary);
}

.tooltip {
  position: absolute;
  pointer-events: none;
  transform: translateY(-9px) translateX(-50%);
  display: flex;
  gap: 10px;
  flex-direction: column;
  z-index: 1;
  transition: 0.4s cubic-bezier(0.23, 1.24, 0.28, 1);
}

.tooltip-header {
  width: 100%;
  height: fit-content;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 5px 8px;
  box-sizing: border-box;
  position: relative;
}

.tooltip-header.missing-drilldown::before {
  border-radius: 6px;
}

.tooltip-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 4px;
  background: var(--fc-chart-tooltip-color);
  opacity: 0.1;
}

:host([preview-mode]) .tooltip-header::before {
  border-radius: 8px;
}

.additional-insight {
  padding: 0 8px;
}

.drill-down {
  padding: 0 8px 4px 5px;
  display: flex;
  flex-direction: row;
  font: var(--fc-poppins-font-12px-400);
  color: var(--fc-color-text-secondary);
  gap: 5px;
  align-items: center;
}

.main-insight {
  font: var(--fc-poppins-font-11px-500);
  font-size: 10px;
  color: var(--fc-color-text-primary);
  content: attr(main-insight);
}

.others-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 5px;
}

.tooltip-position {
  font: var(--fc-poppins-font-11px-400);
  font-size: 10px;
  color: var(--fc-color-text-secondary);
}

.tooltip-note {
  font: var(--fc-poppins-font-11px-400);
  font-size: 10px;
  color: var(--fc-color-text-secondary);
  display: flex;
  align-items: center;
}

.tooltip-note-icon {
  --fc-icon-svg-icon-size: 16px;
  --fc-icon-svg-icon-name: var(--fc-icon-tp-feedback-line);
}

.tooltip.show {
  opacity: 1;
}

.chart-wrapper {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.chart-wrapper[data-series-type="treemap"] {
  border-radius: 16px;
}

canvas {
  width: 100% !important;
  height: 100%;
  transition: opacity 0.2s ease-in-out;
}

:host([loading]) canvas {
  opacity: 0;
}

.legend-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 0;
  padding: 0;
  gap: 0 32px;
  overflow: hidden;
  width: 100%;
}

.skeleton-legend-container {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  gap: 16px;
  height: 44px;
  width: fit-content;
}

.legend-label {
  font: var(--fc-poppins-font-12px-400);
  color: var(--fc-color-text-primary);
  text-transform: capitalize;
  transition: color 0.2s ease-in-out;
  position: relative;
  text-overflow: ellipsis;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.skeleton-legend-label {
  font: var(--fc-poppins-font-11px-400);
  font-size: 10px;
  color: var(--fc-color-text-primary);
  text-transform: uppercase;
  transition: color 0.2s ease-in-out;
  position: relative;
  white-space: nowrap;
  text-overflow: ellipsis;
  width: 70px;
}

.expand-button {
  width: 100%;
  border: none;
  background-color: transparent;
  cursor: pointer;
  transition: 0.1s;
  display: flex;
  justify-content: center;
  margin-bottom: 3px;
}

.expand-button:hover {
  background: var(--fc-color-surface-secondary);
  border-radius: 5px;
}

.expand-button fc-icon {
  color: var(--fc-color-text-secondary);
  transition: 0.5s cubic-bezier(0.075, 0.82, 0.165, 1);
}

#legend-container {
  position: relative;
  width: fit-content;
  width: calc(100% - 20px);
  height: 89px;
  transition: 0.25s cubic-bezier(0.075, 0.82, 0.165, 1);
  overflow: hidden;
  padding: 0 10px;
  outline: 1px solid transparent;
}

#legend-container[open] {
  height: 300px;
  background-color: var(--fc-color-surface-secondary);
  border-radius: 8px;
  padding: 10px;
  outline: 1px solid var(--fc-color-border-primary);
}

#legend-container[open] .expand-button fc-icon {
  transform: rotate3d(1, 0, 0, 180deg);
}

:host #real-legend-container {
  transition: opacity 0.2s ease-in-out;
  opacity: 1;
  overflow: hidden;
}

:host([loading]) #real-legend-container {
  opacity: 0;
}

#legend-container:not([expandable]) .expand-button {
  opacity: 0;
  pointer-events: none;
}

#legend-container[expandable] #real-legend-container {
  height: max-content;
}

#legend-container[open] #real-legend-container {
  overflow: auto;
}

#skeleton-legend-container {
  position: absolute;
  top: 0;
  left: 0;
  transition: opacity 0.2s ease-in-out;
  opacity: 0;
  pointer-events: none;
}

:host([loading]) #skeleton-legend-container {
  opacity: 1;
}

.legend-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  cursor: pointer;
  gap: 10px;
  user-select: none;
  padding: 2px 6px;
  border-radius: 5px;
  transition: 0.1s;
}

.legend-item:hover {
  background-color: var(--fc-color-surface-tertiary);
}

.legend-color-box {
  --legend-color-box-size: 10px;

  min-width: var(--legend-color-box-size);
  height: var(--legend-color-box-size);
  border-radius: 3px;
  transition: background 0.2s ease-in-out;
  box-shadow: inset 0 0 0 var(--legend-color-box-size) var(--legend-color);
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.legend-color-box.dash {
  box-shadow: none !important;
}

.legend-color-box svg {
  width: inherit;
  height: inherit;
}

.legend-color-box:not(.dash) svg {
  display: none;
}

.legend-color-box svg line {
  stroke: var(--legend-color);
}

:host .legend-item > * {
  transition: opacity 0.2s ease-in-out;
}

:host .disabled-legend-item .legend-color-box {
  --legend-color: var(--fc-blue-gray-300) !important;
}

:host .disabled-legend-item .legend-color-box.border {
  --legend-color: var(--fc-blue-gray-300) !important;
}

.legend-label_orig {
  font: var(--fc-poppins-font-11px-400);
  font-size: 10px;
  color: var(--fc-color-text-primary);
  text-transform: uppercase;
  transition: color 0.2s ease-in-out;
  position: relative;
  min-width: 80px;
  margin-right: 20px;
}

:host .disabled-legend-item .legend-label,
:host .disabled-legend-item .skeleton-legend-label {
  color: var(--fc-color-text-assistive) !important;
}

#legend-container[open] .legend-label {
  -webkit-line-clamp: 2;
}

:host #skeleton-legend-container .legend-color-box {
  --legend-color: var(--fc-color-gray-200) !important;

  width: 10px;
  height: 10px;
  border-radius: 10px;
}

:host #skeleton-legend-container .legend-color-box::after {
  content: '';
  position: absolute;
  transition: background 0.2s ease-in-out;
  border-radius: inherit;
  top: 0;
  right: 0;
  height: 100%;
  width: 100%;
  background-color: var(--fc-color-gray-200);
}

:host #skeleton-legend-container .legend-label,
:host #skeleton-legend-container .skeleton-legend-label {
  color: transparent !important;
}

:host #skeleton-legend-container .legend-label::after,
:host #skeleton-legend-container .skeleton-legend-label::after {
  content: '';
  position: absolute;
  transition: background 0.2s ease-in-out;
  border-radius: 20px;
  top: calc(50% - 5px);
  width: 80px;
  left: 0;
  height: 10px;
  background: var(--fc-color-gray-200);
}

:host #skeleton-legend-container .legend-item:nth-child(odd) .legend-label::after,
:host #skeleton-legend-container .legend-item:nth-child(odd) .skeleton-legend-label::after {
  width: 70px;
}

.legend-scroll-container {
  height: calc(100% - 25px);
}

.legend-scroll-container[hasScroll] {
  overflow: hidden auto;
}
