/* Kunstmotor Wunschgröße Anfrage */
.kmcustomsize-button-wrap {
  margin: 14px 0 18px;
  clear: both;
}

.kmcustomsize-button-wrap.kmcustomsize-under-size {
  margin-top: 10px;
  margin-bottom: 18px;
  padding-left: 90px;
}

.product-swatches .swatches-list > li.kmcustomsize-size-item {
  margin: 0 5px 10px;
  cursor: default;
}

.product-swatches .swatches-list > li.kmcustomsize-size-item .kmcustomsize-button-wrap,
.kmcustomsize-button-wrap.kmcustomsize-inline-size {
  margin: 0;
  padding-left: 0;
  clear: none;
}

.kmcustomsize-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 41px;
  padding: 0 14px;
  border: 1px solid #111;
  border-radius: 0;
  background: #fff;
  color: #111;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.kmcustomsize-open:hover,
.kmcustomsize-open:focus {
  background: #111;
  color: #fff;
  border-color: #111;
}

.kmcustomsize-open-icon {
  color: #b0803f;
  font-size: 15px;
  line-height: 1;
}

.kmcustomsize-open:hover .kmcustomsize-open-icon,
.kmcustomsize-open:focus .kmcustomsize-open-icon {
  color: #fff;
}

.kmcustomsize-modal[hidden] {
  display: none !important;
}

.kmcustomsize-modal {
  position: fixed;
  inset: 0;
  z-index: 2147482000;
  font-family: inherit;
}

.kmcustomsize-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.46);
}

.kmcustomsize-dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 70px rgba(0,0,0,.28);
  padding: 28px;
  color: #111;
}

.kmcustomsize-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: transparent;
  color: #333;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.kmcustomsize-dialog h2 {
  margin: 0 36px 10px 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
}

.kmcustomsize-intro {
  margin: 0 0 16px;
  color: #444;
  font-size: 14px;
  line-height: 1.55;
}

.kmcustomsize-product-box {
  margin: 0 0 16px;
  padding: 12px 14px;
  background: #f7f3ec;
  border: 1px solid #e5dac8;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
}

.kmcustomsize-product-box strong,
.kmcustomsize-product-box span {
  display: block;
}

.kmcustomsize-product-reference {
  margin-top: 3px;
  color: #555;
}

.kmcustomsize-form label {
  display: block;
  margin: 0 0 12px;
}

.kmcustomsize-form label span {
  display: block;
  margin: 0 0 5px;
  font-size: 13px;
  font-weight: 700;
  color: #111;
}

.kmcustomsize-form label em {
  color: #b00020;
  font-style: normal;
}

.kmcustomsize-form input,
.kmcustomsize-form textarea {
  width: 100%;
  border: 1px solid #d5d5d5;
  border-radius: 6px;
  background: #fff;
  color: #111;
  padding: 10px 11px;
  font-size: 14px;
  line-height: 1.3;
  box-shadow: none;
}

.kmcustomsize-form input:focus,
.kmcustomsize-form textarea:focus {
  outline: none;
  border-color: #111;
}

.kmcustomsize-grid {
  display: grid;
  gap: 12px;
}

.kmcustomsize-grid-2 {
  grid-template-columns: 1fr 1fr;
}

.kmcustomsize-privacy {
  margin: 2px 0 14px;
  color: #666;
  font-size: 12px;
  line-height: 1.45;
}

.kmcustomsize-actions {
  display: flex;
  justify-content: flex-end;
}

.kmcustomsize-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 6px;
  background: #000;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.kmcustomsize-submit[disabled] {
  opacity: .6;
  cursor: wait;
}

.kmcustomsize-message {
  display: none;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.45;
}

.kmcustomsize-message.is-success {
  display: block;
  background: #ecfdf3;
  color: #087a2d;
  border: 1px solid #b8edc8;
}

.kmcustomsize-message.is-error {
  display: block;
  background: #fff2f2;
  color: #9b1c1c;
  border: 1px solid #f1c3c3;
}


.kmcustomsize-success-view[hidden] {
  display: none !important;
}

.kmcustomsize-success-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 28px 20px;
  text-align: center;
}

.kmcustomsize-success-icon {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 18px;
  border-radius: 50%;
  background: #ecfdf3;
  color: #087a2d;
  border: 1px solid #b8edc8;
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
}

.kmcustomsize-success-text {
  max-width: 470px;
  color: #087a2d;
  font-size: 17px;
  line-height: 1.55;
  font-weight: 700;
}

.kmcustomsize-success-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: 22px;
  padding: 0 18px;
  border: 1px solid #111;
  border-radius: 6px;
  background: #111;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

body.kmcustomsize-modal-open {
  overflow: hidden;
}

@media (max-width: 767px) {
  .kmcustomsize-button-wrap.kmcustomsize-under-size {
    padding-left: 0;
  }

  .kmcustomsize-dialog {
    padding: 22px 18px;
  }

  .kmcustomsize-dialog h2 {
    font-size: 21px;
  }

  .kmcustomsize-grid-2 {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .kmcustomsize-actions {
    justify-content: stretch;
  }

  .kmcustomsize-submit {
    width: 100%;
  }
}

/* ZOneTheme visible swatches: align the request button under the size options */
.product-swatches + .kmcustomsize-button-wrap.kmcustomsize-under-size,
.product-swatches .product-swatches-item + .kmcustomsize-button-wrap.kmcustomsize-under-size,
.product-variants .kmcustomsize-button-wrap.kmcustomsize-under-size {
  padding-left: calc(25% + 15px);
}

.product-variants .kmcustomsize-button-wrap.kmcustomsize-under-size {
  width: 100%;
}

@media (max-width: 767px) {
  .product-swatches + .kmcustomsize-button-wrap.kmcustomsize-under-size,
  .product-swatches .product-swatches-item + .kmcustomsize-button-wrap.kmcustomsize-under-size,
  .product-variants .kmcustomsize-button-wrap.kmcustomsize-under-size {
    padding-left: 0;
  }
}

/* ZOneTheme swatch inline placement */
.product-swatches .swatches-list > li.kmcustomsize-size-item .kmcustomsize-open:hover,
.product-swatches .swatches-list > li.kmcustomsize-size-item .kmcustomsize-open:focus {
  text-decoration: none;
}

@media (max-width: 767px) {
  .kmcustomsize-button-wrap.kmcustomsize-under-size {
    padding-left: 0;
  }

  .product-swatches .swatches-list > li.kmcustomsize-size-item {
    width: auto;
  }
}


/* ==========================================================
   v1.0.4 – Mobile Produktseite + Popup Feinschliff
   - Produktbereich auf Mobilgeräten volle Breite nutzbar
   - Varianten können wieder nebeneinander umbrechen
   - Popup auf Mobilgeräten schmaler und luftiger
   ========================================================== */
@media (max-width: 767.98px) {
  body#product #wrapper,
  body#product #main-content,
  body#product .main-content,
  body#product .center-wrapper,
  body#product #content-wrapper,
  body#product #mainProduct {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body#product .main-content > .container,
  body#product #main-content > .container,
  body#product #wrapper > .container,
  body#product .center-wrapper > section,
  body#product #content-wrapper.center-column {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
  }

  body#product #mainProduct.main-product-details {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 10px !important;
    overflow: hidden !important;
  }

  body#product #mainProduct > .row,
  body#product #mainProduct .product-swatches-item.row {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    box-sizing: border-box !important;
  }

  body#product #mainProduct .product-left,
  body#product #mainProduct .product-right,
  body#product #mainProduct .product-left-content,
  body#product #mainProduct .product-right-content,
  body#product #mainProduct .product-actions,
  body#product #mainProduct .product-variants,
  body#product #mainProduct .product-swatches,
  body#product #mainProduct .product-swatches-item,
  body#product #mainProduct .product-swatches-item > div,
  body#product #mainProduct .product-swatches-item .col-12,
  body#product #mainProduct .product-swatches-item .col-md-9,
  body#product #mainProduct .images-container,
  body#product #mainProduct .images-container-wrapper,
  body#product #mainProduct .product-cover {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  body#product #mainProduct .product-swatches-item .form-control-label {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-bottom: 9px !important;
  }

  body#product #mainProduct .product-swatches .swatches-list {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 8px 8px !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  body#product #mainProduct .product-swatches .swatches-list > li.js-swatch-item,
  body#product #mainProduct .product-swatches .swatches-list > li.kmcustomsize-size-item {
    width: auto !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body#product #mainProduct .product-swatches .swatches-list > li.js-swatch-item > span {
    min-height: 38px !important;
    padding: 0 13px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  body#product #mainProduct .kmcustomsize-open {
    min-height: 38px !important;
    padding: 0 12px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  .kmcustomsize-dialog {
    width: min(330px, calc(100vw - 56px)) !important;
    max-width: calc(100vw - 56px) !important;
    max-height: calc(100dvh - 72px) !important;
    padding: 20px 14px 18px !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
  }

  @supports not (height: 100dvh) {
    .kmcustomsize-dialog {
      max-height: calc(100vh - 72px) !important;
    }
  }

  .kmcustomsize-close {
    top: 8px !important;
    right: 10px !important;
    font-size: 26px !important;
  }

  .kmcustomsize-dialog h2 {
    margin-right: 28px !important;
    font-size: 20px !important;
    line-height: 1.18 !important;
  }

  .kmcustomsize-intro {
    font-size: 12px !important;
    line-height: 1.45 !important;
    margin-bottom: 14px !important;
  }

  .kmcustomsize-product-box {
    padding: 10px 11px !important;
    border-radius: 0 !important;
    font-size: 11px !important;
  }

  .kmcustomsize-form label {
    margin-bottom: 10px !important;
  }

  .kmcustomsize-form label span {
    font-size: 11px !important;
  }

  .kmcustomsize-form input,
  .kmcustomsize-form textarea {
    min-height: 34px !important;
    padding: 8px 9px !important;
    border-radius: 0 !important;
    font-size: 12px !important;
  }
}


/* ==========================================================
   v1.0.5 – Mobile Breiten-Fix + kompakteres Popup
   - entfernt den rechten Leerraum im mobilen Produktblock
   - nutzt die volle verfügbare Breite für Varianten/Preis
   - reduziert Innenabstände im Wunschgrößen-Popup
   ========================================================== */
@media (max-width: 767.98px) {
  html,
  body#product {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body#product .main-content,
  body#product .main-content > .container,
  body#product #content-wrapper,
  body#product .center-wrapper,
  body#product .center-wrapper > section {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  body#product h1.page-heading {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  body#product #mainProduct,
  body#product #mainProduct.main-product-details,
  body#product #mainProduct.shadow-box {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    box-sizing: border-box !important;
  }

  body#product #mainProduct > .row,
  body#product #mainProduct .product-right-content > .row,
  body#product #mainProduct .product-information .row,
  body#product #mainProduct .product-swatches-item.row {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  body#product #mainProduct .product-left,
  body#product #mainProduct .product-right,
  body#product #mainProduct .product-right-content,
  body#product #mainProduct .product-right-content > .row > .col-12,
  body#product #mainProduct .product-information,
  body#product #mainProduct .product-actions,
  body#product #mainProduct form#add-to-cart-or-refresh,
  body#product #mainProduct .product-variants,
  body#product #mainProduct .product-swatches,
  body#product #mainProduct .product-swatches-item,
  body#product #mainProduct .product-swatches-item > .col-12,
  body#product #mainProduct .product-swatches-item > .col-md-9,
  body#product #mainProduct .product-prices,
  body#product #mainProduct .product-prices-wrapper,
  body#product #mainProduct .product-add-to-cart,
  body#product #mainProduct .product-quantity,
  body#product #mainProduct .km-product-prices-wrapper,
  body#product #mainProduct .kmdd-delivery-line,
  body#product #mainProduct .km-product-delivery,
  body#product #mainProduct .kmdd-product-delivery,
  body#product #mainProduct #kmdd-delivery-line,
  body#product #mainProduct #kmdd-product-delivery {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  body#product #mainProduct .product-information.light-box-bg {
    padding: 0 !important;
    border: 1px dashed #dedede !important;
  }

  body#product #mainProduct .product-actions {
    padding: 14px 8px 16px !important;
  }

  body#product #mainProduct .product-swatches .swatches-list {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  body#product #mainProduct .product-swatches .swatches-list > li.js-swatch-item,
  body#product #mainProduct .product-swatches .swatches-list > li.kmcustomsize-size-item {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: calc(50% - 4px) !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body#product #mainProduct .product-swatches .swatches-list > li.js-swatch-item > span,
  body#product #mainProduct .product-swatches .swatches-list > li.kmcustomsize-size-item .kmcustomsize-open {
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 38px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    font-size: 12px !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
  }

  body#product #mainProduct .product-swatches-item .form-control-label {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding: 0 !important;
    margin: 0 0 10px !important;
  }

  /* Popup: kompakter, weniger Innenabstand oben/unten */
  .kmcustomsize-dialog {
    width: min(310px, calc(100vw - 70px)) !important;
    max-width: calc(100vw - 70px) !important;
    max-height: calc(100dvh - 54px) !important;
    padding: 15px 14px 12px !important;
    border-radius: 0 !important;
  }

  @supports not (height: 100dvh) {
    .kmcustomsize-dialog {
      max-height: calc(100vh - 54px) !important;
    }
  }

  .kmcustomsize-close {
    top: 7px !important;
    right: 9px !important;
    font-size: 25px !important;
  }

  .kmcustomsize-dialog h2 {
    margin: 0 28px 8px 0 !important;
    font-size: 20px !important;
    line-height: 1.15 !important;
  }

  .kmcustomsize-intro {
    margin: 0 0 10px !important;
    font-size: 12px !important;
    line-height: 1.42 !important;
  }

  .kmcustomsize-product-box {
    margin: 0 0 10px !important;
    padding: 9px 10px !important;
    border-radius: 0 !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  .kmcustomsize-form label {
    margin: 0 0 8px !important;
  }

  .kmcustomsize-form label span {
    margin: 0 0 4px !important;
    font-size: 11px !important;
    line-height: 1.25 !important;
  }

  .kmcustomsize-form input,
  .kmcustomsize-form textarea {
    min-height: 32px !important;
    padding: 7px 9px !important;
    border-radius: 0 !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
  }

  .kmcustomsize-form textarea {
    min-height: 68px !important;
  }

  .kmcustomsize-privacy {
    margin: 0 0 10px !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  .kmcustomsize-submit {
    min-height: 38px !important;
    font-size: 13px !important;
  }
}

/* ==========================================================
   v1.0.6 – Mobile Varianten-Buttons sauber umbrechen
   - lange Materialnamen bleiben im Button
   - Wunschgröße-Button bekommt mehr seitlichen Innenabstand
   ========================================================== */
@media (max-width: 767.98px) {
  body#product #mainProduct .product-swatches .swatches-list > li.js-swatch-item,
  body#product #mainProduct .product-swatches .swatches-list > li.kmcustomsize-size-item {
    flex: 0 1 auto !important;
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  body#product #mainProduct .product-swatches .swatches-list > li.js-swatch-item > span,
  body#product #mainProduct .product-swatches .swatches-list > li.kmcustomsize-size-item .kmcustomsize-open {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 38px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    line-height: 1.18 !important;
    padding: 8px 12px !important;
    box-sizing: border-box !important;
  }

  body#product #mainProduct .product-swatches .swatches-list > li.kmcustomsize-size-item {
    max-width: 100% !important;
  }

  body#product #mainProduct .product-swatches .swatches-list > li.kmcustomsize-size-item .kmcustomsize-open,
  body#product #mainProduct .kmcustomsize-open {
    min-width: 172px !important;
    padding-left: 18px !important;
    padding-right: 18px !important;
    gap: 7px !important;
    white-space: nowrap !important;
  }

  body#product #mainProduct .product-swatches .swatches-list > li.kmcustomsize-size-item .kmcustomsize-open-icon,
  body#product #mainProduct .kmcustomsize-open .kmcustomsize-open-icon {
    flex: 0 0 auto !important;
  }
}


/* ==========================================================
   v1.0.7 – Mobile Popup mit mehr Abstand oben/unten
   - Dialog wird auf Mobilgeräten niedriger
   - oben und unten bleibt deutlich mehr Abstand sichtbar
   - Inhalt scrollt innerhalb des Popups
   ========================================================== */
@media (max-width: 767.98px) {
  .kmcustomsize-modal {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  .kmcustomsize-dialog {
    width: min(306px, calc(100vw - 68px)) !important;
    max-width: calc(100vw - 68px) !important;
    max-height: min(72dvh, calc(100dvh - 170px)) !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-top: 15px !important;
    padding-bottom: 12px !important;
  }

  @supports not (height: 100dvh) {
    .kmcustomsize-dialog {
      max-height: min(72vh, calc(100vh - 170px)) !important;
    }
  }

  /* Bei sehr kleinen Displays nicht zu knapp werden lassen */
  @media (max-height: 680px) {
    .kmcustomsize-dialog {
      max-height: calc(100dvh - 96px) !important;
    }
    @supports not (height: 100dvh) {
      .kmcustomsize-dialog {
        max-height: calc(100vh - 96px) !important;
      }
    }
  }
}
