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

.card-config {
  width: 100%;
  margin-block: 0.5rem;
}

.panel-container {
  margin-top: 1rem;
}

.switches,
.card-button-cfg {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(49%, 1fr));
  gap: var(--vic-gutter-gap);
  margin-block: var(--vic-gutter-gap);
}

.card-button-cfg.ha-button {
  grid-template-columns: repeat(auto-fit, minmax(calc((100% - 8px) / 4), 1fr))
}

.card-button-cfg:not(.ha-button)>*:nth-last-child(1):nth-child(odd) {
  grid-column: span 2;
}

.switches>*:nth-last-child(1):nth-child(odd) {
  grid-column: span 2;
}

.item-content {
  /* display: flex; */
  /* flex-direction: column; */
  /* min-width: 0; */
  /* overflow: hidden; */
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.action-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-block: 0.5rem;
}

.select-action {
  display: flex;
  flex-direction: column;
  gap: var(--vic-card-padding);
}

/* .switches {
  margin: 0.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
} */

ha-select,
ha-textfield {
  margin-bottom: 8px;
  display: block;
  width: 100%;
}

ha-switch {
  --mdc-theme-secondary: var(--switch-checked-color);
}

ha-expansion-panel .container {
  padding: 0px 1rem !important;
}

h3 {
  color: var(--secondary-text-color);
  margin-block: 0;
}

.right-icon {
  padding-right: 8px;
}

.note {
  color: var(--secondary-text-color);
  text-align: start;
}

.cards-buttons {
  display: flex;
  justify-content: space-between;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  align-content: stretch;
  gap: 8px 0px;
}

#section-order {
  border: 1px solid var(--divider-color);
  padding: var(--vic-gutter-gap);
  box-sizing: border-box;
  border-radius: var(--vic-gutter-gap);
  margin-bottom: var(--vic-card-padding);
}

.card-types {
  display: flex;
  flex-direction: column;
  width: 100%;
  position: relative;
  border-bottom: 1px solid var(--divider-color);
  padding-bottom: 0.5rem;
  box-sizing: border-box;
  margin-block: var(--vic-card-padding);
}

.header-sm {
  /* color: var(--secondary-text-color); */
  width: 100%;
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
  box-sizing: border-box;
  text-transform: uppercase;
  height: 100%;
  /* font-size: medium; */
  /* margin-top: 1rem; */
  font-weight: 400;
}

.header-sm[interactive] {
  cursor: pointer;
}

.header-sm[interactive]:hover {
  color: var(--primary-color);
}

.header-sm.divider {
  color: var(--secondary-text-color);
  padding: var(--vic-card-padding);
}


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

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

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

.sub-card-rows {
  opacity: 1;
  padding-top: var(--vic-gutter-gap);
  max-height: 1000px;
  transition: all 400ms ease-in-out;
}

.sub-card-rows[hidden] {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  padding: 0;
  transition: all 400ms ease-in-out;
}

.card-type-item {
  position: relative;
  width: 100%;
  display: flex;
  height: 100%;
  justify-content: space-between;
  border-bottom: 1px solid var(--divider-color);
  padding-block: 8px;
  align-items: center;
}

.card-type-item[disabled] {
  opacity: 0.5;
}

.card-types:last-child,
.card-type-item:last-child {
  border-bottom: none;
}

.confirm-delete {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background-color: var(--disabled-color);
  color: var(--primary-text-color);
  z-index: 2;
}

.card-type-row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.card-type-row[disabled] {
  opacity: 0.5;
}

.card-type-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  cursor: pointer;
  color: var(--secondary-text-color);
}

.card-type-icon .icon-background {
  position: relative;
  width: var(--vic-icon-size);
  height: var(--vic-icon-size);
  font-size: var(--vic-icon-size);
  border-radius: var(--vic-icon-border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--vic-icon-shape-color);
  transition-property: background-color, box-shadow;
  transition-duration: 280ms;
  transition-timing-function: ease-out;
}

.card-type-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  width: 100%;
  margin-inline: 8px;
  flex: 1;

  .primary {
    font-weight: 500;
    font-size: 1rem;
    white-space: nowrap;
    position: relative;
    text-overflow: ellipsis;
    overflow: hidden;
    text-transform: uppercase;
  }

  .secondary {
    color: var(--secondary-text-color);
    /* text-transform: capitalize; */
    letter-spacing: 0.5px;
    font-size: smaller;
    text-wrap: nowrap;
  }
}

.card-type-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  opacity: 1 !important;
}

.card-type-actions .action-icon {
  cursor: pointer;
  color: var(--secondary-text-color);
  /* background-color: var(--vic-icon-shape-color); */
  border-radius: 50%;
  padding: 4px;
  display: inline-block;
  --mdc-icon-size: 22px;
  border: none;

  &:hover {
    color: var(--primary-color);
    box-shadow: 0 0 8px 0 rgba(3, 11, 115, 0.3);
  }
}

.custom-btn {
  position: relative;
  display: inline-flex;
  width: 50%;
  height: 100%;
}

.custom-btn .habtn {
  width: 100%;
  position: relative;
}

.custom-btn .remove-card-icon {
  position: absolute;
  top: 0;
  right: 0;
  color: var(--secondary-text-color);
  cursor: pointer;
}

.image-config {
  display: flex;
  flex-direction: column;
}

.images-list {
  animation: fade-in 0.3s cubic-bezier(0.6, 0.04, 0.98, 0.335) forwards;
}

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

  to {
    opacity: 1;
  }
}

.custom-background-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-wrap: nowrap;
  width: 100%;
  justify-content: space-between;
}

.custom-background-wrapper.dragging {
  background-color: var(--primary-color);
}

#card-list .handle,
.custom-background-wrapper .handle {
  cursor: grab;
  color: var(--secondary-text-color);
}

#card-list .handle:active,
.custom-background-wrapper .handle:active {
  cursor: grabbing;
  color: var(--primary-color);
}

.ghost {
  opacity: 0.5;
  background: var(--primary-color);
  border-radius: var(--ha-card-border-radius, 12px);
}

.new-url-btn,
.file-input {
  display: none;
}

.new-url-btn.show,
.file-upload {
  cursor: pointer;
  display: inline-block;
  color: var(--secondary-text-color);
}

.new-url-btn:hover,
.file-upload:hover {
  color: var(--primary-color);
}

.image-input {
  text-transform: uppercase !important;
  letter-spacing: inherit;
  width: inherit;
}

.sub-card-header {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--divider-color);
}

.card-tab {
  display: inline-flex;
  width: fit-content;
  height: 100%;
  align-items: center;
  color: var(--secondary-text-color);
  cursor: pointer;

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

.card-tab.active {
  display: inline-flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--primary-color) !important;
  text-transform: uppercase;
}

.tab-content {
  display: block;
  border: 1px solid var(--divider-color);
  padding: 4px;
}

.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;
}

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

#toast-update.hidden {
  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;
}

#toast-update {
  visibility: visible;
  opacity: 1;
  max-height: 100px;
}

.version {
  /* margin-top: 2rem; */
  color: var(--secondary-text-color);
  align-items: stretch;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-block: 1rem;
}

.version .update {
  color: var(--accent-color);
  opacity: 0.7;
}

ha-alert {
  width: 100%;
}

ha-alert>.alert-icon {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding-inline: 0.5rem;
}

.sub-card-config {
  margin-top: 16px;
}

.flex-col {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}