/* Responsive repairs for legacy ComfortBuy pages, forms and modal states.
   Do not override hidden controls or any Shop-Script event/form contracts. */
@media (max-width: 1000px) {
  body .content.left230px { float: none; width: 100%; min-width: 0; }
  #page, #product-description, #category-description { overflow-wrap: anywhere; }
  #page iframe, #product-description iframe, #category-description iframe { max-width: 100%; }
  #product-description iframe[src*="youtube.com/"],
  #product-description iframe[src*="youtube-nocookie.com/"] {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
  #page table, #product-description table, #category-description table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
}
@media (max-width: 780px) {
  /* Keep the account links reachable, including from cart/checkout. */
  .wrapper-top .bg-top-line .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 8px;
    width: 100%;
    padding: 0 12px;
  }
  .wrapper-top .bg-top-line .auth {
    display: block;
    float: none;
    flex: 0 0 auto;
    margin: 0;
    font-size: 13px;
    line-height: 44px;
    white-space: nowrap;
  }
  .wrapper-top .bg-top-line .auth a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 3px;
  }
  .wrapper-top .bg-top-line #cart { float: none; min-width: 0; margin-left: auto; }
  .wrapper-top .bg-top-line #cart.fixed {
    right: 12px;
    margin-right: 0;
    margin-left: 0;
    max-width: calc(100% - 24px);
  }
  .wrapper-top .bg-top-line #cart > a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 8px;
    font-size: 13px;
    line-height: 1.4;
  }
  .wrapper-top .bg-top-line .container > .clear-both { display: none; }
  .wrapper-top .header-info #search, .wrapper-top .header-info #search-m,
  body.otiza-redesign .wrapper-top .header-info #search,
  body.otiza-redesign .wrapper-top .header-info #search-m { font-size: 16px; }

  /* Existing label/value columns require >440px before checkout padding. */
  body .wa-form { float: none; width: 100%; max-width: 100%; min-width: 0; }
  body .wa-form .wa-field { padding-top: 8px; }
  body .wa-form .wa-field .wa-name { float: none; width: auto; padding-bottom: 6px; }
  body .wa-form .wa-field .wa-value { margin-left: 0; max-width: 100%; min-width: 0; }
  body .wa-form .wa-field .wa-value input[type="text"],
  body .wa-form .wa-field .wa-value input[type="email"],
  body .wa-form .wa-field .wa-value input[type="password"],
  body .wa-form .wa-field .wa-value input[type="tel"],
  body .wa-form .wa-field .wa-value input[type="number"],
  body .wa-form .wa-field .wa-value textarea,
  body .wa-form .wa-field .wa-value select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    font-size: 16px;
  }
  body .wa-form .wa-field .wa-value input.wa-captcha-input { width: 100px; }
  body .wa-form .wa-field .wa-value label { padding: 8px 0; }
  .checkout .checkout-step-content { padding: 16px 12px; }
  .checkout-form .checkout-content { min-width: 0; }

  .review-form label { float: none; width: auto; margin: 0 0 6px; }
  .review-form-fields input[type="text"], .review-form textarea {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    font-size: 16px;
  }
  .review-form-fields input[type="text"] { min-height: 44px; }
  .review-form .review-submit { padding-left: 0; }
  .review-form .errormsg { margin-left: 0; }

  /* Keep native fixed dialogs and their show/hide behaviour. */
  .dialog-window .cart.product, .dialog-window .cart.authentification {
    width: calc(100% - 24px);
    max-width: 500px;
    top: 20px;
    max-height: calc(100vh - 164px);
    max-height: calc(100dvh - 164px);
    overflow-y: auto;
  }
  .dialog-window > h1, .dialog-window > h4 {
    width: calc(100% - 24px);
    max-width: 500px;
    top: 20px;
    max-height: 120px;
    overflow-y: auto;
    padding-right: 48px;
    font-size: 18px;
  }
  .dialog-window > h4 .dialog-image-product { width: 44px; left: 8px; bottom: 4px; }
  .dialog-window > h4 .dialog-image-product img { max-width: 100%; max-height: 44px; height: auto; }
  .dialog-window .dialog-close, .dialog-window .dialog-close:hover {
    width: 44px;
    height: 44px;
    top: 0;
    right: 0;
    font-size: 24px;
    line-height: 44px;
  }
  .dialog-window .selectable-articul select { max-width: 100%; font-size: 16px; }
  .quickorder-custom-form.default .quickorder-header,
  .quickorder-custom-form.default .quickorder-body { width: calc(100% - 24px); max-width: 420px; }
  .quickorder-custom-form.default .quickorder-body { max-height: calc(85vh - 69px); overflow-y: auto; }

  .wrapper-bottom .shop li a, .wrapper-bottom .apps li a,
  .sidebar .comfortbuy-vertical-tree a {
    display: flex;
    align-items: center;
    min-height: 44px;
  }
  .sidebar .comfortbuy-vertical-tree a { padding-top: 8px; padding-bottom: 8px; }
}
