/* 
 * BPC Checkout CSS Styles 
 */

/* General layout */

.bpc-checkout * {
  box-sizing: border-box;
}

.bpc-checkout .form-row {
  margin-inline: 0;
}

.bpc-checkout .error {
  border-color: red;
}

.ui-state-active {
  color: red !important;
}

.bpc-checkout {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  margin: 30px 0;
}

.bpc-checkout-layout {
  display: grid;
  width: 1680px;
  max-width: 100%;
  margin-inline: auto;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 20px;
}
@media (max-width: 992px) {
  .bpc-checkout-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
}

.bpc-checkout h2 {
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
  font-size: 22px;
}

.shipping-fields {
  padding-top: 0;
}

.bpc-checkout h3 {
  margin: 0;
  padding-top: 15px;
  font-size: 18px;
}

.bpc-checkout h4 {
  margin: 12px 0;
  font-size: 16px;
}

.bpc-checkout-empty-cart {
  text-align: center;
  padding: 30px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f9f9f9;
  border: 1px solid #eee;
  border-radius: 5px;
  margin-inline: auto;
}

/* Category sections */
.bpc-checkout-category {
  margin-bottom: 30px;
  padding: 20px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;

  &:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  }
}

.bpc-checkout-category:last-child {
  margin-bottom: 0;
}

.bpc-checkout-products {
  grid-column-start: 1;
  grid-column-end: 3;
}

/* Product table */
.bpc-checkout-products-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  margin-top: -20px;

}

.bpc-checkout-products-table th,
.bpc-checkout-products-table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

.bpc-checkout-products-table th {
  background-color: #f9f9f9;
  font-weight: 600;
}

.bpc-checkout-products-table .product-image {
  width: 80px;
}

.bpc-checkout-products-table .product-image img {
  max-width: 60px;
  height: auto;
  border-radius: 3px;
}

.bpc-checkout-products-table .product-name {
  width: 30%;
  a {
    color: #333;
    text-decoration: underline;

    &:hover {
      color: #80b6a4;
    }
  }
}

.bpc-checkout-products-table .product-price,
.bpc-checkout-products-table .product-subtotal,
.bpc-checkout-products-table .product-quantity{
  width: 15%;
}

@media (width < 768px) {
  .bpc-checkout-products-table .product-price,
  .bpc-checkout-products-table .product-subtotal,
  .bpc-checkout-products-table .product-quantity{
    width: 100%;
  }
}

.bpc-checkout-products-table .product-quantity input {
  width: 60px;
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 3px;
  text-align: center;

  &:hover,
  &:focus {
    border-color: #80b6a4;
  }
}

.bpc-checkout-products-table .product-remove {
  text-align: center;
  display: table-cell !important;
}

.bpc-checkout-products-table .product-remove a {
  display: inline-block;
  transition: transform 0.2s ease;

  svg {
    stroke: #d32f2f;
  }

  &:hover {
    transform: scale(1.2);
  }
}

/* Responsive table styles for mobile devices */
@media (max-width: 767px) {
  .bpc-checkout-products-table,
  .bpc-checkout-products-table thead,
  .bpc-checkout-products-table tbody,
  .bpc-checkout-products-table th,
  .bpc-checkout-products-table td,
  .bpc-checkout-products-table tr {
    display: block;
  }

  .bpc-checkout-products-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .bpc-checkout-products-table tr {
    border: 1px solid #eee;
    margin-bottom: 15px;
    position: relative;
  }

  .bpc-checkout-products-table td {
    border: none;
    border-bottom: 1px solid #eee;
    padding: 8px 8px 8px 45%;
    position: relative;
  }

  .bpc-checkout-products-table td:before {
    position: absolute;
    top: 50%;
    left: 10px;
    width: 40%;
    transform: translateY(-50%);
    padding-right: 10px;
    white-space: nowrap;
    font-weight: 600;
  }

  .bpc-checkout-products-table td.product-image {
    width: 100%;
    text-align: center;
    padding-left: 8px;
  }

  .bpc-checkout-products-table td.product-image img {
    max-width: 70%;
  }

  .bpc-checkout-products-table td.product-name {
    width: 100%;
  }

  .bpc-checkout-products-table td.product-name:before {
    content: "Produkt:";
  }
  .bpc-checkout-products-table td.product-price:before {
    content: "Cena:";
  }
  .bpc-checkout-products-table td.product-quantity:before {
    content: "Ilość:";
  }
  .bpc-checkout-products-table td.product-subtotal:before {
    content: "Suma częściowa:";
  }

  .bpc-checkout-products-table td.product-remove {
    width: 100%;
    text-align: right;
    padding: 8px;
    position: absolute;
    top: 0;
    right: 0;
    border: none;
  }

  .bpc-checkout-products-table .product-quantity input {
    max-width: 80px;
  }
}

.quantity-error {
  font-size: 12px;
  color: #f44336;
  margin-top: 5px;
  display: none;
}

/* Delivery options */
.bpc-checkout-delivery-options {
  background-color: #f9f9f9;
  padding: 15px;
  border-radius: 5px;
  margin-top: 15px;
}

.bpc-checkout-delivery-method,
.bpc-checkout-delivery-date {
  margin-bottom: 15px;
}

.bpc-checkout-postcode-validation {
  transition: all 0.3s ease;
}

.bpc-checkout-postcode-message.success {
  display: block;
}

.bpc-checkout-postcode-validation.validated {
  background-color: rgba(76, 175, 80, 0.05);
}

.bpc-checkout-delivery-method label,
.bpc-checkout-delivery-date label,
.bpc-checkout-postcode-validation label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
}

.bpc-checkout-delivery-method select,
.bpc-checkout-delivery-date input,
.bpc-checkout-postcode-validation input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 3px;
  background-color: #fff;

  &:hover {
    border-color: #80b6a4;
  }
}

.bpc-checkout-validate-postcode {
  margin-top: 8px;
  padding: 8px 12px;
  background-color: #333;
  color: #80b6a4;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  display: inline-block;
  margin-left: auto;
  margin-right: 0;
  width: 100%;
  transition: all 0.2s ease;
  font-weight: 500;
}

.bpc-checkout-validate-postcode:hover {
  background-color: #80b6a4;
  color: #333;
}

.bpc-checkout-postcode-message {
  margin-top: 8px;
  font-size: 14px;
  display: none;
  padding: 5px 0;
  transition: all 0.3s ease;
}

.bpc-checkout-postcode-message.success {
  color: #333;
}

.bpc-checkout-postcode-message.error {
  color: #f44336;
}

/* Form styling */
.bpc-checkout-customer-details {
  padding: 20px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 5px;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.bpc-checkout-billing,
.bpc-checkout-shipping {
  margin-bottom: 0;
}

.bpc-checkout-shipping {
  &:last-child {
    margin-bottom: 0;

    .form-field {
      margin-bottom: 0;
    }
  }
}

.bpc-checkout-customer-details .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;

  @media (max-width: 767px) {
    grid-template-columns: 1fr;
  }

  &:last-child {
    margin-bottom: 0;
  }

  &::before,
  &::after {
    display: none !important;
  }
}

.form-field {
  margin-bottom: 15px;
}

.form-field label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
}

.form-field label .required {
  color: #f44336;
}

.form-field textarea,
.form-field input,
.form-field select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 14px;
}
.form-field textarea:hover,
.form-field input:hover,
.form-field select:hover,
.form-field input:focus,
.form-field select:focus {
  border-color: #80b6a4;
  outline: none;
}

.form-field input.error,
.form-field select.error {
  border-color: #f44336;
}

.field-error-message {
  color: #f44336;
  font-size: 12px;
  margin-top: 4px;
  display: none;
}

.field-error-message.visible {
  display: block;
}

.shipping-toggle {
  position: relative;
  padding-left: 20px;
}

.shipping-toggle label {
  font-weight: normal;
  cursor: pointer;
}

.shipping-toggle input[type="checkbox"] {
  position: absolute;
  left: 0;
  width: unset;
  top: 5px;
}

/* Order summary */
.bpc-checkout-order-summary {
  position: sticky;
  top: 1rem;
  padding: 20px;
  width: 100%;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Coupon form */
.bpc-checkout-coupon {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.bpc-checkout-coupon h4 {
  margin-bottom: 10px;
}

.bpc-checkout-coupon-form {
  display: flex;
  gap: 10px;
}

.bpc-checkout-coupon-form input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 3px;

  &:hover,
  &:focus {
    border-color: #80b6a4;
  }
}

.bpc-checkout-coupon-form button,
.bpc-checkout-phone button {
  padding: 8px 15px;
  background-color: #333;
  color: #80b6a4;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.bpc-checkout-coupon-form button:hover {
  background-color: #80b6a4;
  color: #333;
}

#bpc-checkout-coupon-message {
  margin-top: 8px;
  font-size: 14px;
  display: none;
}

#bpc-checkout-coupon-message.success {
  color: #333;
}

#bpc-checkout-coupon-message.error {
  color: #f44336;
}

.bpc-checkout-totals {
  width: 100%;
  margin-bottom: 20px;
}

.bpc-checkout-totals th {
  text-align: left;
  padding: 10px 0;
  font-weight: normal;
  border-bottom: 1px solid #eee;
}

.bpc-checkout-totals td {
  text-align: right;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  font-weight: 600;
}

.bpc-checkout-totals tr:last-child th,
.bpc-checkout-totals tr:last-child td {
  border-top: 2px solid #eee;
  font-weight: 700;
  font-size: 1.1em;
}

.bpc-checkout-place-order {
  margin-top: 30px;
}

.bpc-checkout-place-order button {
  width: 100%;
  padding: 15px;
  background: #333;
  color: #80b6a4;
  border: none;
  border-radius: 3px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s;
}

.bpc-checkout-place-order button:hover {
  background-color: #80b6a4;
  color: #333;
}

.bpc-checkout-place-order button:disabled {
  background-color: #9e9e9e;
  cursor: not-allowed;
}

#bpc-checkout-errors {
  margin-top: 15px;
  padding: 10px 15px;
  background-color: #ffebee;
  border: 1px solid #ffcdd2;
  border-radius: 3px;
  color: #b71c1c;
  display: none;
}

/* Datepicker customization */
.ui-datepicker {
  font-size: 14px;
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ui-datepicker-header {
  background-color: #80b6a4;
  color: white;
  border-radius: 3px 3px 0 0;
}

.ui-datepicker-prev,
.ui-datepicker-next {
  cursor: pointer;
}

.ui-datepicker-calendar .ui-state-default {
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  color: #333;
  border-radius: 3px;
  text-align: center;
}

.ui-datepicker-calendar .ui-state-hover {
  background-color: #e9e9e9;
}

.ui-datepicker-calendar .ui-state-active {
  background-color: #80b6a4;
  color: white;
  border-color: #80b6a4;
}

.ui-datepicker-calendar .excluded-day,
.ui-datepicker-calendar .excluded-specific-date {
  background-color: #ffebee;
  color: #b71c1c;
  text-decoration: line-through;
}

#ui-datepicker-div {
  background-color: #fff !important;
}

.ui-datepicker-calendar th,
.ui-datepicker-calendar td {
  padding: 1px !important;
  border: 0 !important;
}

.bpc-checkout .woocommerce-Price-amount {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 0.1rem;
}

/* Delivery message styles */
.delivery-message-container {
  margin-top: 15px;
  margin-bottom: 15px;
}

.delivery-message-container {
  margin-top: 15px;
  margin-bottom: 15px;
}

.delivery-message {
  padding: 10px 15px;
  background-color: #f8f9fa;
  border-left: 4px solid #80b6a4;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.5;
}

.delivery-message:empty {
  display: none;
}

.bpc-checkout-remove-coupon {
  position: relative;

  svg {
    position: relative;
    top: -2px;
  }
}

.bpc-checkout-phone-wrapper {
  display: flex;
  gap: 10px;
}

.col-1,
.col-2 {
  max-width: unset !important;
}

.bpc-checkout-delivery-box {
  display: flex;
  gap: 1rem;
  flex-direction: row;

  @media (width < 768px) {
    flex-direction: column;
  }
}

.category-header + div {
  display: block;
}