/* ============================================================
   Direktkontakt — kompakter Kontakt-FAB mit aufklappbaren Aktionen.
   ============================================================ */
#contact-fab {
  position: fixed;
  right: calc((100vw - 1000px) / 2 + 20px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: flex-end;
  font-family: var(--font-sans, "Manrope", "Segoe UI", Arial, sans-serif);
}

#contact-fab .cf-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  width: 58px;
  max-height: 0;
  margin-bottom: 0;
  overflow: hidden;
  pointer-events: none;
  transition: max-height 0.28s cubic-bezier(0.22, 1, 0.36, 1), margin-bottom 0.2s ease;
}

#contact-fab .cf-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  text-decoration: none;
  color: #fff;
  box-shadow: none;
  overflow: hidden;
  max-width: 56px;
  transition: max-width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.2s ease, opacity 0.24s ease, transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  transform: translateX(12px) scale(0.92);
  pointer-events: none;
}

#contact-fab.cf-open .cf-actions {
  max-height: 240px;
  margin-bottom: 12px;
  pointer-events: auto;
}

#contact-fab.cf-open .cf-btn {
  max-width: 56px;
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

#contact-fab .cf-icon,
#contact-fab .cf-toggle-icon {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#contact-fab .cf-icon svg,
#contact-fab .cf-toggle-icon svg {
  width: 23px;
  height: 23px;
  display: block;
}

#contact-fab .cf-label {
  display: none;
}

#contact-fab .cf-tel {
  background: linear-gradient(135deg, #d12027 0%, #a8161c 100%);
}
#contact-fab .cf-mail {
  background: linear-gradient(135deg, #3d3d3f 0%, #2a2a2c 100%);
}
#contact-fab .cf-whatsapp {
  background: linear-gradient(135deg, #25d366 0%, #128c4c 100%);
}

#contact-fab .cf-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  max-width: 58px;
  border: 0;
  border-radius: 29px;
  padding: 0;
  color: #fff;
  background: linear-gradient(135deg, #2f3033 0%, #171719 100%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  overflow: hidden;
  font-family: inherit;
  transition: max-width 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

#contact-fab .cf-toggle-icon {
  flex-basis: 58px;
  width: 58px;
  height: 58px;
  color: #fff;
}

#contact-fab .cf-toggle-close {
  display: none;
}

#contact-fab.cf-open .cf-toggle-contact {
  display: none;
}

#contact-fab.cf-open .cf-toggle-close {
  display: flex;
}

#contact-fab .cf-toggle-label {
  display: none;
}

#contact-fab.cf-open .cf-toggle {
  max-width: 58px;
  background: linear-gradient(135deg, #963a3a 0%, #7a2828 100%);
}

/* Desktop: fest in der Sidebar statt als freischwebendes Overlay. */
@media (min-width: 1021px) {
  #contact-fab.cf-in-sidebar {
    position: static;
    right: auto;
    top: auto;
    transform: none;
    z-index: 2;
    align-items: stretch;
    gap: 10px;
    width: auto;
    margin: 48px 0 0;
    padding: 18px 18px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #contact-fab.cf-in-sidebar::before {
    content: "Direktkontakt";
    display: block;
    color: rgba(255, 255, 255, 0.58);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1;
    text-transform: uppercase;
  }

  #contact-fab.cf-in-sidebar .cf-actions {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    width: 100%;
    max-height: none;
    margin-bottom: 0;
    overflow: visible;
    pointer-events: auto;
  }

  #contact-fab.cf-in-sidebar .cf-btn {
    flex: 1 1 0;
    width: auto;
    max-width: none;
    height: 42px;
    border-radius: 7px;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    box-shadow: none;
  }

  #contact-fab.cf-in-sidebar .cf-tel {
    background: rgba(209, 32, 39, 0.9);
  }
  #contact-fab.cf-in-sidebar .cf-mail {
    background: rgba(255, 255, 255, 0.1);
  }
  #contact-fab.cf-in-sidebar .cf-whatsapp {
    background: rgba(37, 211, 102, 0.82);
  }

  #contact-fab.cf-in-sidebar .cf-icon {
    flex: 1 1 auto;
    width: 100%;
    height: 42px;
  }

  #contact-fab.cf-in-sidebar .cf-icon svg {
    width: 19px;
    height: 19px;
  }

  #contact-fab.cf-in-sidebar .cf-toggle {
    display: none;
  }
}

/* Desktop: Klick oeffnet, Hover bleibt nur ein dezenter Zustandswechsel. */
@media (hover: hover) and (min-width: 1021px) {
  #contact-fab.cf-in-sidebar .cf-btn:hover,
  #contact-fab.cf-in-sidebar .cf-btn:focus-visible {
    box-shadow: none;
    transform: translateY(-2px);
  }

  #contact-fab .cf-btn:hover,
  #contact-fab .cf-btn:focus-visible {
    box-shadow: none;
    transform: translateX(-2px) scale(1.03);
  }
  #contact-fab .cf-toggle:hover,
  #contact-fab .cf-toggle:focus-visible,
  #contact-fab.cf-open .cf-toggle {
    transform: translateY(-1px);
  }
}

/* Sanftes Einschweben beim Laden */
#contact-fab .cf-toggle {
  animation: cf-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes cf-in {
  from { opacity: 0; transform: translateY(14px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  #contact-fab .cf-toggle { animation: none; }
}

/* Mobile: kompakte Kreise, Label ausgeblendet */
@media (max-width: 1020px) {
  #contact-fab {
    position: fixed;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
  }
  #contact-fab .cf-actions {
    gap: 10px;
    width: 54px;
  }
  #contact-fab.cf-open .cf-actions {
    margin-bottom: 10px;
  }
  #contact-fab .cf-btn {
    max-width: 54px;
    height: 54px;
  }
  #contact-fab.cf-open .cf-btn {
    max-width: 54px;
  }
  #contact-fab .cf-icon,
  #contact-fab .cf-toggle-icon {
    flex-basis: 54px;
    width: 54px;
    height: 54px;
  }
  #contact-fab .cf-toggle {
    width: 54px;
    height: 54px;
    max-width: 54px;
    border-radius: 27px;
  }
  #contact-fab.cf-open .cf-toggle {
    max-width: 54px;
  }
  #contact-fab .cf-label {
    display: none;
  }
  #contact-fab .cf-toggle-label {
    display: none;
  }
  body.nav-open #contact-fab {
    display: none;
  }
}

@media (max-width: 600px) {
  #contact-fab {
    right: 12px;
  }
}

@media print {
  #contact-fab { display: none !important; }
}
