/* Checkout / cart UX */

.tmo-toast-host {
  position: fixed;
  z-index: 100000;
  right: 1rem;
  bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 2rem));
}

.tmo-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  background: #0f2744;
  color: #fff;
  padding: 1rem 1.1rem;
  font-size: .95rem;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 16px 40px rgba(15, 39, 68, .28);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease;
  border-left: 4px solid #7eb8a8;
}

.tmo-toast.is-in { opacity: 1; transform: translateY(0); }
.tmo-toast.is-out { opacity: 0; transform: translateY(8px); }
.tmo-toast--success { background: #1f4f46; border-left-color: #7eb8a8; }
.tmo-toast--error { background: #4a1d1d; border-left-color: #e8a0a0; }
.tmo-toast--info { background: #1c3350; border-left-color: #c4a574; }

.tmo-toast__icon {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: .1rem;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  position: relative;
}
.tmo-toast--error .tmo-toast__icon::before,
.tmo-toast--error .tmo-toast__icon::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 2px; height: .55rem;
  background: #fff;
  transform: translate(-50%, -50%) rotate(45deg);
}
.tmo-toast--error .tmo-toast__icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}
.tmo-toast--success .tmo-toast__icon::before {
  content: "";
  position: absolute;
  left: .28rem; top: .22rem;
  width: .28rem; height: .5rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.tmo-toast__text { flex: 1 1 auto; }
.tmo-toast__close {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.75);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 .15rem;
}
.tmo-toast__close:hover { color: #fff; }

.tmo-variation-hint {
  display: none;
  margin: .65rem 0 1rem;
  padding: .75rem .9rem;
  background: #fdf2f2;
  color: #9b2c2c;
  border-left: 3px solid #c75b5b;
  font-size: .9rem;
  font-weight: 600;
}
.tmo-variation-hint.is-visible { display: block; }
.tmo-variations-need-selection {
  outline: 2px solid #c75b5b;
  outline-offset: 4px;
  animation: tmo-pulse-border .9s ease 2;
}
@keyframes tmo-pulse-border {
  0%, 100% { outline-color: #c75b5b; }
  50% { outline-color: rgba(199, 91, 91, .35); }
}

.tmo-spinner {
  display: inline-block;
  width: .9rem;
  height: .9rem;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: tmo-spin .7s linear infinite;
}

@keyframes tmo-spin { to { transform: rotate(360deg); } }

.tmo-is-loading { opacity: .92; cursor: wait !important; }
.single_add_to_cart_button.tmo-is-loading::after,
.add_to_cart_button.tmo-is-loading::after {
  content: "";
  display: inline-block;
  width: .85rem;
  height: .85rem;
  margin-left: .45rem;
  border: 2px solid rgba(15, 39, 68, .25);
  border-top-color: #0f2744;
  border-radius: 50%;
  vertical-align: -2px;
  animation: tmo-spin .7s linear infinite;
}

/* Field states */
.woocommerce form .form-row.tmo-has-error input,
.woocommerce form .form-row.tmo-has-error select,
.woocommerce form .form-row.tmo-has-error textarea,
.woocommerce-invalid input {
  border-color: #b42318 !important;
  box-shadow: 0 0 0 1px rgba(180, 35, 24, .15);
}

.woocommerce form .form-row.tmo-is-valid input {
  border-color: #4f8f82 !important;
}

.tmo-field-error {
  display: block;
  margin-top: .35rem;
  color: #9b2c2c;
  font-size: .82rem;
  font-weight: 500;
  line-height: 1.35;
}

.tmo-addr2-toggle {
  display: inline-block;
  margin: 0 0 .75rem;
  padding: 0;
  border: 0;
  background: none;
  color: #4f8f82;
  font: inherit;
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tmo-address-2.is-collapsed,
#billing_address_2_field.is-collapsed,
#shipping_address_2_field.is-collapsed {
  display: none !important;
}

/* Checkout layout */
body.tmo-checkout-ux .woocommerce {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1rem 6.5rem;
}

body.tmo-checkout-ux .woocommerce-billing-fields h3,
body.tmo-checkout-ux .woocommerce-shipping-fields h3,
body.tmo-checkout-ux #order_review_heading {
  font-size: 1.15rem;
  letter-spacing: -.01em;
  margin-bottom: 1rem;
  text-transform: none !important;
}

body.tmo-checkout-ux .woocommerce form .form-row {
  margin-bottom: .85rem;
  padding: 0;
  float: none !important;
  clear: both !important;
  width: 100% !important;
}

/* Kill ShopEngine/Woo half-width collapse on first/last name */
body.tmo-checkout-ux #billing_first_name_field,
body.tmo-checkout-ux #billing_last_name_field,
body.tmo-checkout-ux #shipping_first_name_field,
body.tmo-checkout-ux #shipping_last_name_field,
body.tmo-checkout-ux .shopengine-checkout-form-billing #billing_first_name_field,
body.tmo-checkout-ux .shopengine-checkout-form-billing #billing_last_name_field {
  flex: 1 1 100% !important;
  float: none !important;
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

body.tmo-checkout-ux .woocommerce form .form-row label {
  display: block !important;
  float: none !important;
  width: auto !important;
  margin: 0 0 .35rem !important;
  text-align: left !important;
  text-transform: none !important;
}

body.tmo-checkout-ux .woocommerce form .form-row .woocommerce-input-wrapper {
  display: block !important;
  width: 100% !important;
  float: none !important;
}

body.tmo-checkout-ux .woocommerce form .form-row input.input-text,
body.tmo-checkout-ux .woocommerce form .form-row textarea,
body.tmo-checkout-ux .woocommerce form .form-row select {
  border: 1px solid #d7e0ea !important;
  border-radius: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 2.85rem !important;
  padding: .65rem .8rem !important;
  font-size: 1rem !important;
  box-sizing: border-box !important;
}

/* Order review: thumbnail + name/qty alignment */
body.tmo-checkout-ux .shopengine-order-review-product .product-name,
body.tmo-checkout-ux .woocommerce-checkout-review-order-table td.product-name {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .65rem;
  vertical-align: middle;
}

body.tmo-checkout-ux .shopengine-order-review-product .product-name > img,
body.tmo-checkout-ux .woocommerce-checkout-review-order-table .product-name > img {
  flex: 0 0 56px;
  width: 56px !important;
  height: 56px !important;
  max-width: 56px !important;
  object-fit: cover;
  margin: 0 !important;
}

body.tmo-checkout-ux .shopengine-order-review-product .product-name > a {
  font-weight: 600;
  color: #0f2744;
  line-height: 1.3;
  text-transform: none !important;
}

body.tmo-checkout-ux .tmo-review-qty,
body.tmo-checkout-ux .shopengine-order-review-product .product-quantity,
body.tmo-checkout-ux .woocommerce-checkout-review-order-table .product-quantity {
  display: inline-flex !important;
  align-items: center;
  margin: 0 !important;
  padding: .15rem .5rem !important;
  width: auto !important;
  float: none !important;
  background: #eef3f6;
  color: #0f2744 !important;
  font-size: .78rem !important;
  font-weight: 700 !important;
  line-height: 1.3;
  white-space: nowrap;
}

body.tmo-checkout-ux .shopengine-order-review-product .product-name .variation {
  flex: 1 0 100%;
  margin: 0 0 0 calc(56px + .65rem);
  font-size: .75rem;
  color: #5b6b7c;
}

body.tmo-checkout-ux .woocommerce-NoticeGroup {
  margin-bottom: 1rem;
}

body.tmo-checkout-ux #place_order,
body.tmo-cart-ux .checkout-button {
  background: #4f8f82 !important;
  color: #0f2744 !important;
  font-weight: 700 !important;
  border-radius: 0 !important;
  min-height: 3.1rem;
  font-size: 1rem !important;
}

/* Sticky mobile Place Order */
@media (max-width: 768px) {
  body.tmo-checkout-ux .woocommerce-checkout #payment {
    position: relative;
  }

  body.tmo-checkout-ux #place_order {
    position: sticky;
    bottom: 0;
    z-index: 30;
    width: 100% !important;
    margin: 0 !important;
    box-shadow: 0 -8px 24px rgba(15, 39, 68, .12);
  }

  body.tmo-checkout-ux .form-row-first,
  body.tmo-checkout-ux .form-row-last {
    float: none !important;
    width: 100% !important;
  }

  body.tmo-checkout-ux .woocommerce {
    padding-bottom: 5.5rem;
  }

  .tmo-toast-host {
    left: 1rem;
    right: 1rem;
    bottom: 5.25rem;
    max-width: none;
  }
}

/* Cart cleanup — do not fight the viewport cart layout */
body.tmo-cart-ux .cart-collaterals .cart_totals {
  float: none;
  width: 100%;
}
