/* WC PLZ-Filter v2.7.2 */

/* ─── Theme-Reset für alle Plugin-Buttons ──────
   Production-Themes (insb. WooCommerce-Single-Product-Stylesheets) setzen
   globale border/background/box-shadow auf <button>. Mit html body + ID
   maximieren wir die Spezifität (0,1,4 / 0,2,4) gegen WC-Selektoren wie
   .woocommerce-page .single-product button (0,3,0). */

html body #wc-plz-overlay button,
html body button#wc-plz-badge {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
  text-decoration: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  font-family: inherit;
  margin: 0 !important;
  filter: none !important;
}

html body #wc-plz-overlay button:focus,
html body #wc-plz-overlay button:focus-visible,
html body #wc-plz-overlay button:hover,
html body #wc-plz-overlay button:active,
html body button#wc-plz-badge:focus,
html body button#wc-plz-badge:focus-visible,
html body button#wc-plz-badge:hover,
html body button#wc-plz-badge:active {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
  filter: none !important;
}

/* Overlay */
.wc-plz-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

/* Modal */
.wc-plz-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  max-width: 440px;
  width: 100%;
  overflow: hidden;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  animation: wc-plz-up 0.25s ease-out;
}

@keyframes wc-plz-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.wc-plz-modal__header {
  background: var(--wc-plz-color, #c00);
  padding: 24px 28px 20px;
}

.wc-plz-modal__title {
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

/* Body */
.wc-plz-modal__body {
  padding: 24px 28px;
}

.wc-plz-modal__text {
  color: #444;
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 20px;
}

/* PLZ-Eingabe */
.wc-plz-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
}

.wc-plz-input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

html body #wc-plz-overlay input.wc-plz-input,
html body #wc-plz-overlay input.wc-plz-input:hover {
  flex: 1 !important;
  padding: 12px 16px !important;
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.12em !important;
  border: 2px solid #ddd !important;
  border-radius: 10px !important;
  outline: 0 !important;
  transition: border-color 0.2s !important;
  min-width: 0 !important;
  width: auto !important;
  box-sizing: border-box !important;
  background: #fff !important;
  background-color: #fff !important;
  background-image: none !important;
  color: #333 !important;
  box-shadow: none !important;
  height: auto !important;
  line-height: 1.2 !important;
  filter: none !important;
}

html body #wc-plz-overlay input.wc-plz-input:focus,
html body #wc-plz-overlay input.wc-plz-input:focus-visible {
  border-color: var(--wc-plz-color, #c00) !important;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08) !important;
  outline: 0 !important;
}

/* Feedback */
.wc-plz-feedback {
  margin-top: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  min-height: 20px;
  line-height: 1.4;
}

.wc-plz-fb--ok {
  color: #2a7d2a;
}
.wc-plz-fb--warn {
  color: #b06000;
}
.wc-plz-fb--error {
  color: var(--wc-plz-color, #c00);
}

/* Divider */
.wc-plz-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: #aaa;
  font-size: 0.85rem;
}

.wc-plz-divider::before,
.wc-plz-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e0e0e0;
}

/* Buttons */
html body #wc-plz-overlay button.wc-plz-btn {
  cursor: pointer !important;
  border: 0 !important;
  border-radius: 10px !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  transition:
    background 0.2s,
    transform 0.1s,
    opacity 0.2s !important;
  white-space: nowrap !important;
  box-shadow: none !important;
  text-shadow: none !important;
  height: auto !important;
  min-height: 0 !important;
  filter: none !important;
}

html body #wc-plz-overlay button.wc-plz-btn:active {
  transform: scale(0.97);
}

html body #wc-plz-overlay button.wc-plz-btn--primary,
html body #wc-plz-overlay button.wc-plz-btn--primary:hover,
html body #wc-plz-overlay button.wc-plz-btn--primary:focus,
html body #wc-plz-overlay button.wc-plz-btn--primary:focus-visible,
html body #wc-plz-overlay button.wc-plz-btn--primary:active {
  background: var(--wc-plz-color, #c00) !important;
  background-color: var(--wc-plz-color, #c00) !important;
  background-image: none !important;
  color: #fff !important;
  padding: 12px 20px !important;
  border: 0 !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  text-shadow: none !important;
  width: auto !important;
}

html body #wc-plz-overlay button.wc-plz-btn--primary:hover {
  opacity: 0.85;
}

html body #wc-plz-overlay button.wc-plz-btn--primary:disabled {
  background: #ccc !important;
  background-color: #ccc !important;
  cursor: wait !important;
  opacity: 1 !important;
}

html body #wc-plz-overlay button.wc-plz-btn--pickup,
html body #wc-plz-overlay button.wc-plz-btn--pickup:focus,
html body #wc-plz-overlay button.wc-plz-btn--pickup:focus-visible,
html body #wc-plz-overlay button.wc-plz-btn--pickup:active {
  display: block !important;
  width: 100% !important;
  padding: 14px !important;
  background: #f5f5f5 !important;
  background-color: #f5f5f5 !important;
  background-image: none !important;
  color: #333 !important;
  font-size: 1rem !important;
  border: 2px solid #e0e0e0 !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  text-shadow: none !important;
  filter: none !important;
}

html body #wc-plz-overlay button.wc-plz-btn--pickup:hover {
  background: #eee !important;
  background-color: #eee !important;
  border-color: #ccc !important;
  box-shadow: none !important;
}

html body #wc-plz-overlay button.wc-plz-btn--ghost,
html body #wc-plz-overlay button.wc-plz-btn--ghost:focus,
html body #wc-plz-overlay button.wc-plz-btn--ghost:focus-visible,
html body #wc-plz-overlay button.wc-plz-btn--ghost:active {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  color: #888 !important;
  padding: 6px 0 !important;
  font-size: 0.82rem !important;
  font-weight: 400 !important;
  text-decoration: underline !important;
  text-underline-offset: 3px;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  width: auto !important;
  filter: none !important;
}

html body #wc-plz-overlay button.wc-plz-btn--ghost:hover {
  background: transparent !important;
  background-color: transparent !important;
  color: #444 !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* Footer */
.wc-plz-modal__footer {
  padding: 0 28px 20px;
  text-align: center;
}

/* ─── Badge v2.4: always-expanded pill ───────── */

@keyframes wc-plz-badge-in {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.92);
  }
  60% {
    opacity: 1;
    transform: translateY(-2px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Side-position entrance (left/right) */
@keyframes wc-plz-badge-in-left {
  0% {
    opacity: 0;
    transform: translateX(-12px) rotate(-90deg) scale(0.92);
  }
  60% {
    opacity: 1;
    transform: translateX(2px) rotate(-90deg) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotate(-90deg) scale(1);
  }
}

@keyframes wc-plz-badge-in-right {
  0% {
    opacity: 0;
    transform: translateX(12px) rotate(90deg) scale(0.92);
  }
  60% {
    opacity: 1;
    transform: translateX(-2px) rotate(90deg) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotate(90deg) scale(1);
  }
}

html body button#wc-plz-badge,
html body button#wc-plz-badge:hover,
html body button#wc-plz-badge:focus,
html body button#wc-plz-badge:focus-visible {
  position: fixed !important;
  z-index: 99999 !important;
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer !important;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0 !important;
  line-height: 1;
  white-space: nowrap;
  padding: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  border: 0 !important;
  border-width: 0 !important;
  border-style: none !important;
  border-color: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
  outline-width: 0 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  width: auto !important;
  height: auto !important;
  text-shadow: none !important;
  filter: none !important;
}

html body button#wc-plz-badge {
  animation: wc-plz-badge-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

html body button#wc-plz-badge:active {
  transform: scale(0.97) !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* Inner pill – the visible element */
.wc-plz-badge__pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border-radius: 999px;
  padding: 9px 14px;
  border-left: 3px solid var(--wc-plz-color, #c00);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.10),
    0 0 0 1px rgba(0, 0, 0, 0.06);
  transition:
    box-shadow 0.25s ease,
    transform 0.2s ease,
    background 0.2s ease;
}

.wc-plz-badge:hover .wc-plz-badge__pill {
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.08);
  transform: scale(1.03);
}

/* Color dot */
.wc-plz-badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--wc-plz-color, #c00);
}

/* Icon (emoji) */
.wc-plz-badge__icon {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
}

/* Info text: always visible */
.wc-plz-badge__info {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--wc-plz-color, #c00);
  letter-spacing: -0.01em;
}

/* Separator dot between PLZ and method */
.wc-plz-badge__sep {
  color: #ccc;
  font-size: 0.7rem;
  font-weight: 400;
  margin: 0 1px;
  user-select: none;
}

/* "ändern" label – appears on hover only */
.wc-plz-badge__edit {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  color: #999;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition:
    opacity 0.2s ease 0.05s,
    max-width 0.25s ease,
    margin 0.25s ease;
  margin-left: 0;
}

.wc-plz-badge:hover .wc-plz-badge__edit {
  opacity: 1;
  max-width: 60px;
  margin-left: 4px;
}

/* ─── Badge tooltip (speech bubble) ──────────── */

.wc-plz-badge__tooltip {
  position: absolute;
  z-index: 1;
  background: #333;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.45;
  padding: 10px 14px;
  border-radius: 10px;
  white-space: normal;
  width: 260px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.2s ease 0.15s,
    transform 0.2s ease 0.15s;
}

/* Arrow (pseudo-element) */
.wc-plz-badge__tooltip::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border: 6px solid transparent;
}

.wc-plz-badge:hover .wc-plz-badge__tooltip {
  opacity: 1;
}

/* ─── Tooltip positions (set via data-tooltip-pos in JS) ── */

/* Tooltip above badge (default for bottom positions) */
.wc-plz-badge__tooltip--top {
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
}
.wc-plz-badge:hover .wc-plz-badge__tooltip--top {
  transform: translateX(-50%) translateY(0);
}
.wc-plz-badge__tooltip--top::after {
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: #333;
}

/* Tooltip below badge (for top positions) */
.wc-plz-badge__tooltip--bottom {
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
}
.wc-plz-badge:hover .wc-plz-badge__tooltip--bottom {
  transform: translateX(-50%) translateY(0);
}
.wc-plz-badge__tooltip--bottom::after {
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: #333;
}

/* Tooltip to the right (for left-center position) */
.wc-plz-badge__tooltip--right {
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
}
.wc-plz-badge:hover .wc-plz-badge__tooltip--right {
  transform: translateY(-50%) translateX(0);
}
.wc-plz-badge__tooltip--right::after {
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-right-color: #333;
}

/* Tooltip to the left (for right-center position) */
.wc-plz-badge__tooltip--left {
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(4px);
}
.wc-plz-badge:hover .wc-plz-badge__tooltip--left {
  transform: translateY(-50%) translateX(0);
}
.wc-plz-badge__tooltip--left::after {
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-left-color: #333;
}

/* ─── Badge: skipped state (neutral/grey) ────── */

.wc-plz-badge--skipped .wc-plz-badge__pill {
  border-left-color: #999;
}
.wc-plz-badge--skipped .wc-plz-badge__dot {
  background: #999;
}
.wc-plz-badge--skipped .wc-plz-badge__info {
  color: #555;
}

/* ─── Badge positions ────────────────────────── */

/* Offset custom properties (set via inline style from admin) */
.wc-plz-badge {
  --wc-plz-offset-x: 0px;
  --wc-plz-offset-y: 0px;
}

/* Corner positions */
.wc-plz-badge--bottom-right {
  bottom: calc(24px - var(--wc-plz-offset-y));
  right: calc(24px - var(--wc-plz-offset-x));
}
.wc-plz-badge--bottom-left {
  bottom: calc(24px - var(--wc-plz-offset-y));
  left: calc(24px + var(--wc-plz-offset-x));
}
.wc-plz-badge--top-right {
  top: calc(24px + var(--wc-plz-offset-y));
  right: calc(24px - var(--wc-plz-offset-x));
}
.wc-plz-badge--top-left {
  top: calc(24px + var(--wc-plz-offset-y));
  left: calc(24px + var(--wc-plz-offset-x));
}

/* bottom-center */
.wc-plz-badge--bottom-center {
  bottom: calc(24px - var(--wc-plz-offset-y));
  left: calc(50% + var(--wc-plz-offset-x));
  transform: translateX(-50%);
}
.wc-plz-badge--bottom-center:hover .wc-plz-badge__pill {
  transform: scale(1.03);
}
.wc-plz-badge--bottom-center {
  animation: wc-plz-badge-in-bc 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes wc-plz-badge-in-bc {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(12px) scale(0.92);
  }
  60% {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

/* left-center: horizontal by default */
.wc-plz-badge--left-center {
  left: calc(24px + var(--wc-plz-offset-x));
  top: calc(50% + var(--wc-plz-offset-y));
  transform: translateY(-50%);
}
.wc-plz-badge--left-center:hover .wc-plz-badge__pill {
  transform: scale(1.03);
}

/* right-center: horizontal by default */
.wc-plz-badge--right-center {
  right: calc(24px - var(--wc-plz-offset-x));
  top: calc(50% + var(--wc-plz-offset-y));
  transform: translateY(-50%);
}
.wc-plz-badge--right-center:hover .wc-plz-badge__pill {
  transform: scale(1.03);
}

/* ─── Rotation modifier (opt-in via admin) ───── */

.wc-plz-badge--rotated.wc-plz-badge--left-center {
  transform: rotate(-90deg) translateX(50%);
  transform-origin: left center;
  animation: wc-plz-badge-in-left 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.wc-plz-badge--rotated.wc-plz-badge--right-center {
  transform: rotate(90deg) translateX(-50%);
  transform-origin: right center;
  animation: wc-plz-badge-in-right 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ─── Responsive ─────────────────────────────── */

@media (max-width: 480px) {
  .wc-plz-modal__header {
    padding: 20px;
  }

  .wc-plz-modal__body {
    padding: 18px 20px;
  }

  .wc-plz-modal__footer {
    padding: 0 20px 16px;
  }

  .wc-plz-modal__title {
    font-size: 1.15rem;
  }

  .wc-plz-input-row {
    flex-direction: column;
  }

  .wc-plz-btn--primary {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
  }

  /* Badge mobile: smaller but still shows info */
  .wc-plz-badge__pill {
    padding: 7px 11px;
    gap: 5px;
  }

  .wc-plz-badge__icon {
    font-size: 0.85rem;
  }

  .wc-plz-badge__info {
    font-size: 0.75rem;
  }

  .wc-plz-badge__dot {
    width: 6px;
    height: 6px;
  }

  .wc-plz-badge--bottom-right {
    bottom: calc(16px - var(--wc-plz-offset-y));
    right: calc(16px - var(--wc-plz-offset-x));
  }
  .wc-plz-badge--bottom-left {
    bottom: calc(16px - var(--wc-plz-offset-y));
    left: calc(16px + var(--wc-plz-offset-x));
  }
  .wc-plz-badge--top-right {
    top: calc(16px + var(--wc-plz-offset-y));
    right: calc(16px - var(--wc-plz-offset-x));
  }
  .wc-plz-badge--top-left {
    top: calc(16px + var(--wc-plz-offset-y));
    left: calc(16px + var(--wc-plz-offset-x));
  }
  .wc-plz-badge--bottom-center {
    bottom: calc(16px - var(--wc-plz-offset-y));
  }
  .wc-plz-badge--left-center {
    left: calc(16px + var(--wc-plz-offset-x));
  }
  .wc-plz-badge--right-center {
    right: calc(16px - var(--wc-plz-offset-x));
  }

  /* Hide "ändern" on mobile – tap is obvious */
  .wc-plz-badge__edit {
    display: none;
  }

  /* Tooltip: narrower on mobile */
  .wc-plz-badge__tooltip {
    width: 200px;
    font-size: 0.72rem;
    padding: 8px 12px;
  }
}
