:host {
  --control-icon-size: 32px;
  --control-btn-radius: var(--feature-border-radius, 12px);
  --feature-height: 42px;
  --mdc-menu-max-height: 200px !important;
  --ha-select-min-width: 150px;
}

.service-control {
  display: flex;
  flex-direction: column;

  padding-block: var(--vic-gutter-gap);
}

#toast {
  visibility: hidden;
  opacity: 0;
  max-height: 0;
}

#toast.show {
  visibility: visible;
  opacity: 1;
  max-height: 100px;
  animation: fade-in 0.3s ease-in-out forwards;
}

.head-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.5rem;
  position: relative;
}

.head-sub-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  position: relative;
  gap: 0.5rem;
}

.head-sub-row>.control-btn-sm:nth-last-child(1):nth-child(odd) {
  grid-column: span 2;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fade-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.hidden {
  display: none !important;
}

.fade-in {
  animation: fade-in 0.3s ease-in-out forwards;
}

.fade-out {
  animation: fade-out 0.3s ease-in-out forwards;
}

.sub-card-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
  height: auto;
  /* padding: var(--vic-card-padding); */
}

.control-btn-sm,
.control-btn-rounded {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  background-color: var(--ha-card-background, var(--card-background-color, #fff));
  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 !important;
  cursor: pointer;
  text-wrap: balance;
  text-align: center;
  gap: 0.5rem;

  &:hover {
    box-shadow: inset 0 0 50px var(--primary-color) !important;
  }
}

.control-btn-rounded {
  flex-direction: column;
}

.control-btn-rounded[active] {
  color: var(--primary-color);
  background-color: rgba(var(--rgb-primary-color), 0.1);
}

.control-btn-rounded ha-icon {
  --mdc-icon-size: var(--control-icon-size);
}

.control-btn-sm {
  padding: 0.5rem !important;
  text-transform: uppercase;
}

.control-btn-sm.reset {
  background-color: var(--disabled-text-color) !important;
  height: min-content;
  padding: 0;
  opacity: 0.5;
}

.sub-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.items-row {
  display: inline-flex;
  width: 100%;
  height: -moz-min-content;
  height: min-content;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--divider-color);
  padding-bottom: 0.5rem;
}

.item-label {
  display: flex;
  flex: 1 0 50%;
}

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

.items-control {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.items-control input[type='number'] {
  width: -moz-fit-content;
  width: max-content;
  background-color: var(--card-background-color);
  color: var(--primary-text-color);
  padding: 0.5rem 1rem;
  border: none;
  text-align: center;
  font-size: 1rem;
}

.control-btn {
  width: 1.2rem;
  height: 1.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}