/* UPS Shipping Methods - Cart & Checkout Styles */
/* Targeting actual WooCommerce HTML structure - NO <p> tags, just input+label */

/* ── Commercial address: company field highlight ──────────────────────── */
.ups-commercial-required input[type="text"] {
  border-color: #B7791F !important;
  box-shadow: 0 0 0 2px rgba(183, 121, 31, 0.2) !important;
  background-color: #FFFFF5 !important;
}
.ups-commercial-required label::after {
  content: " *";
  color: #B7791F;
  font-weight: 700;
}

/* PlaceAutocompleteElement — match WooCommerce input styling */
gmp-place-autocomplete.ups-place-ac {
  display: block;
  width: 100%;
  --gmp-input-border-radius: 0;
  --gmp-input-border: 1px solid #ccc;
  --gmp-input-padding: 6px 10px;
  --gmp-input-font-size: 14px;
  --gmp-input-background-color: #fff;
  --gmp-input-color: #43454b;
  --gmp-input-placeholder-color: #888;
  --gmp-input-height: 38px;
}

/* Legacy fallback: pac-container z-index (if old Autocomplete ever used) */
.pac-container {
  z-index: 99999 !important;
}

/* ── PO/APO notice under Street Address field ──────────────────────── */
#billing_address_1_field  .woocommerce-input-wrapper::after,
#shipping_address_1_field .woocommerce-input-wrapper::after {
  content: "We don\2019t ship to PO / APO addresses";
  display: block;
  margin-top: 8px;
  padding: 7px 14px;
  border: 1.5px solid #DA291C;   /* Pantone 485 C */
  border-radius: 4px;
  background: #fff5f5;
  color: #DA291C;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

/* ── Address type badge in checkout order review table ─────────────── */
.ups-addr-type-row td {
  padding-top: 4px !important;
  padding-bottom: 8px !important;
  border: none !important;
}

.ups-addr-type {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.ups-addr-type--residential {
  background: #ebf8ff;
  color: #1a365d;
  border: 1px solid #90cdf4;
}

.ups-addr-type--commercial {
  background: #f7fafc;
  color: #4a5568;
  border: 1px solid #cbd5e0;
}

.ups-addr-type--unconfirmed {
  background: #fffff0;
  color: #744210;
  border: 1px solid #f6e05e;
}

/* Shared Cart and Checkout shipping-rate cards. */
body #shipping_method {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

body #shipping_method ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

body #shipping_method li {
  align-items: center;
  background: #fff;
  border: 1px solid #d7e0ea;
  border-radius: 6px;
  box-sizing: border-box;
  color: #0a192f;
  display: flex;
  gap: 12px;
  margin: 0;
  min-height: 66px;
  padding: 14px 16px;
  width: 100%;
}

body #shipping_method li:has(input.shipping_method:checked) {
  background: #f5f8ff;
  border-color: #075ff7;
}

body #shipping_method input.shipping_method[type="radio"] {
  accent-color: #075ff7;
  appearance: auto;
  display: inline-block;
  flex: 0 0 16px;
  height: 16px;
  margin: 0;
  opacity: 1;
  pointer-events: auto;
  position: static;
  width: 16px;
}

body #shipping_method input.shipping_method + label,
body #shipping_method input.shipping_method + label:hover,
body #shipping_method input.shipping_method:checked + label {
  align-items: start;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: #0a192f;
  cursor: pointer;
  display: grid;
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  margin: 0;
  padding: 0;
  position: static;
  text-align: left;
  width: 100%;
}

body #shipping_method input.shipping_method:checked + label::before {
  content: none;
}

body #shipping_method label > .woocommerce-Price-amount {
  align-self: start;
  color: #0a192f;
  font-size: 14px;
  font-weight: 800;
  grid-column: 2;
  grid-row: 1;
  margin: 0 0 0 16px;
  text-align: right;
  white-space: nowrap;
}

body #shipping_method label > .ups-eta-inline {
  display: block;
  grid-column: 1;
  grid-row: 2;
  margin: 3px 0 0;
  text-align: left;
}

body #shipping_method label > .ups-eta-inline small {
  color: #64748b;
  display: block;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.3;
}

body #shipping_method label > .ups-eta-inline strong {
  color: inherit;
  font-weight: 500;
}

/* Legacy .ups-eta support (if still used somewhere) */
body .ups-eta {
  display: none ;
}

/* Place Order button spinner (checkout only) */
body .woocommerce-checkout button[type="submit"].loading,
body .woocommerce-checkout button[type="submit"].is-loading {
  color: transparent ;
  pointer-events: none ;
  position: relative ;
}

body .woocommerce-checkout button[type="submit"].loading::after,
body .woocommerce-checkout button[type="submit"].is-loading::after {
  content: '' ;
  position: absolute ;
  width: 16px ;
  height: 16px ;
  top: 50% ;
  left: 50% ;
  margin-left: 31px ;
  margin-top: -8px ;
  border: 2px solid #fff ;
  border-radius: 50% ;
  border-top-color: transparent ;
  animation: ups-spinner 0.6s linear infinite ;
}

@keyframes ups-spinner {
  to { transform: rotate(360deg); }
}

/* Cart totals section */
body .cart_totals .shipping {
  padding: 16px ;
  #background: #fff ;
  #border: 1px solid #ddd ;
  border-radius: 12px ;
  margin-bottom: 16px ;
}

/* Shipping calculator form */
body .shipping-calculator-form {
  padding: 16px ;
  background: #fff ;
  border: 1px solid #ddd ;
  border-radius: 12px ;
  margin-top: 16px ;
}

body .shipping-calculator-form .form-row {
  margin-bottom: 12px ;
}

body .shipping-calculator-form input[type="text"],
body .shipping-calculator-form select {
  height: 40px ;
  padding: 0 12px ;
  border-radius: 8px ;
  border: 1px solid #ddd ;
  font-size: 14px ;
  transition: border-color 0.2s ;
}

body .shipping-calculator-form input[type="text"]:focus,
body .shipping-calculator-form select:focus {
  outline: none ;
  border-color: #999 ;
}

body .shipping-calculator-form button {
  height: 40px ;
  padding: 0 20px ;
  border-radius: 8px ;
  border: 1px solid #333 ;
  background: #333 ;
  color: #fff ;
  font-weight: 600 ;
  font-size: 14px ;
  cursor: pointer ;
  transition: all 0.2s ;
}

body .shipping-calculator-form button:hover {
  background: #555 ;
  border-color: #555 ;
}

/* ── Checkout "Calculate Shipping" button ────────────────────────── */
.ups-checkout-calc-row td {
  padding: 0 0 12px !important;
  border: none !important;
}

.ups-checkout-calc-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ups-checkout-calc-btn {
  display: inline-block;
  height: 40px;
  padding: 0 20px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #333;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  align-self: flex-start;
}

.ups-checkout-calc-btn:hover {
  background: #555;
  border-color: #555;
}

.ups-checkout-calc-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ups-checkout-calc-note {
  font-size: 13px;
  color: #888;
  margin: 0;
}

/* ── "Detecting best shipping cost…" banner ─────────────────────── */
#ups-detecting-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  border: 2px solid #00A651;
  border-radius: 8px;
  background: #f0faf4;
  color: #1a5c35;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.ups-detecting-spinner {
  display: inline-block;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 2px solid #00A651;
  border-top-color: transparent;
  border-radius: 50%;
  animation: ups-spinner 0.7s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
  body .woocommerce-shipping-totals #shipping_method > p,
  body tr.shipping td #shipping_method > p {
    padding: 12px 14px ;
  }
  
  body .woocommerce-shipping-totals #shipping_method label,
  body tr.shipping td #shipping_method label {
    font-size: 13px ;
  }
}

/* ── SES/MetaMask notice (address autocomplete unavailable) ─────────────── */
.ups-ac-ses-notice {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin-top: 6px;
    padding: 8px 12px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 4px;
    font-size: 12px;
    color: #7a6000;
    line-height: 1.5;
}
.ups-ac-ses-notice svg { color: #f59e0b; margin-top: 1px; }
