/* ==========================================================================
   NICO Pharma — Checkout & order confirmation
   Loaded only on cart / checkout / order-received / account pages.
   Tokens come from theme.css (:root); nothing is redefined here.
   1. Checkout form: steps, rail, assurances
   2. Checkout review table
   3. Order received: hero + progress tracker
   4. Order received: meta strip + actions
   5. Order summary card + line items
   6. Address cards + help strip
   7. Responsive
   8. Print
   ========================================================================== */

/* ------------------------------------------------ 1. checkout form: steps */
.checkout-step-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.checkout-step-num {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.checkout-step-title {
  font-size: 19px;
  margin: 0 0 2px;
  line-height: 1.3;
}
.checkout-step-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

/* Core prints its own headings inside these blocks; the step head replaces
   them. The shipping toggle heading stays — it holds the checkbox. */
.nico-checkout .woocommerce-billing-fields > h3,
.nico-checkout .woocommerce-additional-fields > h3 { display: none; }

.nico-checkout .woocommerce-shipping-fields > h3#ship-to-different-address {
  font-size: 15px;
  margin: 0 0 14px;
}
.nico-checkout #ship-to-different-address label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  margin: 0;
}
.nico-checkout #ship-to-different-address input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}
.nico-checkout .woocommerce-additional-fields { margin-top: 6px; }

.nico-checkout .form-row label .required {
  color: var(--danger);
  text-decoration: none;
  border: 0;
}
.nico-checkout .input-text::placeholder { color: #a9b5b9; }
.nico-checkout .select2-container--default .select2-selection--single {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  height: 46px;
  padding: 7px 6px;
}
.nico-checkout .select2-container--default .select2-selection--single .select2-selection__arrow { height: 44px; }

/* The rail sticks alongside the fields on desktop. */
.checkout-rail { position: sticky; top: 24px; }
.checkout-review {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px;
  background: #fff;
}
.checkout-review .checkout-step-head { margin-bottom: 18px; }

.checkout-assurances {
  list-style: none;
  margin: 18px 0 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.checkout-assurances li {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 12.8px;
  line-height: 1.6;
  color: var(--body);
}
.checkout-assurances li + li { margin-top: 12px; }
.checkout-assurances i { color: var(--primary); margin-top: 3px; flex: 0 0 16px; }

.checkout-help {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--body);
}
.checkout-help i { color: #25d366; font-size: 16px; }
.checkout-help a { font-weight: 600; }

/* --------------------------------------------- 2. checkout review table */
.checkout-review .woocommerce-checkout-review-order .nico-review-table {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  border-collapse: collapse;
}
.checkout-review .woocommerce-checkout-review-order .nico-review-table thead th {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.checkout-review .woocommerce-checkout-review-order .nico-review-table thead th:last-child { text-align: right; }
.checkout-review .woocommerce-checkout-review-order .nico-review-table tbody td {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 14px;
}
.checkout-review .woocommerce-checkout-review-order .nico-review-table tbody td.product-total { text-align: right; white-space: nowrap; color: var(--ink); font-weight: 600; }

.review-item { display: flex; align-items: center; gap: 13px; }
.review-item-media { position: relative; flex: 0 0 auto; }
.review-item-media img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  display: block;
}
.review-item-qty {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 21px;
  text-align: center;
}
.review-item-title {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.45;
}
.review-item-body .variation,
.review-item-body dl {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}
.review-item-body dl dt, .review-item-body dl dd { display: inline; margin: 0; }
.review-item-body dl dd + dt::before { content: " · "; }

.checkout-review .woocommerce-checkout-review-order .nico-review-table tfoot th,
.checkout-review .woocommerce-checkout-review-order .nico-review-table tfoot td {
  padding: 11px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.checkout-review .woocommerce-checkout-review-order .nico-review-table tfoot th { font-family: var(--font-body); font-weight: 500; color: var(--body); }
.checkout-review .woocommerce-checkout-review-order .nico-review-table tfoot td { text-align: right; color: var(--ink); font-weight: 600; }
.checkout-review .woocommerce-checkout-review-order .nico-review-table tfoot .order-total th,
.checkout-review .woocommerce-checkout-review-order .nico-review-table tfoot .order-total td {
  border-bottom: 0;
  padding-top: 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
}
.checkout-review .woocommerce-checkout-review-order .nico-review-table .woocommerce-shipping-methods { text-align: right; }

/* ------------------------------------- 3. order received: hero + tracker */
/* page.php prints the page title ("Order received"); the hero heading below
   replaces it, so the duplicate is suppressed on this endpoint only. */
.woocommerce-order-received .page-intro,
.nico-order-received-page .page-intro { display: none; }

.nico-order-received { max-width: 940px; margin: 0 auto; }

.order-hero { text-align: center; padding: 8px 0 34px; }
.order-hero-icon {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  animation: nico-pop .45s var(--ease) both;
}
.order-hero-icon.is-danger { background: #fdecee; color: var(--danger); }
.order-hero-icon.is-neutral { background: var(--surface-soft); color: var(--body); }
@keyframes nico-pop {
  from { transform: scale(.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .order-hero-icon { animation: none; }
}
.order-hero h1 { font-size: 34px; margin-bottom: 10px; }
.order-hero-sub { font-size: 15px; color: var(--body); margin: 0 auto; max-width: 620px; }
.order-hero-email { font-size: 13.5px; color: var(--muted); }
.order-hero-email strong { color: var(--ink); font-weight: 600; }

.order-progress {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0 0 34px;
  padding: 0;
  counter-reset: step;
}
.order-progress-step {
  position: relative;
  text-align: center;
  padding: 0 8px;
}
/* Connector rail between the dots. */
.order-progress-step::before {
  content: "";
  position: absolute;
  top: 21px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--line);
  z-index: 0;
}
.order-progress-step:first-child::before { display: none; }
.order-progress-step.is-done::before,
.order-progress-step.is-current::before { background: var(--primary); }

.step-dot {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--line);
  color: var(--muted);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.order-progress-step.is-done .step-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.order-progress-step.is-current .step-dot {
  background: #fff;
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 5px rgba(14, 158, 108, .13);
}
.step-body { display: block; }
.step-label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}
.order-progress-step.is-upcoming .step-label { color: var(--muted); }
.step-note { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.5; }

/* ---------------------------------------- 4. meta strip + action buttons */
.order-meta-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 0 26px;
  padding: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
/* WooCommerce styles ul.order_details with floats, dashed borders and a
   clearfix that leaks into the grid — neutralised defensively. */
.order-meta-grid::before,
.order-meta-grid::after { content: none; display: none; }

.order-meta {
  background: #fff;
  padding: 18px 22px;
  margin: 0;
  float: none;
  border-right: 1px solid var(--line);
  text-transform: none;
  font-size: inherit;
  line-height: inherit;
  list-style: none;
  min-width: 0;
}
.order-meta:last-child { border-right: 0; }
.order-meta-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--muted);
  margin-bottom: 6px;
}
.order-meta-value {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  text-transform: none;
  color: var(--ink);
  line-height: 1.35;
  overflow-wrap: break-word;
}
.order-meta-value.is-accent { color: var(--primary-dark); }
.order-meta-value .woocommerce-Price-amount { font-size: inherit; }

.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 34px;
}
.order-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 24px;
  font-size: 14px;
}
.order-actions .btn i { font-size: 15px; }

/* The confirmation buttons follow the theme palette, not Bootstrap's. */
.nico-order-received .btn-nico,
.nico-order-received .btn-nico i,
.nico-order-received .btn-nico span { color: #fff; }

.btn-nico-outline { background: transparent; }
.nico-order-received .btn-nico-outline {
  border-color: var(--line-strong);
  color: var(--ink);
  background: #fff;
}
.nico-order-received .btn-nico-outline:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.nico-order-received .btn-nico-outline i { color: var(--primary); }

.btn-nico-ghost {
  background: var(--surface-soft);
  border-color: transparent;
  color: var(--body);
}
.btn-nico-ghost:hover { background: var(--primary-soft); color: var(--primary-dark); }
.btn-nico-ghost i { color: var(--primary); }

.order-gateway-note {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  margin-bottom: 30px;
}
.gateway-note-icon { color: var(--primary); font-size: 17px; margin-top: 2px; }
.gateway-note-body h2 { font-size: 15px; margin: 0 0 4px; }
.gateway-note-body p:last-child { margin-bottom: 0; }
.gateway-note-body { font-size: 13.5px; color: var(--ink-soft); }

/* -------------------------------------- 5. order summary card + line items */
.nico-order-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  margin-bottom: 26px;
}
.order-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfc;
}
.order-card-head h2 { font-size: 19px; margin: 0; }
.order-card-foot { padding: 16px 26px; border-top: 1px solid var(--line); }

.order-status-pill {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--surface-soft);
  color: var(--body);
  white-space: nowrap;
}
.order-status-pill.status-processing { background: #e7f1fd; color: #1668a8; }
.order-status-pill.status-completed  { background: var(--primary-soft); color: var(--primary-dark); }
.order-status-pill.status-on-hold,
.order-status-pill.status-pending    { background: #fdf3e2; color: #a9701a; }
.order-status-pill.status-cancelled,
.order-status-pill.status-failed,
.order-status-pill.status-refunded   { background: #fdecee; color: var(--danger); }

.nico-order-card.woocommerce-order-details .nico-order-table {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  border-collapse: collapse;
}
.nico-order-card.woocommerce-order-details .nico-order-table thead { display: none; }
.nico-order-card.woocommerce-order-details .nico-order-table tbody td {
  padding: 18px 26px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.nico-order-card.woocommerce-order-details .nico-order-table tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.nico-order-card.woocommerce-order-details .nico-order-table td.product-total {
  text-align: right;
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  width: 150px;
}

.order-item { display: flex; align-items: center; gap: 16px; }
.order-item-media { flex: 0 0 auto; }
.order-item-media img,
.order-item-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  display: block;
}
.order-item-title {
  display: block;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.45;
}
.order-item-title a { color: var(--ink); }
.order-item-title a:hover { color: var(--primary); }
.order-item-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--muted);
}
.order-item-qty { font-weight: 600; color: var(--body); }
.order-item-sku { font-variant-numeric: tabular-nums; }
.order-item-body .wc-item-meta,
.order-item-body .variation {
  list-style: none;
  margin: 5px 0 0;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
}
.order-item-body .wc-item-meta li { margin: 0; }
.order-item-body .wc-item-meta p,
.order-item-body .wc-item-meta strong { display: inline; margin: 0; font-weight: 600; }

.order-purchase-note {
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 13px;
  color: var(--ink-soft);
}
.order-purchase-note p:last-child { margin-bottom: 0; }

.nico-order-card.woocommerce-order-details .nico-order-table tfoot th,
.nico-order-card.woocommerce-order-details .nico-order-table tfoot td {
  padding: 12px 26px;
  font-size: 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.nico-order-card.woocommerce-order-details .nico-order-table tfoot th { font-family: var(--font-body); font-weight: 500; color: var(--body); }
.nico-order-card.woocommerce-order-details .nico-order-table tfoot td { text-align: right; color: var(--ink); font-weight: 600; white-space: nowrap; }
.nico-order-card.woocommerce-order-details .nico-order-table tfoot .order-total-row.is-grand th,
.nico-order-card.woocommerce-order-details .nico-order-table tfoot .order-total-row.is-grand td {
  background: #fbfdfc;
  border-bottom: 0;
  padding-top: 18px;
  padding-bottom: 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: var(--ink);
}
.nico-order-card.woocommerce-order-details .nico-order-table tfoot .order-total-row.is-grand td { color: var(--primary-dark); }

.order-customer-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 26px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--body);
}
.order-customer-note .note-label {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--primary-dark);
  background: var(--primary-soft);
  padding: 4px 10px;
  border-radius: 4px;
  margin-top: 2px;
}
.order-customer-note p { margin: 0; }

/* ---------------------------------------- 6. address cards + help strip */
.nico-address-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}
.nico-address-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  background: #fff;
}
.woocommerce-customer-details.nico-address-grid .nico-address-card h2,
.woocommerce-customer-details.nico-address-grid .nico-address-card .woocommerce-column__title {
  font-size: 15px;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.woocommerce-customer-details.nico-address-grid .nico-address {
  font-style: normal;
  font-size: 14px;
  line-height: 1.85;
  color: var(--body);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
}
.woocommerce-customer-details.nico-address-grid .nico-address-contact {
  list-style: none;
  margin: 14px 0 0;
  padding: 14px 0 0;
  border-top: 1px dashed var(--line-strong);
  font-size: 13.5px;
}
.nico-address-contact li { display: flex; align-items: center; gap: 10px; }
.nico-address-contact li + li { margin-top: 8px; }
.nico-address-contact i { color: var(--primary); width: 15px; text-align: center; }
.nico-address-contact a { color: var(--body); word-break: break-word; }
.nico-address-contact a:hover { color: var(--primary); }

.order-help {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 30px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.order-help-intro h2 { font-size: 18px; margin: 0 0 4px; }
.order-help-intro p { margin: 0; font-size: 13.5px; color: var(--body); }
.order-help-links { display: flex; flex-wrap: wrap; gap: 10px; }
.order-help-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  transition: border-color .25s var(--ease), color .25s var(--ease);
}
.order-help-link:hover { border-color: var(--primary); color: var(--primary-dark); }
.order-help-link i { color: var(--primary); }

/* ------------------------------------------------------- 7. responsive */
@media (max-width: 991.98px) {
  .checkout-rail { position: static; }
  .order-hero h1 { font-size: 27px; }
}

@media (max-width: 767.98px) {
  .order-hero { padding-bottom: 26px; }
  .order-hero-icon { width: 62px; height: 62px; font-size: 25px; }
  .order-hero h1 { font-size: 23px; }
  .order-hero-sub { font-size: 14px; }

  /* The tracker turns into a vertical list so labels stay readable. */
  .order-progress { grid-template-columns: 1fr; gap: 0; }
  .order-progress-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    text-align: left;
    padding: 0 0 20px 0;
  }
  .order-progress-step::before {
    top: 42px;
    left: 20px;
    width: 2px;
    height: calc(100% - 42px);
  }
  .step-dot { margin-bottom: 0; flex: 0 0 42px; }
  .step-label { font-size: 14.5px; }

  .order-meta-grid { grid-template-columns: repeat(2, 1fr); }
  .order-meta { padding: 14px 16px; }
  .order-meta:nth-child(2n) { border-right: 0; }
  .order-meta:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .order-meta-value { font-size: 14.5px; }

  .order-actions { gap: 10px; }
  .order-actions .btn { flex: 1 1 calc(50% - 5px); justify-content: center; padding: 13px 14px; }

  .order-card-head, .order-card-foot { padding: 16px 18px; }
  .nico-order-card.woocommerce-order-details .nico-order-table tbody td { padding: 14px 18px; }
  .nico-order-card.woocommerce-order-details .nico-order-table tfoot th, .nico-order-card.woocommerce-order-details .nico-order-table tfoot td { padding: 10px 18px; }
  .nico-order-card.woocommerce-order-details .nico-order-table td.product-total { width: 100px; font-size: 14px; }
  .order-item { gap: 12px; }
  .order-item-media img, .order-item-img { width: 52px; height: 52px; }
  .order-item-title { font-size: 13.5px; }

  .order-customer-note { padding: 14px 18px; flex-direction: column; gap: 8px; }
  .nico-address-card { padding: 20px 18px; }
  .order-help { padding: 22px 20px; }
  .order-help-links { width: 100%; }
  .order-help-link { flex: 1 1 100%; justify-content: center; }

  .checkout-review { padding: 20px 16px; }
  .checkout-step-head { gap: 11px; margin-bottom: 18px; }
  .checkout-step-title { font-size: 17px; }
  .review-item-media img { width: 48px; height: 48px; }
}

@media (max-width: 420px) {
  .order-meta-grid { grid-template-columns: 1fr; }
  .order-meta { border-right: 0; border-bottom: 1px solid var(--line); }
  .order-meta:last-child { border-bottom: 0; }
  .order-actions .btn { flex: 1 1 100%; }
}

/* ------------------------------------------------------------ 8. print */
@media print {
  .site-header,
  .site-footer,
  .announcement-bar,
  .nico-breadcrumbs,
  .float-btn,
  .mobile-drawer,
  .no-print,
  .order-help,
  .order-progress,
  .woocommerce-notices-wrapper,
  #wpadminbar { display: none !important; }

  body { background: #fff; font-size: 12px; }
  .nico-order-received { max-width: none; margin: 0; }
  .order-hero { padding-top: 0; text-align: left; }
  .order-hero-icon { display: none; }
  .order-hero h1 { font-size: 22px; }

  .nico-order-card,
  .nico-address-card,
  .order-meta-grid {
    border-color: #ccc !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .nico-order-card.woocommerce-order-details .nico-order-table tbody tr { break-inside: avoid; }
  a[href]::after { content: ""; }
}
