/* Globale UI-Animationen — GPU-freundlich, respektiert prefers-reduced-motion */

:root {
  --hm-ease-out: cubic-bezier(0.33, 1, 0.68, 1);
  --hm-ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --hm-duration-fast: 0.22s;
  --hm-duration-med: 0.32s;
  --hm-duration-slow: 0.38s;
}

@keyframes hm-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes hm-fade-in-soft {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.hm-spinner {
  display: inline-block;
  width: 1.35rem;
  height: 1.35rem;
  border: 2px solid color-mix(in srgb, var(--hm-text-muted) 35%, transparent);
  border-top-color: var(--hm-accent-dark, var(--hm-accent));
  border-radius: 50%;
  animation: hm-spin 0.75s linear infinite;
  flex-shrink: 0;
  will-change: transform;
}

.hm-adv-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 12px;
  color: var(--hm-text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.hm-adv-state--loading {
  min-height: 72px;
}

.hm-adv-filter-groups.hm-adv-fade-in {
  animation: hm-fade-in-soft var(--hm-duration-slow) var(--hm-ease-out) forwards;
}

/* Detailsuche: Filter-Akkordeon (Höhe per JS / Web Animations API) */
.hm-adv-filter-group__title {
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  transition: color var(--hm-duration-fast) ease;
}

.hm-adv-filter-group__title::before {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--hm-accent-dark, var(--hm-accent));
  border-bottom: 2px solid var(--hm-accent-dark, var(--hm-accent));
  transform: rotate(-45deg);
  transition: transform var(--hm-duration-slow) var(--hm-ease-out);
  margin-top: -2px;
  will-change: transform;
}

.hm-adv-filter-group.is-expanded > .hm-adv-filter-group__title::before {
  transform: rotate(45deg);
  margin-top: 2px;
}

.hm-adv-filter-group__title:hover {
  color: var(--hm-accent-dark, var(--hm-accent));
}

.hm-adv-filter-group__body-wrap {
  overflow: hidden;
  height: 0;
}

.hm-adv-filter-group__body-wrap.is-animating {
  overflow: hidden;
}

.hm-adv-filter-group.is-expanded > .hm-adv-filter-group__body-wrap:not(.is-animating) {
  height: auto;
  overflow: visible;
}

.hm-adv-filter-group.is-expanded {
  overflow: visible;
}

.hm-adv-filter-group__body-wrap > .hm-adv-filter-group__body {
  min-height: 0;
}

.hm-adv-filter-group__body {
  opacity: 0;
  transition: opacity var(--hm-duration-med) var(--hm-ease-out);
}

.hm-adv-filter-group.is-expanded > .hm-adv-filter-group__body-wrap > .hm-adv-filter-group__body {
  opacity: 1;
}

/* Farbfamilien-Dropdown (animiertes Ausklappen) */
.hm-adv-filter-group.is-expanded .hm-adv-color-dropdown {
  overflow: visible;
}

.hm-adv-color-dropdown__summary {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  list-style: none;
  cursor: pointer;
}

.hm-adv-color-dropdown__summary-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hm-adv-color-dropdown__chevron {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--hm-accent-dark, var(--hm-accent));
  border-bottom: 2px solid var(--hm-accent-dark, var(--hm-accent));
  transform: rotate(45deg);
  transition: transform var(--hm-duration-slow) var(--hm-ease-out);
  margin-top: -3px;
}

.hm-adv-color-dropdown.is-expanded > .hm-adv-color-dropdown__summary .hm-adv-color-dropdown__chevron {
  transform: rotate(-135deg);
  margin-top: 2px;
}

.hm-adv-color-dropdown__list-wrap {
  overflow: hidden;
  height: 0;
}

.hm-adv-color-dropdown__list-wrap.is-animating {
  overflow: hidden;
}

.hm-adv-color-dropdown.is-expanded > .hm-adv-color-dropdown__list-wrap:not(.is-animating) {
  height: auto;
  overflow: visible;
}

.hm-adv-color-dropdown.is-expanded .hm-adv-color-dropdown__list {
  position: relative;
  z-index: 2;
}

/* Detailsuche: Rahmenbreite per JS, sanfte Transition */
#hm-adv-search-frame {
  transition: width var(--hm-duration-slow) var(--hm-ease-out);
}

.hm-adv-search__table-wrap.hm-adv-cols-changing .hm-adv-table-scroll {
  opacity: 0.72;
  transition: opacity var(--hm-duration-med) var(--hm-ease-out);
}

.hm-adv-table {
  transition: opacity var(--hm-duration-med) var(--hm-ease-out);
}

/* Tabelle: Lade-Overlay (bleibt im DOM, nur Opacity) */
.hm-adv-search__table-wrap {
  position: relative;
}

.hm-adv-search__table-wrap .hm-adv-table-scroll {
  transition: opacity var(--hm-duration-med) var(--hm-ease-out);
}

.hm-adv-search__table-wrap.is-loading .hm-adv-table-scroll,
.hm-adv-search__table-wrap.is-loading .hm-adv-loading-placeholder {
  opacity: 0.5;
  pointer-events: none;
}

.hm-adv-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--hm-surface) 88%, transparent);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--hm-duration-med) var(--hm-ease-out),
    visibility 0s linear var(--hm-duration-med);
}

.hm-adv-loading-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  transition:
    opacity var(--hm-duration-med) var(--hm-ease-out),
    visibility 0s linear 0s;
}

.hm-adv-loading-overlay .hm-spinner {
  width: 1.75rem;
  height: 1.75rem;
  border-width: 3px;
}

.hm-adv-search__table-wrap.hm-adv-results-flash .hm-adv-table-scroll {
  animation: hm-fade-in-soft var(--hm-duration-slow) var(--hm-ease-out) forwards;
}

.hm-adv-search__count {
  transition: opacity var(--hm-duration-fast) var(--hm-ease-out);
}

.hm-adv-search__count.is-pending {
  opacity: 0.6;
}

/* Spalten-Modal — Transitions statt Keyframe-Sprünge */
.hm-adv-modal__backdrop {
  opacity: 0;
  transition: opacity var(--hm-duration-med) var(--hm-ease-out);
}

.hm-adv-modal--visible .hm-adv-modal__backdrop {
  opacity: 1;
}

.hm-adv-modal__panel {
  opacity: 0;
  transform: translate3d(0, 8px, 0) scale(0.99);
  transition:
    opacity var(--hm-duration-med) var(--hm-ease-out),
    transform var(--hm-duration-slow) var(--hm-ease-out);
  will-change: opacity, transform;
}

.hm-adv-modal--visible .hm-adv-modal__panel {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

/* Site-Chrome */
@media (max-width: 920px) {
  .hm-main-nav {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition:
      max-height var(--hm-duration-slow) var(--hm-ease-out),
      opacity var(--hm-duration-med) var(--hm-ease-out);
  }

  .hm-main-nav.hm-main-nav--open {
    max-height: min(70vh, 520px);
    opacity: 1;
    pointer-events: auto;
  }
}

.hm-login-dialog[open] {
  animation: none;
}

.hm-login-dialog[open]::backdrop {
  transition: opacity var(--hm-duration-med) var(--hm-ease-out);
}

.hm-login-dialog__form {
  opacity: 0;
  transform: translate3d(0, 6px, 0);
  transition:
    opacity var(--hm-duration-med) var(--hm-ease-out),
    transform var(--hm-duration-slow) var(--hm-ease-out);
}

.hm-login-dialog[open] .hm-login-dialog__form {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.hm-user-menu__panel {
  opacity: 0;
  transform: translate3d(0, -4px, 0);
  transition:
    opacity var(--hm-duration-fast) var(--hm-ease-out),
    transform var(--hm-duration-med) var(--hm-ease-out);
}

.hm-user-menu__panel:not([hidden]) {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.hm-chrome-toast {
  transition:
    opacity var(--hm-duration-med) var(--hm-ease-out),
    transform var(--hm-duration-med) var(--hm-ease-out);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --hm-duration-fast: 0.01ms;
    --hm-duration-med: 0.01ms;
    --hm-duration-slow: 0.01ms;
  }

  .hm-spinner {
    animation: none;
    opacity: 0.75;
  }

  .hm-adv-filter-group__body,
  .hm-adv-filter-group__title::before,
  .hm-adv-search__table-wrap .hm-adv-table-scroll,
  .hm-adv-loading-overlay,
  .hm-chrome-toast,
  .hm-main-nav,
  .hm-adv-modal__panel,
  .hm-adv-modal__backdrop,
  .hm-adv-search__frame,
  .hm-adv-table,
  .hm-login-dialog__form,
  .hm-user-menu__panel {
    transition: none;
    animation: none;
    transform: none;
    opacity: 1;
  }

  .hm-adv-filter-group__body-wrap {
    height: auto;
    overflow: visible;
  }

  .hm-adv-filter-group:not(.is-expanded) > .hm-adv-filter-group__body-wrap {
    display: none;
  }

  .hm-adv-color-dropdown__chevron {
    transition: none;
  }

  .hm-adv-color-dropdown:not(.is-expanded) > .hm-adv-color-dropdown__list-wrap {
    display: none;
  }

  .hm-adv-color-dropdown.is-expanded > .hm-adv-color-dropdown__list-wrap {
    display: block;
    height: auto;
    overflow: visible;
  }

  .hm-adv-loading-overlay {
    visibility: hidden;
    opacity: 0;
  }

  .hm-adv-loading-overlay.is-visible {
    visibility: visible;
    opacity: 1;
  }
}
