/* Ekomuzeum / Quick.Cart - mobile checkout layout v1
   Only basket and order forms; desktop styling is unchanged.
   Load AFTER style.css, modern.css, cards.css and order-fields.css.
*/
@media screen and (max-width: 700px) {
  /* Prevent fixed table sizing from enlarging the whole page. */
  #basket, #order, #basket form, #order form,
  #basket #orderedProducts, #order #orderedProducts,
  #basket #orderedProducts > div, #order #orderedProducts > div {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
  }
  #basket #orderedProducts, #order #orderedProducts {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }
  /* Flex preserves the semantic product list ahead of the footer:
     HTML source has TFOOT before TBODY. */
  #basket #orderedProducts table,
  #order #orderedProducts table {
    display: flex !important;
    flex-direction: column;
    gap: 0;
    box-sizing: border-box;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: auto !important;
    margin: 0 !important;
    font-size: 15px;
  }
  #basket #orderedProducts table > thead,
  #order #orderedProducts table > thead { display: none !important; }
  #basket #orderedProducts table > tbody,
  #order #orderedProducts table > tbody {
    display: block !important;
    order: 1;
    min-width: 0;
    width: 100%;
  }
  #basket #orderedProducts table > tfoot,
  #order #orderedProducts table > tfoot {
    display: block !important;
    order: 2;
    min-width: 0;
    width: 100%;
    padding-top: 12px;
  }
  /* Every product becomes a readable full-width mobile card. */
  #basket #orderedProducts tbody > tr,
  #order #orderedProducts tbody > tr {
    display: flex !important;
    flex-direction: column;
    gap: 7px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    margin: 0 0 12px;
    padding: 14px;
    border: 1px solid #daddd4;
    border-radius: 10px;
    background: #fff;
  }
  #basket #orderedProducts tbody > tr > *,
  #order #orderedProducts tbody > tr > * {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-sizing: border-box;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100%;
    padding: 2px 0 !important;
    margin: 0 !important;
    float: none !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    text-align: right !important;
  }
  /* Product names can be either TH or TD in Quick.Cart. */
  #basket #orderedProducts tbody > tr > :first-child,
  #order #orderedProducts tbody > tr > :first-child {
    display: block !important;
    padding: 0 0 7px !important;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    text-align: left !important;
    color: #34552b;
  }
  #basket #orderedProducts tbody > tr > :first-child a,
  #order #orderedProducts tbody > tr > :first-child a {
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  #basket #orderedProducts tbody > tr > :nth-child(2)::before,
  #order #orderedProducts tbody > tr > :nth-child(2)::before {
    content: 'Cena';
  }
  #basket #orderedProducts tbody > tr > :nth-child(3)::before,
  #order #orderedProducts tbody > tr > :nth-child(3)::before {
    content: 'Ilość';
  }
  #basket #orderedProducts tbody > tr > :nth-child(4)::before,
  #order #orderedProducts tbody > tr > :nth-child(4)::before {
    content: 'Wartość';
  }
  #basket #orderedProducts tbody > tr > :nth-child(2)::before,
  #basket #orderedProducts tbody > tr > :nth-child(3)::before,
  #basket #orderedProducts tbody > tr > :nth-child(4)::before,
  #order #orderedProducts tbody > tr > :nth-child(2)::before,
  #order #orderedProducts tbody > tr > :nth-child(3)::before,
  #order #orderedProducts tbody > tr > :nth-child(4)::before {
    flex: 0 1 auto;
    color: #626b60;
    font-weight: 400;
    text-align: left;
  }
  #basket #orderedProducts tbody > tr > :nth-child(5) {
    justify-content: flex-end;
    padding-top: 7px !important;
    border-top: 1px solid #edf2e7;
  }
  #basket #orderedProducts tbody input[type='text'],
  #basket #orderedProducts tbody input[type='number'] {
    box-sizing: border-box;
    width: 76px !important;
    max-width: 90px;
    min-height: 38px;
    padding: 5px 9px;
    text-align: center !important;
    font-size: 16px;
  }
  /* Summary rows have colspan cells, so handle them separately. */
  #basket #orderedProducts tfoot > tr,
  #order #orderedProducts tfoot > tr {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 11px 3px;
    border-bottom: 1px solid #edf2e7;
  }
  #basket #orderedProducts tfoot > tr > *,
  #order #orderedProducts tfoot > tr > * {
    display: block !important;
    box-sizing: border-box;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  #basket #orderedProducts tfoot .summaryProducts th,
  #basket #orderedProducts tfoot .summaryProducts td,
  #order #orderedProducts tfoot .summaryProducts th,
  #order #orderedProducts tfoot .summaryProducts td,
  #order #orderedProducts tfoot .summaryShippingPayment th,
  #order #orderedProducts tfoot .summaryShippingPayment td,
  #order #orderedProducts tfoot .summaryOrder th,
  #order #orderedProducts tfoot .summaryOrder td {
    text-align: left !important;
    font-size: 15px;
    line-height: 1.5;
  }
  #basket #orderedProducts tfoot .summaryProducts td,
  #order #orderedProducts tfoot .summaryProducts td,
  #order #orderedProducts tfoot .summaryShippingPayment td,
  #order #orderedProducts tfoot .summaryOrder td {
    margin-left: auto !important;
    font-weight: 700;
    text-align: right !important;
  }
  #order #orderedProducts tfoot .summaryOrder {
    border-bottom: 0;
    padding-top: 16px;
    padding-bottom: 16px;
  }
  #order #orderedProducts tfoot .summaryOrder th,
  #order #orderedProducts tfoot .summaryOrder td {
    font-weight: 700;
    font-size: 18px;
  }
  /* The 5-column basket has empty spacer cells in these rows. */
  #basket #orderedProducts tfoot #recount {
    justify-content: flex-end;
    border-bottom: 0;
    padding-top: 0;
  }
  #basket #orderedProducts tfoot #recount > :first-child,
  #basket #orderedProducts tfoot #recount > :last-child,
  #basket #orderedProducts tfoot .summaryProducts > :last-child {
    display: none !important;
  }
  #basket #orderedProducts tfoot .buttons {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    border: 0;
    padding-top: 18px;
  }
  #basket #orderedProducts tfoot .buttons > *,
  #basket #orderedProducts tfoot .buttons .nextStep,
  #basket #orderedProducts tfoot .buttons #continue {
    width: 100% !important;
    text-align: center !important;
  }
  #basket #orderedProducts tfoot .buttons input.submit,
  #order #orderedProducts tfoot #nextStep input.submit {
    box-sizing: border-box;
    display: block;
    width: 100% !important;
    max-width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    white-space: normal;
    font-size: 16px;
  }
  /* Consent and final purchase button must stay within the viewport. */
  #order #orderedProducts tfoot #rulesAccept {
    display: block !important;
    border-top: 1px solid #daddd4;
    border-bottom: 0;
    padding-top: 16px;
  }
  #order #orderedProducts tfoot #rulesAccept > th {
    display: block !important;
    width: 100% !important;
    text-align: left !important;
    line-height: 1.7;
    font-weight: 400;
  }
  #order #orderedProducts tfoot #rulesAccept em {
    display: inline-block;
    margin-right: 7px;
    vertical-align: middle;
  }
  #order #orderedProducts tfoot #rulesAccept span {
    display: inline;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  #order #orderedProducts tfoot #rulesAccept input[type='checkbox'] {
    width: 20px;
    height: 20px;
    vertical-align: middle;
  }
  #order #orderedProducts tfoot #nextStep {
    display: block !important;
    border: 0;
    padding-top: 6px;
  }
  #order #orderedProducts tfoot #nextStep > td {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
  }
}
