/* Xan Polar & PayPal Gateway — Clean, accessible Cart & Checkout styling */

.xan-pay-express-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  margin: 14px 0;
  background-color: #ffffff;
}

.xan-pay-express-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.xan-pay-express-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.xan-pay-express-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.xan-pay-block-item {
  width: 100%;
}

/* Stack WooCommerce Blocks Express buttons cleanly full-width */
.wc-block-components-express-payment__event-buttons {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

.wc-block-components-express-payment__event-buttons > li {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
}

/* Polar Primary Button — centered text & icon (no side badge) */
.xan-polar-express-btn {
  position: relative;
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid #0f172a;
  background-color: #0f172a;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
  text-transform: none !important;
  letter-spacing: normal;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.12s ease;
  box-sizing: border-box;
}

.xan-polar-express-btn:hover:not(:disabled) {
  background-color: #1e293b;
  transform: translateY(-1px);
}

.xan-polar-express-btn:active:not(:disabled) {
  transform: translateY(0);
}

.xan-polar-express-btn:disabled,
.xan-polar-express-btn.is-loading {
  opacity: 0.72;
  cursor: wait;
}

.xan-polar-btn-left {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  white-space: nowrap;
}

/* Mini-Cart / Cart Drawer Express Section */
.pls-minicart-slide .woocommerce-mini-cart__buttons,
.cart-panel .woocommerce-mini-cart__buttons,
#cart-panel .woocommerce-mini-cart__buttons {
  padding-bottom: 14px !important;
  border-bottom: none !important;
}

.xan-pay-express-wrap--minicart,
#cart-panel .xan-pay-express-wrap--minicart,
.cart-panel .xan-pay-express-wrap--minicart {
  border: none !important;
  border-radius: 0 !important;
  padding: 0 0 16px !important;
  margin: 0 !important;
  background-color: transparent !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.xan-pay-express-wrap--minicart .xan-pay-express-stack,
#cart-panel .xan-pay-express-wrap--minicart .xan-pay-express-stack {
  width: 100% !important;
  box-sizing: border-box !important;
}

.xan-pay-express-wrap--minicart .xan-polar-express-btn,
.xan-pay-express-wrap--minicart .xan-paypal-btn-slot,
#cart-panel .xan-polar-express-btn,
#cart-panel .xan-paypal-btn-slot {
  width: 100% !important;
  box-sizing: border-box !important;
}

.xan-pay-divider--minicart {
  margin: 0 0 14px;
}

.xan-pay-express-wrap--minicart .xan-polar-express-btn {
  min-height: 42px;
  font-size: 13px;
}

/* Checkout Policy Modal (Terms & Privacy without leaving checkout) */
.xan-policy-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background-color: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.xan-policy-modal {
  width: 100%;
  max-width: 680px;
  max-height: 82vh;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.xan-policy-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}

.xan-policy-modal__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.xan-policy-modal__close {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.xan-policy-modal__close:hover {
  background-color: #f8fafc;
  color: #0f172a;
}

.xan-policy-modal__body {
  padding: 20px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.65;
  color: #334155;
}

.xan-policy-modal__body h1,
.xan-policy-modal__body h2,
.xan-policy-modal__body h3 {
  color: #0f172a;
  font-weight: 700;
  margin-top: 16px;
  margin-bottom: 8px;
}

.xan-policy-modal__footer {
  padding: 12px 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  background-color: #f8fafc;
}

.xan-policy-modal__btn {
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid #0f172a;
  background-color: #0f172a;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.xan-policy-modal__btn:hover {
  background-color: #1e293b;
}

/* Checkout Right Sidebar Payment Container */
.xan-checkout-sidebar-pay {
  margin-top: 16px;
  padding: 0;
}

.xan-checkout-terms-note {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
  text-align: center;
}

.xan-checkout-terms-note a {
  color: #0f172a;
  text-decoration: underline;
}

/* OR Divider */
.xan-pay-divider {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center;
  gap: 12px;
  margin: 12px 0;
}

.xan-pay-divider::before,
.xan-pay-divider::after {
  content: "" !important;
  flex: 1 1 0% !important;
  height: 1px !important;
  background-color: #e2e8f0 !important;
  position: static !important;
}

.xan-pay-divider span {
  position: static !important;
  background: transparent !important;
  background-color: transparent !important;
  padding: 0 4px !important;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Transparent PayPal Smart Button Slot (matching MemoKat clean embed) */
.xan-paypal-btn-slot {
  width: 100%;
  background: transparent;
  overflow: hidden;
  border-radius: 6px;
}

.xan-paypal-btn-slot iframe {
  border: none !important;
  background: transparent !important;
}

/* Checkout Payment Option Details & Badges */
.xan-pay-method-label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-weight: 600;
}

.xan-pay-method-box {
  padding: 4px 0;
}

.xan-pay-method-desc {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.5;
  color: #475569;
}

.xan-pay-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.xan-pay-badges--inline {
  margin-left: auto;
}

.xan-pay-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 2px 7px;
  line-height: 1.4;
}

.xan-pay-badge--paypal {
  color: #003087;
  background-color: #eff6ff;
  border-color: #bfdbfe;
}

/* Feedback messages */
.xan-pay-status-msg {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
  background-color: #eff6ff;
  color: #1e40af;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.xan-pay-error-msg {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #fecaca;
  background-color: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 600;
}

/* ==========================================================================
   Order Downloads & Account Downloads (Grouped PDF + EPUB 2-Button Layout)
   ========================================================================== */

.xan-order-downloads-section {
  margin: 28px 0;
}

.woocommerce-order-downloads__title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 14px;
}

.xan-custom-downloads-table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: #ffffff !important;
  margin-bottom: 24px !important;
}

.xan-custom-downloads-table thead th {
  background-color: #f8fafc !important;
  color: #475569 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  padding: 12px 16px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  text-align: left !important;
}

.xan-custom-downloads-table tbody td {
  padding: 16px !important;
  vertical-align: middle !important;
  border-bottom: 1px solid #f1f5f9 !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
}

.xan-custom-downloads-table tbody tr:last-child td {
  border-bottom: none !important;
}

.xan-download-product-link,
.xan-download-product-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.4;
  text-decoration: none;
  display: inline-block;
  transition: color 0.15s ease;
}

.xan-download-product-link:hover {
  color: #2563eb;
}

.xan-downloads-btn-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.xan-download-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-height: 44px !important;
  padding: 9px 16px !important;
  border-radius: 8px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  transition: all 0.15s ease-in-out !important;
}

.xan-download-btn svg {
  flex-shrink: 0;
}

/* Solid dark style for PDF, ZIP, External Services & General Files */
.xan-download-btn--pdf,
.xan-download-btn--zip,
.xan-download-btn--gdrive,
.xan-download-btn--gsheet,
.xan-download-btn--gdoc,
.xan-download-btn--notion,
.xan-download-btn--canva,
.xan-download-btn--file {
  background-color: #0f172a !important;
  color: #ffffff !important;
  border: 1px solid #0f172a !important;
}

.xan-download-btn--pdf:hover,
.xan-download-btn--zip:hover,
.xan-download-btn--gdrive:hover,
.xan-download-btn--gsheet:hover,
.xan-download-btn--gdoc:hover,
.xan-download-btn--notion:hover,
.xan-download-btn--canva:hover,
.xan-download-btn--file:hover {
  background-color: #1e293b !important;
  border-color: #1e293b !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12) !important;
}

/* EPUB Button — Elegant refined outline */
.xan-download-btn--epub {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

.xan-download-btn--epub:hover {
  background-color: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04) !important;
}

/* Mobile Responsive Optimization (<= 640px) */
@media screen and (max-width: 640px) {
  .xan-custom-downloads-table {
    border: none !important;
    background: transparent !important;
  }

  .xan-custom-downloads-table thead {
    display: none !important;
  }

  .xan-custom-downloads-table tbody,
  .xan-custom-downloads-table tr {
    display: block !important;
    width: 100% !important;
  }

  .xan-custom-downloads-table tr {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    padding: 14px !important;
    margin-bottom: 12px !important;
    box-sizing: border-box !important;
  }

  .xan-custom-downloads-table td {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    border: none !important;
    box-sizing: border-box !important;
  }

  .xan-custom-downloads-table td.download-product {
    margin-bottom: 12px !important;
  }

  .xan-downloads-btn-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .xan-download-btn {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
    padding: 12px 14px !important;
    font-size: 14px !important;
  }
}


/* Cart page clean express buttons (no box, no header, 2 buttons before Proceed to checkout) */
.xan-pay-express-wrap--cart,
.woocommerce-cart .xan-pay-express-wrap {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 16px 0 0 !important;
  width: 100% !important;
}

.xan-pay-divider--proceed {
  margin: 14px 0 !important;
}

/* Checkout right-column express buttons (clean, under Your Order / payment) */
.xan-pay-express-wrap--checkout-review {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 14px 0 0 !important;
  width: 100% !important;
}

/* Hide legacy place order button and radio list on checkout when express buttons are active */
body.woocommerce-checkout #order_review #place_order,
body.woocommerce-checkout #order_review .place-order,
body.woocommerce-checkout #order_review .wc_payment_methods {
  display: none !important;
}
