/**
 * Checkout Page Styling
 * Theme-specific checkout enhancements
 */

/* ==========================================================================
   ORDER REVIEW SECTION
   ========================================================================== */

/* Order review container */
.woocommerce-checkout .woocommerce-checkout-review-order {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 25px;
}

/* Order review heading inside container */
#order_review #order_review_heading {
  font-size: 18px;
  margin: 0 0 20px 0;
  padding: 0 0 15px 0;
  border-bottom: 1px solid #e5e5e5;
}

/* Order review table - block layout for full control */
.shop_table.woocommerce-checkout-review-order-table {
  display: block !important;
  width: 100% !important;
  margin-bottom: 20px;
}

.shop_table.woocommerce-checkout-review-order-table thead {
  display: none !important;
}

.shop_table.woocommerce-checkout-review-order-table tbody,
.shop_table.woocommerce-checkout-review-order-table tfoot {
  display: block !important;
  width: 100% !important;
}

.shop_table.woocommerce-checkout-review-order-table tbody tr,
.shop_table.woocommerce-checkout-review-order-table tfoot tr {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 14px 0 !important;
  border-bottom: 1px solid #e5e5e5 !important;
  width: 100% !important;
}

.shop_table.woocommerce-checkout-review-order-table tbody tr:last-child {
  border-bottom: none !important;
}

.shop_table.woocommerce-checkout-review-order-table tbody td,
.shop_table.woocommerce-checkout-review-order-table tfoot td,
.shop_table.woocommerce-checkout-review-order-table tfoot th {
  display: block !important;
  padding: 4px 0 !important;
  border: none !important;
  text-align: left !important;
  font-size: 15px !important;
}

.shop_table.woocommerce-checkout-review-order-table tbody td.product-name {
  flex: 1 1 70% !important;
  font-weight: 500 !important;
}

.shop_table.woocommerce-checkout-review-order-table tbody td.product-total {
  flex: 0 0 auto !important;
  text-align: right !important;
  font-weight: 600 !important;
}

.shop_table.woocommerce-checkout-review-order-table tfoot th {
  flex: 1 1 70% !important;
  font-size: 12px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  color: #888 !important;
  font-weight: 600 !important;
}

.shop_table.woocommerce-checkout-review-order-table tfoot td {
  flex: 0 0 auto !important;
  text-align: right !important;
  font-weight: 600 !important;
}

/* Order total row styling */
.shop_table.woocommerce-checkout-review-order-table tfoot tr.order-total {
  border-top: 2px solid #333 !important;
  border-bottom: none !important;
  margin-top: 10px !important;
  padding-top: 20px !important;
  padding-left: 15px !important;
  padding-right: 15px !important;
  padding-bottom: 5px !important;
  background: #f8f9fa !important;
}

/* Gavekort row padding to align with total */
.shop_table.woocommerce-checkout-review-order-table tfoot tr.cart-discount,
.shop_table.woocommerce-checkout-review-order-table tfoot tr.avo-gift-card-checkout-row,
.avo-gift-card-checkout-row {
  padding-left: 15px !important;
  padding-right: 15px !important;
}

.shop_table.woocommerce-checkout-review-order-table tfoot tr.order-total th {
  font-size: 16px !important;
  color: #333 !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
}

.shop_table.woocommerce-checkout-review-order-table tfoot tr.order-total td {
  font-size: 24px !important;
  color: #333 !important;
  font-weight: 700 !important;
}

/* Amount styling */
.woocommerce-checkout .amount {
  font-size: 18px;
}

/* Includes tax styling */
.woocommerce-checkout .includes_tax,
.woocommerce-checkout .includes_tax .amount {
  font-size: 13px !important;
  font-weight: 400 !important;
}

/* Shipping row */
.shop_table.woocommerce-checkout-review-order-table tfoot tr.woocommerce-shipping-totals {
  flex-direction: column !important;
  align-items: flex-start !important;
}

.shop_table.woocommerce-checkout-review-order-table tfoot tr.woocommerce-shipping-totals th,
.shop_table.woocommerce-checkout-review-order-table tfoot tr.woocommerce-shipping-totals td {
  width: 100% !important;
  text-align: left !important;
}

.shop_table.woocommerce-checkout-review-order-table tfoot tr.woocommerce-shipping-totals td {
  padding-top: 10px !important;
}

/* Gavekort (gift card/coupon) section */
.shop_table.woocommerce-checkout-review-order-table tfoot .cart-discount th,
.shop_table.woocommerce-checkout-review-order-table tfoot .fee th {
  color: #28a745 !important;
}

/* Gift card row - input and button layout */
.avo-gift-card-checkout-row td {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
}

.avo-gift-card-checkout-row td input,
.avo-gift-card-input input {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

.avo-gift-card-checkout-row td button,
.avo-gift-card-input button {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

/* ==========================================================================
   SHIPPING METHODS
   ========================================================================== */

/* Shipping row styling in table */
.woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals {
  display: table-row;
}

.woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals > th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  vertical-align: top;
  padding-top: 20px !important;
  width: auto !important;
}

.woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals > td {
  padding-left: 0 !important;
  margin: 0 !important;
  text-align: left !important;
  vertical-align: top;
  padding-top: 15px !important;
}

/* Shipping Methods List */
.woocommerce-shipping-methods {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.woocommerce-shipping-methods li {
  padding: 0;
  margin: 0 0 8px 0;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.woocommerce-shipping-methods li:last-child {
  margin-bottom: 0;
}

.woocommerce-shipping-methods li label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  margin: 0;
  padding: 15px 20px;
  padding-left: 55px;
  cursor: pointer;
  font-weight: 500;
  font-size: 15px;
  transition: all 0.2s ease;
  position: relative;
  background: #f8f9fa;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
}

/* Checkmark circle for shipping - unchecked */
.woocommerce-shipping-methods li label::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: 2px solid #ccc;
  border-radius: 50%;
  background: #fff;
  transition: all 0.2s ease;
}

.woocommerce-shipping-methods li label:hover {
  background: #f0f4f8;
  border-color: #007cba;
}

.woocommerce-shipping-methods li label:hover::before {
  border-color: #007cba;
}

/* Hide radio buttons */
.woocommerce-shipping-methods li input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}

.woocommerce-shipping-methods li input[type="radio"] + label {
  margin-left: 0 !important;
}

/* Selected shipping method */
.woocommerce-shipping-methods li:has(input:checked) label {
  background: #e8f4fc;
  border-color: #007cba;
  border-left: 4px solid #007cba;
  padding-left: 52px;
}

.woocommerce-shipping-methods li:has(input:checked) label::before {
  background: #007cba;
  border-color: #007cba;
  left: 15px;
}

.woocommerce-shipping-methods li:has(input:checked) label::after {
  content: "";
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  margin-top: -2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
}

/* Shipping method label and price */
.woocommerce-shipping-methods li label > span:first-of-type {
  flex: 1;
}

.woocommerce-shipping-methods li label .woocommerce-Price-amount {
  font-weight: 600;
  color: #333;
}

/* Shipping method label content */
.woocommerce-shipping-methods li label > span,
.woocommerce-shipping-methods li label > span:first-child {
  display: block;
  width: 100%;
}

/* Description inside shipping method */
.woocommerce-shipping-methods li label p,
.woocommerce-shipping-methods li label .description,
.woocommerce-shipping-methods li label small,
.woocommerce-shipping-methods li label em {
  display: block;
  width: 100%;
  margin: 10px 0 0 0;
  padding: 10px 12px;
  background: #fff;
  border-radius: 6px;
  font-size: 13px;
  font-style: normal;
  font-weight: 400;
  color: #555;
  line-height: 1.6;
  border-left: 3px solid #28a745;
}

.woocommerce-shipping-methods li:has(input:checked) label p,
.woocommerce-shipping-methods li:has(input:checked) label .description,
.woocommerce-shipping-methods li:has(input:checked) label small,
.woocommerce-shipping-methods li:has(input:checked) label em {
  background: #fff;
  border-left-color: #007cba;
}

/* Hide line breaks */
.woocommerce-shipping-methods li label br {
  display: block;
  content: "";
  margin-top: 8px;
}

/* Okoskabet shipping plugin styling */
#okoskabet-shipping {
  width: 100% !important;
  display: block !important;
}

#okoskabet-shipping .description {
  display: block !important;
  width: 100% !important;
  margin: 10px 0 5px 0 !important;
  padding: 10px 12px !important;
  background: #fff !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  color: #555 !important;
  line-height: 1.4 !important;
  border-left: 3px solid #28a745 !important;
  box-sizing: border-box !important;
}

.woocommerce-shipping-methods li:has(input:checked) #okoskabet-shipping .description {
  border-left-color: #007cba !important;
  background: #f8fbff !important;
}

/* Økoskabet dropdown and fields styling */
#okoskabet-shipping {
  font-size: 15px !important;
}

#okoskabet-shipping .inline {
  display: block !important;
  width: 100% !important;
}

#okoskabet-shipping .inline > * {
  display: block !important;
  width: 100% !important;
}

#okoskabet-shipping .inline > span:first-child {
  font-weight: 500 !important;
  flex-shrink: 0 !important;
}

#okoskabet-shipping label,
#okoskabet-shipping .okoskabet-label {
  display: block !important;
  font-size: 12px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  color: #888 !important;
  font-weight: 600 !important;
  margin-bottom: 6px !important;
  margin-top: 12px !important;
}

#okoskabet-shipping select,
#okoskabet-shipping .okoskabet-select {
  width: 100% !important;
  max-width: 100% !important;
  padding: 10px 12px !important;
  border: 1px solid #ddd !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
  height: auto !important;
  min-height: 42px !important;
  background-color: #fff !important;
  cursor: pointer !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e") !important;
  background-position: right 10px center !important;
  background-repeat: no-repeat !important;
  background-size: 16px 12px !important;
  padding-right: 35px !important;
  overflow: visible !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#okoskabet-shipping select:focus,
#okoskabet-shipping .okoskabet-select:focus {
  outline: none !important;
  border-color: #007cba !important;
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2) !important;
}

#okoskabet-shipping select option {
  padding: 8px 12px !important;
  font-size: 14px !important;
  white-space: normal !important;
}


/* Delivery date styling */
#okoskabet-shipping .delivery-date,
#okoskabet-shipping .okoskabet-delivery-date,
.woocommerce-shipping-methods .delivery-info,
.woocommerce-shipping-methods .shipping-delivery-date {
  display: block !important;
  width: 100% !important;
  margin-top: 12px !important;
  padding: 10px 12px !important;
  background: #e8f5e9 !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  color: #2e7d32 !important;
  border-left: 3px solid #28a745 !important;
}

.woocommerce-shipping-methods li:has(input:checked) #okoskabet-shipping .delivery-date,
.woocommerce-shipping-methods li:has(input:checked) #okoskabet-shipping .okoskabet-delivery-date {
  background: #e3f2fd !important;
  color: #1565c0 !important;
  border-left-color: #007cba !important;
}

/* Home delivery styling */
.woocommerce-shipping-methods li[class*="home"] label .delivery-date,
.woocommerce-shipping-methods li[class*="hjemme"] label .delivery-date {
  display: block !important;
  width: 100% !important;
  margin-top: 12px !important;
  padding: 10px 12px !important;
  background: #e8f5e9 !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  color: #2e7d32 !important;
  border-left: 3px solid #28a745 !important;
}

/* Price alignment in shipping methods - right aligned */
.woocommerce-shipping-methods li label .woocommerce-Price-amount,
.woocommerce-shipping-methods li label .amount,
.woocommerce-shipping-methods li label span.woocommerce-Price-amount,
.woocommerce-shipping-methods li label bdi {
  margin-left: auto !important;
  font-weight: 600 !important;
  color: #333 !important;
  white-space: nowrap !important;
  text-align: right !important;
}

/* ==========================================================================
   PAYMENT METHODS
   ========================================================================== */

#payment {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  overflow: hidden;
}

#payment .payment_methods {
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid #e5e5e5;
}

#payment .wc_payment_method {
  border-bottom: 1px solid #e5e5e5;
  margin: 0;
  padding: 0;
  position: relative;
}

#payment .wc_payment_method:last-child {
  border-bottom: none;
}

#payment .wc_payment_method > label {
  display: flex;
  align-items: center;
  padding: 18px 20px;
  padding-left: 55px;
  margin: 0;
  cursor: pointer;
  font-weight: 500;
  font-size: 15px;
  transition: all 0.2s ease;
  position: relative;
}

/* Checkmark circle - unchecked state */
#payment .wc_payment_method > label::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 2px solid #ccc;
  border-radius: 50%;
  background: #fff;
  transition: all 0.2s ease;
}

#payment .wc_payment_method > label:hover {
  background: #f8f9fa;
}

#payment .wc_payment_method > label:hover::before {
  border-color: #007cba;
}

/* Selected state */
#payment .wc_payment_method.payment_method_selected > label,
#payment .wc_payment_method:has(input:checked) > label {
  background: #e8f4fc;
  border-left: 4px solid #007cba;
  padding-left: 51px;
}

/* Checkmark circle - checked state */
#payment .wc_payment_method.payment_method_selected > label::before,
#payment .wc_payment_method:has(input:checked) > label::before {
  background: #007cba;
  border-color: #007cba;
}

/* Checkmark icon */
#payment .wc_payment_method.payment_method_selected > label::after,
#payment .wc_payment_method:has(input:checked) > label::after {
  content: "";
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-60%) rotate(45deg);
  width: 6px;
  height: 12px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
}

/* Hide radio buttons - selection shown via checkmark */
#payment .wc_payment_method input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}

#payment .wc_payment_method label img {
  max-height: 28px;
  width: auto;
  margin-left: auto;
}

/* Hide payment_box completely */
#payment .wc_payment_method .payment_box {
  display: none !important;
}

/* Remove border on Reepay logos */
#payment .reepay-logos li {
  border-top: none !important;
  border: none !important;
}

/* ==========================================================================
   PLACE ORDER SECTION
   ========================================================================== */

#payment .place-order {
  padding: 25px 20px;
  background: #fafafa;
}

/* Terms and Conditions */
#payment .place-order .woocommerce-terms-and-conditions-wrapper {
  margin-bottom: 20px;
}

#payment .place-order .woocommerce-terms-and-conditions-wrapper .woocommerce-form__label-for-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0;
}

#payment .place-order .woocommerce-terms-and-conditions-wrapper .woocommerce-form__label-for-checkbox:hover {
  border-color: #007cba;
  background: #f8fbfd;
}

/* Custom checkbox styling */
#payment .place-order .woocommerce-terms-and-conditions-wrapper .woocommerce-form__input-checkbox {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  margin: 0;
  position: relative;
  transition: all 0.2s ease;
}

#payment .place-order .woocommerce-terms-and-conditions-wrapper .woocommerce-form__input-checkbox:hover {
  border-color: #007cba;
}

#payment .place-order .woocommerce-terms-and-conditions-wrapper .woocommerce-form__input-checkbox:checked {
  background: #007cba;
  border-color: #007cba;
}

#payment .place-order .woocommerce-terms-and-conditions-wrapper .woocommerce-form__input-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 12px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

#payment .place-order .woocommerce-terms-and-conditions-wrapper .woocommerce-form__label-for-checkbox span {
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

#payment .place-order .woocommerce-terms-and-conditions-wrapper .woocommerce-form__label-for-checkbox a {
  color: #007cba;
  text-decoration: none;
  font-weight: 500;
}

#payment .place-order .woocommerce-terms-and-conditions-wrapper .woocommerce-form__label-for-checkbox a:hover {
  text-decoration: underline;
}

/* Terms validation error state */
#payment .place-order .woocommerce-terms-and-conditions-wrapper.woocommerce-invalid .woocommerce-form__label-for-checkbox {
  border-color: #dc3545;
  background: #fff5f5;
}

/* Privacy policy text */
#payment .place-order .woocommerce-privacy-policy-text {
  font-size: 13px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 20px;
  padding: 0 5px;
}

#payment .place-order .woocommerce-privacy-policy-text p {
  margin: 0;
}

#payment .place-order .woocommerce-privacy-policy-text a {
  color: #007cba;
  text-decoration: none;
}

#payment .place-order .woocommerce-privacy-policy-text a:hover {
  text-decoration: underline;
}

/* Place Order Button */
#payment .place-order #place_order {
  width: 100%;
  padding: 20px 30px;
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border-radius: 8px;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #28a745 0%, #20913b 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  min-height: 60px;
  text-align: center;
}

#payment .place-order #place_order:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
  background: linear-gradient(135deg, #2dba4e 0%, #28a745 100%);
}

#payment .place-order #place_order:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(40, 167, 69, 0.3);
}

/* Disable place order button until terms checkbox is checked */
#payment .place-order:has(.woocommerce-form__input-checkbox:not(:checked)) #place_order {
  background: #ccc;
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.6;
}

#payment .place-order:has(.woocommerce-form__input-checkbox:not(:checked)) #place_order:hover {
  transform: none;
  box-shadow: none;
}

/* ==========================================================================
   CHECKOUT FORM SECTIONS
   ========================================================================== */

.woocommerce-billing-fields,
.woocommerce-shipping-fields,
.woocommerce-additional-fields {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 25px;
}

.woocommerce-billing-fields h3,
.woocommerce-shipping-fields h3,
.woocommerce-additional-fields h3 {
  font-size: 18px;
  margin: 0 0 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e5e5e5;
}

.woocommerce-billing-fields .form-row,
.woocommerce-shipping-fields .form-row,
.woocommerce-additional-fields .form-row {
  margin-bottom: 15px;
}

.woocommerce-billing-fields .form-row label,
.woocommerce-shipping-fields .form-row label,
.woocommerce-additional-fields .form-row label {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 6px;
  display: block;
}

.woocommerce-billing-fields .form-row input,
.woocommerce-billing-fields .form-row select,
.woocommerce-shipping-fields .form-row input,
.woocommerce-shipping-fields .form-row select,
.woocommerce-additional-fields .form-row input,
.woocommerce-additional-fields .form-row select,
.woocommerce-additional-fields .form-row textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.woocommerce-billing-fields .form-row input:focus,
.woocommerce-billing-fields .form-row select:focus,
.woocommerce-shipping-fields .form-row input:focus,
.woocommerce-shipping-fields .form-row select:focus,
.woocommerce-additional-fields .form-row input:focus,
.woocommerce-additional-fields .form-row select:focus,
.woocommerce-additional-fields .form-row textarea:focus {
  border-color: #007cba;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

/* Coupon/discount toggle - transparent background */
.woocommerce-form-coupon-toggle {
  background: transparent;
  border: none;
  border-radius: 0;
  margin-bottom: 15px;
}

.woocommerce-form-coupon-toggle .woocommerce-info {
  margin: 0;
  padding: 12px 15px;
  background: #f8f9fa;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
}

/* Notification/info messages - transparent */
.woocommerce-checkout .woocommerce-info,
.woocommerce-checkout .woocommerce-message,
.woocommerce-checkout .woocommerce-error {
  background: #f8f9fa;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  margin-bottom: 15px;
}

/* Coupon form when expanded */
.checkout_coupon {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 25px;
}

.checkout_coupon .form-row-first {
  width: 70%;
  float: left;
}

.checkout_coupon .form-row-last {
  width: 28%;
  float: right;
}

.checkout_coupon::after {
  content: "";
  display: table;
  clear: both;
}

/* Order notes section - Bemærkninger til ordren */
.woocommerce-additional-fields {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 25px;
}

.woocommerce-additional-fields h3,
.woocommerce-additional-fields__field-wrapper > h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 20px 0;
  padding: 0 0 15px 0;
  border-bottom: 1px solid #e5e5e5;
}

.woocommerce-additional-fields #order_comments_field {
  margin-bottom: 0;
}

#order_comments_field > label,
.woocommerce-additional-fields #order_comments_field label {
  display: block;
  font-size: 15px;
  font-weight: inherit;
  color: inherit;
  margin: 0 0 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e5e5e5;
}

#order_comments_field > label .optional,
.woocommerce-additional-fields #order_comments_field label .optional {
  display: none !important;
}

.woocommerce-additional-fields #order_comments {
  width: 100%;
  min-height: 100px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
  background-color: #f8f9fa;
  resize: vertical;
  margin-bottom: 0;
}

.woocommerce-additional-fields #order_comments:focus {
  outline: none;
  border-color: #007cba;
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.woocommerce-additional-fields #order_comments::placeholder {
  color: #999;
}

/* Hide country selector - only delivering to Denmark */
#billing_country_field,
#shipping_country_field,
.woocommerce-billing-fields #billing_country_field,
.woocommerce-shipping-fields #shipping_country_field {
  display: none !important;
}

/* Fix form row float */
.woocommerce form .form-row,
.woocommerce-page .form-row,
.woocommerce-checkout .form-row {
  float: none;
}

/* Two-column layout for name and city/zip fields on desktop */
.woocommerce-billing-fields__field-wrapper,
.woocommerce-shipping-fields__field-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.woocommerce-billing-fields__field-wrapper .form-row,
.woocommerce-shipping-fields__field-wrapper .form-row {
  flex: 1 1 100%;
  margin-bottom: 0;
}

/* First name and last name - 2 columns */
#billing_first_name_field,
#billing_last_name_field,
#shipping_first_name_field,
#shipping_last_name_field {
  flex: 1 1 calc(50% - 8px);
  min-width: 0;
}

/* City and postcode - 2 columns */
#billing_city_field,
#billing_postcode_field,
#shipping_city_field,
#shipping_postcode_field {
  flex: 1 1 calc(50% - 8px);
  min-width: 0;
}

/* Phone and email - 2 columns */
#billing_phone_field,
#billing_email_field {
  flex: 1 1 calc(50% - 8px);
  min-width: 0;
}

/* Ensure inputs fill their containers */
.woocommerce-billing-fields__field-wrapper .form-row input,
.woocommerce-billing-fields__field-wrapper .form-row select,
.woocommerce-shipping-fields__field-wrapper .form-row input,
.woocommerce-shipping-fields__field-wrapper .form-row select {
  width: 100% !important;
  box-sizing: border-box;
}

/* Ship to different address - Send til anden adresse */
.woocommerce-shipping-fields #ship-to-different-address {
  font-size: 18px;
  border-bottom: none;
}

.woocommerce-shipping-fields h3#ship-to-different-address {
  font-size: 15px !important;
  margin: 0 !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  line-height: 1 !important;
  min-height: 0 !important;
  border-bottom: none !important;
}

.woocommerce-shipping-fields #ship-to-different-address label,
.woocommerce-shipping-fields h3#ship-to-different-address label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: inherit;
  font-weight: inherit;
  margin: 0;
  padding: 0;
}

.woocommerce-shipping-fields #ship-to-different-address input[type="checkbox"],
.woocommerce-shipping-fields h3#ship-to-different-address input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
}

/* Remove border on shipping fields unless checkbox is checked */
.woocommerce-shipping-fields {
  border-bottom: none;
  padding-bottom: 25px;
  margin-bottom: 25px;
}

.shipping_address {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e5e5e5;
}

/* ==========================================================================
   CHECKOUT LAYOUT - DESKTOP COLUMNS
   ========================================================================== */

/* Add natural spacing between left and right columns */
form.checkout > .row,
.woocommerce-checkout form.checkout > .row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 40px !important;
}

form.checkout > .row > .thb-checkout-form-column,
form.checkout > .row > .small-12.medium-7.columns {
  flex: 1 1 55% !important;
  min-width: 0 !important;
  padding-right: 0 !important;
  float: none !important;
}

form.checkout > .row > .small-12.medium-5.columns {
  flex: 1 1 40% !important;
  min-width: 0 !important;
  padding-left: 0 !important;
  float: none !important;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS
   ========================================================================== */

@media (max-width: 768px) {
  /* Stack checkout columns */
  .woocommerce-checkout .col2-set {
    display: block;
  }

  .woocommerce-checkout .col2-set .col-1,
  .woocommerce-checkout .col2-set .col-2 {
    width: 100%;
    float: none;
    margin-bottom: 15px;
  }

  /* Main checkout layout - only target checkout content, not header */
  .woocommerce-checkout #content .row,
  .woocommerce-checkout .woocommerce > .row,
  .woocommerce-checkout form.checkout .row {
    display: block;
    margin-left: 0;
    margin-right: 0;
  }

  .woocommerce-checkout .thb-checkout-form-column,
  .woocommerce-checkout .small-12.medium-7.columns,
  .woocommerce-checkout .small-12.medium-5.columns {
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-bottom: 15px;
  }

  /* Container padding on mobile */
  .woocommerce-billing-fields,
  .woocommerce-shipping-fields,
  .woocommerce-additional-fields,
  .woocommerce-checkout .woocommerce-checkout-review-order {
    padding: 20px !important;
    margin-bottom: 15px;
    border-radius: 8px;
    box-sizing: border-box;
  }

  /* Form wrapper padding */
  .woocommerce-billing-fields__field-wrapper,
  .woocommerce-shipping-fields__field-wrapper,
  .woocommerce-additional-fields__field-wrapper {
    padding: 0;
  }

  .woocommerce-billing-fields h3,
  .woocommerce-shipping-fields h3,
  .woocommerce-additional-fields h3 {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 12px;
  }

  /* Ship to different address mobile */
  .woocommerce-shipping-fields h3#ship-to-different-address {
    font-size: 16px;
    min-height: 40px;
  }

  .woocommerce-shipping-fields h3#ship-to-different-address label {
    font-size: 15px;
  }

  .woocommerce-shipping-fields {
    padding-bottom: 15px;
    margin-bottom: 15px;
  }

  /* Full width inputs with proper sizing */
  .woocommerce-billing-fields .form-row,
  .woocommerce-shipping-fields .form-row,
  .woocommerce-additional-fields .form-row,
  .woocommerce-checkout .form-row {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    margin-bottom: 15px !important;
    padding: 0 !important;
    box-sizing: border-box;
  }

  /* Stack two-column fields on mobile */
  #billing_first_name_field,
  #billing_last_name_field,
  #shipping_first_name_field,
  #shipping_last_name_field,
  #billing_city_field,
  #billing_postcode_field,
  #shipping_city_field,
  #shipping_postcode_field,
  #billing_phone_field,
  #billing_email_field {
    flex: 1 1 100% !important;
  }

  .woocommerce-billing-fields .form-row input,
  .woocommerce-billing-fields .form-row select,
  .woocommerce-shipping-fields .form-row input,
  .woocommerce-shipping-fields .form-row select,
  .woocommerce-additional-fields .form-row input,
  .woocommerce-additional-fields .form-row select,
  .woocommerce-additional-fields .form-row textarea,
  .woocommerce-checkout .form-row input:not([type="radio"]):not([type="checkbox"]),
  .woocommerce-checkout .form-row select,
  .woocommerce-checkout .form-row textarea {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 16px;
    padding: 14px;
    box-sizing: border-box;
  }

  /* Order review heading mobile */
  #order_review #order_review_heading {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 12px;
  }

  /* Order review table mobile adjustments */
  .shop_table.woocommerce-checkout-review-order-table tbody tr,
  .shop_table.woocommerce-checkout-review-order-table tfoot tr {
    padding: 10px 0 !important;
  }

  .shop_table.woocommerce-checkout-review-order-table tbody td,
  .shop_table.woocommerce-checkout-review-order-table tfoot td,
  .shop_table.woocommerce-checkout-review-order-table tfoot th {
    font-size: 14px !important;
  }

  .shop_table.woocommerce-checkout-review-order-table tbody td.product-name {
    flex: 1 1 55% !important;
  }

  .shop_table.woocommerce-checkout-review-order-table tfoot tr.order-total td {
    font-size: 18px !important;
  }

  /* Payment methods mobile */
  #payment {
    border-radius: 8px;
  }

  #payment .wc_payment_method > label {
    padding: 15px;
    padding-left: 50px;
    font-size: 14px;
    flex-wrap: wrap;
  }

  #payment .wc_payment_method.payment_method_selected > label,
  #payment .wc_payment_method:has(input:checked) > label {
    padding-left: 46px;
  }

  #payment .wc_payment_method > label::before {
    left: 15px;
    width: 22px;
    height: 22px;
  }

  #payment .wc_payment_method.payment_method_selected > label::after,
  #payment .wc_payment_method:has(input:checked) > label::after {
    left: 22px;
    width: 5px;
    height: 10px;
  }

  #payment .wc_payment_method label img,
  #payment .wc_payment_method label .reepay-logos {
    max-height: none;
    margin-left: 0;
    margin-top: 8px;
    width: 100%;
    flex-basis: 100%;
  }

  #payment .reepay-logos,
  #payment .payment_methods li label .reepay-logos {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  #payment .reepay-logos li {
    margin: 0 !important;
    padding: 0 !important;
  }

  #payment .reepay-logos li img {
    max-height: 20px;
    width: auto;
    padding: 0 !important;
  }

  #payment .payment_methods li label .reepay-logos .reepay-logo img {
    margin-left: 0 !important;
    margin-right: 3px !important;
  }

  #payment .place-order {
    padding: 15px;
  }

  #payment .place-order .woocommerce-terms-and-conditions-wrapper .woocommerce-form__label-for-checkbox {
    padding: 15px;
    gap: 10px;
  }

  #payment .place-order .woocommerce-terms-and-conditions-wrapper .woocommerce-form__label-for-checkbox input.woocommerce-form__input-checkbox[type="checkbox"] {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    flex-shrink: 0 !important;
    border: 2px solid #ccc !important;
    border-radius: 4px !important;
    background: #fff !important;
    cursor: pointer !important;
    margin: 0 !important;
    position: relative !important;
  }

  #payment .place-order .woocommerce-terms-and-conditions-wrapper .woocommerce-form__label-for-checkbox input.woocommerce-form__input-checkbox[type="checkbox"]:checked {
    background: #007cba !important;
    border-color: #007cba !important;
  }

  #payment .place-order .woocommerce-terms-and-conditions-wrapper .woocommerce-form__label-for-checkbox input.woocommerce-form__input-checkbox[type="checkbox"]:checked::after {
    content: "" !important;
    position: absolute !important;
    left: 6px !important;
    top: 2px !important;
    width: 6px !important;
    height: 12px !important;
    border: solid #fff !important;
    border-width: 0 2px 2px 0 !important;
    transform: rotate(45deg) !important;
  }

  #payment .place-order .woocommerce-terms-and-conditions-wrapper .woocommerce-form__label-for-checkbox span {
    font-size: 13px;
  }

  #payment .place-order #place_order {
    padding: 16px 24px;
    font-size: 15px;
    min-height: 54px;
  }

  /* Shipping methods mobile */
  .woocommerce-shipping-methods li input[type="radio"] + label {
    display: block;
  }

  .woocommerce-shipping-methods li label {
    padding: 12px 15px;
    padding-left: 45px;
    font-size: 14px;
    align-items: flex-start;
    text-align: right;
  }

  .woocommerce-shipping-methods li label::before {
    left: 12px;
    top: 14px;
    transform: none;
    width: 20px;
    height: 20px;
  }

  .woocommerce-shipping-methods li:has(input:checked) label {
    padding-left: 42px;
  }

  .woocommerce-shipping-methods li:has(input:checked) label::before {
    left: 9px;
    top: 14px;
    transform: none;
  }

  .woocommerce-shipping-methods li:has(input:checked) label::after {
    left: 16px;
    top: 18px;
    transform: rotate(45deg);
    width: 4px;
    height: 9px;
    margin-top: 0;
  }

  /* Shipping description mobile */
  .woocommerce-shipping-methods li label p,
  .woocommerce-shipping-methods li label .description,
  #okoskabet-shipping .description {
    font-size: 12px !important;
    padding: 8px 10px !important;
    margin-top: 8px !important;
  }

  /* Økoskabet plugin mobile */
  #okoskabet-shipping select {
    font-size: 16px !important;
    padding: 12px !important;
    padding-right: 35px !important;
  }

  #okoskabet-shipping label {
    font-size: 11px !important;
    margin-top: 10px !important;
    margin-bottom: 5px !important;
  }

  /* Økoskabet map mobile */
  .map-wrap {
    height: 250px !important;
  }

  /* Subscription toggle mobile */
  .thb-subscription-toggle label {
    padding: 12px 15px;
    gap: 10px;
  }

  .thb-subscription-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
  }

  .thb-subscription-toggle .thb-toggle-text {
    font-size: 14px;
  }

  .thb-subscription-options {
    padding: 15px;
  }

  .thb-subscription-frequency select {
    font-size: 16px !important;
    padding: 12px !important;
  }

  /* Coupon mobile */
  .checkout_coupon .form-row-first,
  .checkout_coupon .form-row-last {
    width: 100%;
    float: none;
    margin-bottom: 10px;
  }

  .checkout_coupon .form-row-last button {
    width: 100%;
  }

  /* Order notes mobile */
  .woocommerce-additional-fields #order_comments {
    min-height: 80px;
    font-size: 16px;
  }

  /* Gift card row mobile */
  .avo-gift-card-checkout-row th {
    vertical-align: top !important;
  }

  .avo-gift-card-checkout-row td,
  .avo-gift-card-input {
    display: block !important;
  }

  .avo-gift-card-checkout-row td input,
  .avo-gift-card-input input {
    width: 100% !important;
    margin-bottom: 8px !important;
  }

  .avo-gift-card-checkout-row td button,
  .avo-gift-card-input button {
    width: 100% !important;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  /* Maintain padding inside containers */
  .woocommerce-billing-fields,
  .woocommerce-shipping-fields,
  .woocommerce-additional-fields,
  .woocommerce-checkout .woocommerce-checkout-review-order,
  #payment {
    padding: 15px !important;
    margin-bottom: 10px;
  }

  #payment .place-order #place_order {
    font-size: 14px;
    letter-spacing: 0.5px;
  }

  /* Økoskabet map extra small */
  .map-wrap {
    height: 220px !important;
  }

  .woocommerce-billing-fields h3,
  .woocommerce-shipping-fields h3,
  .woocommerce-additional-fields h3,
  #order_review #order_review_heading {
    font-size: 15px;
  }

  /* Ensure inputs don't overflow - exclude radio and checkbox */
  .woocommerce-checkout input[type="text"],
  .woocommerce-checkout input[type="email"],
  .woocommerce-checkout input[type="tel"],
  .woocommerce-checkout input[type="number"],
  .woocommerce-checkout input[type="password"],
  .woocommerce-checkout select,
  .woocommerce-checkout textarea {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}
