:host {
  --vic-gutter-gap: 8px;
  --vic-card-padding: 12px;
  --vic-icon-size: 36px;
  --vic-icon-border-radius: 18px;
  --vic-icon-shape-color: rgba(var(--rgb-primary-text-color), 0.05);
  --vic-icon-bg-opacity: 0.2;
}

*:focus {
  outline: none;
}

*,
*:before,
*:after {
  box-sizing: border-box;
}

*[hidden] {
  display: none;
}

ha-card {
  position: relative;
  overflow: hidden;
  display: block;
  width: 100%;
  height: 100%;
  /* max-width: 500px !important; */
  padding: var(--vic-card-padding);
  background-color: var(--card-background-color);
}

ha-card.preview-card {
  padding: 0;
  border: none;
  display: flex;
  flex-direction: column;
  gap: var(--vic-card-padding);
  background: none;
}


ha-card.__background::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  max-height: 250px;
  top: 0;
  left: 50%;
  transform: translate(-50%);
  background-image: var(--vic-background-image);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.1;
  z-index: 0;
  mask-image: linear-gradient(transparent 0%, black 40%, black 70%, transparent 100%);
}

ha-card.__map_last {
  padding-bottom: 0;
}

ha-card.__map_last section[type="custom"] {
  padding-bottom: var(--vic-card-padding);
}

ha-card[no-header].__map_first {
  padding-top: 0;
}

ha-card.__map_last #buttons {
  margin-top: var(--vic-card-padding);
}

ha-card[no-header].__map_single {
  padding-block: 0;
}

.fade-in {
  animation: fadeIn 0.5s ease-in;
}

header h1 {
  color: var(--ha-card-header-color, var(--primary-text-color));
  font-family: serif !important;
  font-size: 24px;
  font-size: var(--ha-card-header-font-size, 24px);
  /* letter-spacing: -0.012em; */
  line-height: 2rem;
  display: block;
  margin-top: 0px;
  margin-bottom: 0px;
  font-weight: 400;
  text-align: center;
  padding-bottom: 0.67em;
}

#mini_map {
  position: relative;
  min-width: calc(100% + (var(--vic-card-padding) * 2)) !important;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  place-self: center;
}

.header-info-box {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
  height: fit-content;
  overflow: hidden;
  gap: var(--vic-gutter-gap);
  flex-wrap: wrap;
  transition: all 0.5s ease;
  padding-bottom: var(--vic-card-padding);

}

.combined-info-box {
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-columns: repeat(auto-fill, minmax(calc((100% - 24px) / 2), 1fr));
  gap: var(--vic-card-padding);
}

.info-box {
  --mdc-icon-size: 20px;
  display: flex;
  justify-content: center;
  position: relative;
  width: 100%;
  height: fit-content;
  gap: var(--vic-gutter-gap);
  flex-wrap: wrap;
  letter-spacing: 0.5px;
}

.combined-info-box>.info-box:nth-last-child(1):nth-child(odd) {
  grid-column: span 2;
}

@media screen and (max-width: 768px) {
  .info-box {
    --mdc-icon-size: 17px;
  }
}

.info-box.range {
  justify-content: center;
  text-wrap: nowrap;
  align-items: center;
  flex-wrap: nowrap !important;
}

.info-box.range .item {
  display: flex;
  align-items: center;
  gap: 4px !important;
}

.info-box .item {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;


}

@media screen and (max-width: 768px) {
  ha-card {
    padding: 0.5rem;
  }
}

.added-item-arrow {
  display: flex;
}

.item.active-btn {
  cursor: pointer;
}

.item.active-btn:hover,
.item.active-btn[active] {
  color: var(--primary-color);
}



/* .item.active-btn>ha-icon {
  color: var(--primary-color);
} */

.info-box.charge {
  overflow: hidden;
  justify-content: space-evenly;
  max-height: 0;
  opacity: 0;
  transition: all 400ms cubic-bezier(0.3, 0.0, 0.8, 0.15);
}

.info-box.charge .icon-state {
  display: inline-flex;
  height: auto;
  align-items: center;
  gap: var(--vic-gutter-gap);
  width: 100%;
  justify-content: center;
}

.info-box.charge.active {
  max-height: 100px;
  /* Adjust this to be more than the expected height of the content */
  opacity: 1;
  padding-block: 0.5rem;
}

.info-box.charge .item {
  display: inline-flex;
  align-items: center;
  flex-flow: column;
  gap: initial;
  width: calc((100% /4) - 8px);
  overflow: hidden;
}

.info-box.charge .item-name {
  color: var(--secondary-text-color);
  text-wrap-style: auto;
  text-align: center;
}

.fuel-wrapper {
  display: inline-block;
  width: 50%;
  height: 5px;
  background-color: #909090;
  border-radius: 5px;
  position: relative;
  overflow: hidden;
}

.fuel-level-bar {
  position: absolute;
  background-color: #4caf50;
  border-radius: 5px;
  height: 100%;
  width: var(--vic-range-width);
}

.fuel-level-bar[electric] {
  background-color: #2196f3 !important;
}

.fuel-level-bar[electric][charging]::after {
  content: '';
  position: absolute;
  width: 15%;
  height: 100%;
  top: 0;
  left: 0;
  border-radius: 5px;
  animation: pulse 3.7s ease-in-out forwards infinite;
  display: none;
}

.fuel-level-bar[electric][charging]::after {
  display: block !important;
}

@keyframes pulse {
  0% {
    background: rgba(255, 255, 255, 1);
    box-shadow: inset 0px 0px 10px 2px rgba(117, 182, 255, 0.5),
      0px 0px 40px 2px rgba(105, 135, 255, 1);
    left: 0;
    opacity: 0.3;
  }

  50% {
    left: var(--vic-range-width);
    opacity: 0.5;
  }

  100% {
    background: rgba(255, 255, 255, 0);
    box-shadow: inset 0px 0px 10px 2px rgba(117, 182, 255, 0.5),
      0px 0px 30px 2px rgba(105, 135, 255, 0.3);
    left: 0;
    opacity: 0.7;
  }
}

.added-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--secondary-text-color);
}

.added-card-header ha-icon-button {
  transition: all 0.4s ease-in-out;

  &:hover {
    color: var(--primary-text-color);
  }
}

.added-card-header .card-toggle {
  display: flex;
  gap: 1rem;
}

.added-card {
  position: relative;
  width: 100%;
  height: auto;
  margin-top: 1rem;
  padding: 0;
  overflow: hidden;
}

.added-card:first-child {
  margin-top: 0;
}

.last-update {
  display: inline-flex;
  width: 100%;
  justify-content: center;
  color: var(--secondary-text-color);
  margin-top: 0.5rem;
  opacity: 0.5;
  font-size: 0.8rem;
}

#cards-wrapper {
  animation: fadeIn 0.5s ease-in-out;
  position: relative;
}

#main-wrapper {
  animation: fadeIn 0.3s ease;
  position: relative;
}

.card-element {
  transition: all 0.5s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--vic-card-padding);
}

/* .card-element.swiping-left {
  transform: translateX(-120%);
} */

/* .card-element.swiping-right {
  transform: translateX(120%);
}  */

.slide-left-enter {
  transform: translateX(100%);
}

.slide-left-enter-active {
  transform: translateX(0);
}

.slide-left-exit {
  transform: translateX(0);
}

.slide-left-exit-active {
  transform: translateX(-100%);
}

.slide-right-enter {
  transform: translateX(-100%);
}

.slide-right-enter-active {
  transform: translateX(0);
}

.slide-right-exit {
  transform: translateX(0);
}

.slide-right-exit-active {
  transform: translateX(100%);
}



.default-card {
  align-items: center;
  padding: var(--vic-card-padding);
  background: var(--ha-card-background-color, var(--secondary-background-color));
  box-shadow: var(--ha-card-box-shadow, none);
  box-sizing: border-box;
  border-radius: var(--ha-card-border-radius, 12px);
  border-width: var(--ha-card-border-width, 1px);
  border-style: solid;
  border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0));
  transition: all 0.3s ease-out;
  /* margin-bottom: 1rem; */
  position: relative;
  overflow: hidden;
}

.default-card:not(:first-child) {
  animation: slideUpDown 0.3s linear;
}

@keyframes slideUpDown {
  0% {
    transform: translateY(-100%);
  }

  100% {
    transform: translateY(0);
  }
}

.default-card:last-child {
  margin-bottom: 0;
}

.data-header {
  color: var(--ha-card-header-color, --primary-text-color);
  font-family: var(--ha-card-header-font-family, inherit);
  font-size: 1.5rem;
  line-height: inherit;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: auto;
  /* padding: 8px 0; */
}

.data-header>div[clickable] {
  cursor: pointer;

  &:hover {
    color: var(--primary-color);
  }
}

.default-card .data-box {
  opacity: 1;
  padding-top: var(--vic-gutter-gap);
  max-height: 1000px;
  transition: all 400ms cubic-bezier(0.3, 0.0, 0.8, 0.15);
}

.default-card .data-box[active='false'] {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  padding: 0;
}

.default-card.remote-tab {
  border: none !important;
  background: none !important;
  padding: 0px;
}

/* .default-card.remote-tab>.data-header {
  padding: var(--vic-gutter-gap);
} */

.data-row {
  display: flex;
  justify-content: space-between;
  padding: var(--vic-gutter-gap);
  border-bottom: 1px solid #444;
  overflow: hidden;
}

.data-row .data-value-unit {
  cursor: pointer;
  text-align: end;
  text-wrap: nowrap;
}

.data-row .data-label {
  height: auto;
  display: inline-block;
  align-items: flex-end;
  margin-inline-start: 8px;
  text-transform: none;
}

.data-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.data-row div {
  display: flex;
  align-items: center;
  gap: var(--vic-gutter-gap);
}

.data-icon {
  color: var(--secondary-text-color);
}


*[warning] {
  color: var(--warning-color, --error-color) !important;
}

.subcard-icon {
  transition: transform 0.3s;
  transform: rotate(0deg);
  display: inline-block;
  cursor: pointer;
}

.subcard-icon[active] {
  transform: rotate(180deg);
}

.subcard-icon.hidden {
  visibility: hidden;
}

.subcard-icon[hide] {
  display: none !important;
}

.sub-attributes {
  overflow: hidden;
  padding-top: 0px !important;
  max-height: 0;
  opacity: 0;
  transition: all 400ms cubic-bezier(0.3, 0.0, 0.8, 0.15);
}

.sub-attributes[active] {
  max-height: 1000px;
  opacity: 1;
  padding: var(--vic-card-padding);
}

*[error] {
  color: var(--error-color);
}

dialog {
  width: 100%;
  overflow: hidden;
  max-width: 500px;
  background: none;
  border: none;
  border-radius: 12px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

@keyframes slideUpDown {
  0% {
    transform: translateY(-100%);
  }

  100% {
    transform: translateY(0);
  }
}

@keyframes tap-feedback {
  0% {
    transform: translateX(-50%);
  }

  100% {
    transform: translateX(100%);
  }
}

.click-shrink {
  transition: transform 0.1s;
}

.click-shrink:active {
  transform: scale(0.9);
}


.tyre-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  transition: all 0.5s ease-in-out;
}

.tyre-toggle-btn {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  padding: var(--vic-card-padding);
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.3s;
}

.tyre-toggle-btn:hover {
  opacity: 1;
}

/* TYRE WRAP ROTATED */
.tyre-wrapper[rotated] {
  transform: rotate(90deg);
}

.tyre-box[rotated] {
  transform: rotate(-90deg);
}

.tyre-wrapper .background {
  position: absolute;
  width: var(--vic-tire-size, 100%);
  height: var(--vic-tire-size, 100%);
  z-index: 0;
  top: var(--vic-tire-top, 50%);
  left: var(--vic-tire-left, 50%);
  transform: translate(-50%, -50%);
  background-size: contain;
  background-repeat: no-repeat;
  overflow: hidden;
  filter: drop-shadow(2px 4px 1rem #000000d8);
}

.tyre-wrapper .tyre-box {
  position: absolute;
  width: 35%;
  height: 50%;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 400ms cubic-bezier(0.3, 0.0, 0.8, 0.15);
  scale: var(--vic-tire-value-size);
}

.tyre-value {
  font-size: 1.5rem;
  color: var(--primary-text-color);
  text-align: center;
  margin: 0;
}

.tyre-name {
  color: var(--secondary-text-color);
  text-align: left;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-wrap: nowrap;
}

.tyre-info {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--secondary-text-color);
  text-align: center;
}

*[tyre=frontleft] {
  top: 0%;
  left: 0%;
  /* transform: translate(-15%, -10%); */
}

*[tyre=frontright] {
  top: 0%;
  right: 0%;
  /* transform: translate(15%, -10%); */
}

*[tyre=rearleft] {
  bottom: 0%;
  left: 0%;
  /* transform: translate(-15%, 10%); */
}

*[tyre=rearright] {
  bottom: 0%;
  right: 0%;
  /* transform: translate(15%, 10%); */
}

.loading-image {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.loading-image img {
  width: 50%;
  height: 50%;
  object-fit: contain;
  animation: zoomRotate 2s linear infinite;
}

@keyframes zoomRotate {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }

  50% {
    transform: scale(1) rotate(180deg);
    opacity: 0.7;
  }

  100% {
    transform: scale(0) rotate(360deg);
    opacity: 0;
  }
}

.redGlows {
  animation: redGlow 1s infinite;
  animation-iteration-count: 5;
}

@keyframes redGlow {
  0% {
    box-shadow: 0 0 10px 0 rgba(255, 0, 0, 0.5);
  }

  50% {
    box-shadow: 0 0 20px 0 rgba(255, 0, 0, 0.5);
  }

  100% {
    box-shadow: 0 0 10px 0 rgba(255, 0, 0, 0.5);
  }
}

.zoom-in {
  animation-duration: 0.5s;
  animation-fill-mode: both;
  animation-name: zoomIn;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale3d(0.3, 0.3, 0.3);
  }

  50% {
    opacity: 1;
  }
}