/* Commerce cart only; the form's numeric suffix is intentionally not fixed.
 * This stylesheet does not change quantities, totals or form behaviour.
 */
form[id^="views-form-commerce-cart-form-"],
form[id^="views-form-commerce-cart-form-"] * {
  box-sizing: border-box;
}

form[id^="views-form-commerce-cart-form-"] {
  color: #2f1b0d;
}

form[id^="views-form-commerce-cart-form-"] > .table-responsive {
  margin-bottom: 0;
  border: 0;
}

form[id^="views-form-commerce-cart-form-"] > .table-responsive > table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  background: #fff;
  color: #2f1b0d;
  font-size: 16px;
  line-height: 1.45;
}

form[id^="views-form-commerce-cart-form-"] > .table-responsive > table th,
form[id^="views-form-commerce-cart-form-"] > .table-responsive > table td {
  padding: 14px 12px;
  border: 0;
  border-bottom: 1px solid #e5d8c5;
  vertical-align: middle;
}

form[id^="views-form-commerce-cart-form-"] > .table-responsive > table thead th {
  background: #eee5d8;
  color: #2f1b0d;
  font-weight: 700;
}

form[id^="views-form-commerce-cart-form-"] > .table-responsive > table tbody > tr:nth-child(odd) {
  background: #fcfaf7;
}

form[id^="views-form-commerce-cart-form-"] td.views-field-field-variation-image img {
  display: block;
  width: 72px;
  max-width: 100%;
  height: 72px;
  object-fit: contain;
}

form[id^="views-form-commerce-cart-form-"] td.views-field-purchased-entity {
  overflow-wrap: anywhere;
}

form[id^="views-form-commerce-cart-form-"] td.views-field-purchased-entity a {
  color: #754800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

form[id^="views-form-commerce-cart-form-"] td.views-field-unit-price__number,
form[id^="views-form-commerce-cart-form-"] td.views-field-total-price__number {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

form[id^="views-form-commerce-cart-form-"] td.views-field-total-price__number {
  font-weight: 700;
}

form[id^="views-form-commerce-cart-form-"] td.views-field-edit-quantity .form-item {
  margin: 0;
}

form[id^="views-form-commerce-cart-form-"] input.quantity-edit-input {
  width: 90px;
  max-width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #bfae96;
  border-radius: 6px;
  background: #fff;
  color: #2f1b0d;
  font-size: 16px;
  line-height: 1.4;
}

form[id^="views-form-commerce-cart-form-"] button.delete-order-item,
form[id^="views-form-commerce-cart-form-"] .form-actions > button[name="update"] {
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid #bfae96;
  border-radius: 7px;
  background: #fff;
  color: #645346;
  box-shadow: none;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
}

form[id^="views-form-commerce-cart-form-"] button.delete-order-item:hover,
form[id^="views-form-commerce-cart-form-"] .form-actions > button[name="update"]:hover {
  background: #f7f4ef;
  color: #2f1b0d;
}

form[id^="views-form-commerce-cart-form-"] [data-drupal-selector="order-total-summary"] {
  width: fit-content;
  max-width: 100%;
  margin: 24px 0 0 auto;
  padding: 18px 22px;
  border: 1px solid #e5d8c5;
  border-radius: 10px;
  background: #f7f4ef;
}

form[id^="views-form-commerce-cart-form-"] [data-drupal-selector="order-total-summary"] .order-total-line {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 0;
  color: #2f1b0d;
  font-size: 18px;
  line-height: 1.4;
}

form[id^="views-form-commerce-cart-form-"] [data-drupal-selector="order-total-summary"] .order-total-line-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

form[id^="views-form-commerce-cart-form-"] [data-drupal-selector="order-total-summary"] .order-total-line-value {
  width: auto;
  white-space: nowrap;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

form[id^="views-form-commerce-cart-form-"] .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  margin: 20px 0 32px;
}

form[id^="views-form-commerce-cart-form-"] .form-actions > button[data-drupal-selector="edit-checkout"] {
  min-height: 48px;
  margin: 0;
  padding: 12px 24px;
  border: 2px solid #f5a800;
  border-radius: 8px;
  background: #f5a800;
  color: #2f1b0d;
  box-shadow: none;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
}

form[id^="views-form-commerce-cart-form-"] .form-actions > button[data-drupal-selector="edit-checkout"]:hover {
  border-color: #ffba24;
  background: #ffba24;
}

form[id^="views-form-commerce-cart-form-"] button:focus,
form[id^="views-form-commerce-cart-form-"] input.quantity-edit-input:focus,
form[id^="views-form-commerce-cart-form-"] td.views-field-purchased-entity a:focus {
  outline: 3px solid #2f1b0d;
  outline-offset: 3px;
}

@media (max-width: 767px) {
  form[id^="views-form-commerce-cart-form-"] > .table-responsive {
    width: 100%;
    overflow: visible;
  }

  form[id^="views-form-commerce-cart-form-"] > .table-responsive > table,
  form[id^="views-form-commerce-cart-form-"] > .table-responsive > table > tbody {
    display: block;
    width: 100%;
  }

  /* Keep the original column headers available to assistive technology. */
  form[id^="views-form-commerce-cart-form-"] > .table-responsive > table > thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  form[id^="views-form-commerce-cart-form-"] > .table-responsive > table > tbody > tr {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 0 14px;
    width: 100%;
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid #e5d8c5;
    border-radius: 10px;
    background: #fff;
  }

  form[id^="views-form-commerce-cart-form-"] > .table-responsive > table > tbody > tr > td {
    display: block;
    min-width: 0;
    width: auto;
    padding: 12px 0;
    grid-column: 1 / -1;
    border-bottom: 1px solid #eadfce;
    white-space: normal;
  }

  form[id^="views-form-commerce-cart-form-"] > .table-responsive > table > tbody > tr > td.views-field-field-variation-image {
    grid-column: 1;
    grid-row: 1;
    border-bottom: 0;
  }

  form[id^="views-form-commerce-cart-form-"] > .table-responsive > table > tbody > tr > td.views-field-field-variation-image:not(:has(img)) {
    display: none;
  }

  form[id^="views-form-commerce-cart-form-"] > .table-responsive > table > tbody > tr > td.views-field-purchased-entity {
    grid-column: 2;
    grid-row: 1;
    border-bottom: 0;
    font-size: 18px;
    font-weight: 700;
  }

  form[id^="views-form-commerce-cart-form-"] > .table-responsive > table > tbody > tr:not(:has(td.views-field-field-variation-image img)) > td.views-field-purchased-entity {
    grid-column: 1 / -1;
  }

  form[id^="views-form-commerce-cart-form-"] > .table-responsive > table > tbody > tr > td.views-field-unit-price__number,
  form[id^="views-form-commerce-cart-form-"] > .table-responsive > table > tbody > tr > td.views-field-edit-quantity,
  form[id^="views-form-commerce-cart-form-"] > .table-responsive > table > tbody > tr > td.views-field-total-price__number {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    white-space: nowrap;
  }

  form[id^="views-form-commerce-cart-form-"] td.views-field-unit-price__number::before {
    content: "Цена";
  }

  form[id^="views-form-commerce-cart-form-"] td.views-field-edit-quantity::before {
    content: "Количество";
  }

  form[id^="views-form-commerce-cart-form-"] td.views-field-total-price__number::before {
    content: "Итого";
  }

  form[id^="views-form-commerce-cart-form-"] td.views-field-unit-price__number::before,
  form[id^="views-form-commerce-cart-form-"] td.views-field-edit-quantity::before,
  form[id^="views-form-commerce-cart-form-"] td.views-field-total-price__number::before {
    color: #645346;
    font-size: 15px;
    font-weight: 400;
  }

  form[id^="views-form-commerce-cart-form-"] > .table-responsive > table > tbody > tr > td.views-field-remove-button {
    padding-bottom: 0;
    border-bottom: 0;
    text-align: right;
  }

  form[id^="views-form-commerce-cart-form-"] [data-drupal-selector="order-total-summary"] {
    width: 100%;
    margin-top: 8px;
    padding: 16px;
  }

  form[id^="views-form-commerce-cart-form-"] .form-actions > button {
    width: 100%;
    margin: 0;
  }
}
