/* =====================================================================
   Popup Checkout by REAJUL ISLAM — v6 Style
   ===================================================================== */

:root{
  --pcs-bg       : rgba(15,23,42,.55);
  --pcs-card     : #ffffff;
  --pcs-text     : #0f172a;
  --pcs-muted    : rgba(15,23,42,.65);
  --pcs-border   : rgba(15,23,42,.10);
  --pcs-shadow   : 0 20px 60px rgba(2,6,23,.35);
  --pcs-radius   : 18px;
  --pcs-primary  : #1e40af;
}

/* ===================== LOOP BUTTON ===================== */
.pcs-loop-wrap { margin-top: 10px; }

/* ===================== BUY NOW BUTTON ===================== */
.pcs-buy-now{
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
  transition: all .2s ease;
}
.pcs-buy-now:hover{
  transform: translateY(-1px);
  filter: brightness(1.08);
}

/* ===================== MODAL BASE ===================== */
.pcs-modal{
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
}
.pcs-modal__backdrop{
  position: absolute;
  inset: 0;
  background: var(--pcs-bg);
  backdrop-filter: blur(6px);
}
.pcs-modal__dialog{
  position: relative;
  width: min(500px, calc(100% - 24px));
  max-height: min(92vh, 820px);
  margin: 36px auto;
  background: var(--pcs-card);
  border: 1px solid var(--pcs-border);
  border-radius: var(--pcs-radius);
  box-shadow: var(--pcs-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(14px);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}
.pcs-modal.pcs-open .pcs-modal__dialog{
  transform: translateY(0);
  opacity: 1;
}

/* ===================== MODAL HEADER ===================== */
.pcs-modal__header{
  padding: 16px 52px 14px 20px;
  border-bottom: 1px solid var(--pcs-border);
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  flex-shrink: 0;
}
.pcs-modal__title{
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  margin: 0;
  line-height: 1.3;
}
.pcs-modal__subtitle{
  font-size: 12px;
  color: rgba(255,255,255,.72);
  margin-top: 3px;
}

/* ===================== CLOSE BUTTON ===================== */
#pcs-popup-checkout-modal .pcs-modal__close{
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  width: 34px !important;
  height: 34px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: rgba(255,255,255,.2) !important;
  color: #fff !important;
  font-size: 0 !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  z-index: 9 !important;
  transition: background .15s ease !important;
}
#pcs-popup-checkout-modal .pcs-modal__close::before{
  content: "\00D7";
  font-size: 20px !important;
  line-height: 1 !important;
  color: #fff !important;
  font-weight: 400 !important;
  font-family: Arial, sans-serif !important;
}
#pcs-popup-checkout-modal .pcs-modal__close:hover{
  background: rgba(255,255,255,.35) !important;
}

/* ===================== MODAL BODY — scrollable container ===================== */
.pcs-modal__body{
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0;
  /* Reserve space on right so scrollbar never overlaps content */
  scrollbar-gutter: stable;
}

/* ===================== INNER WRAPPER — all content padding here ===================== */
.pcs-inner{
  padding: 18px 18px 28px 18px;
  box-sizing: border-box;
  width: 100%;
}

/* ===================== SKELETON ===================== */
.pcs-skeleton{ display: grid; gap: 10px; padding: 20px; }
.pcs-skeleton__line{
  height: 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(15,23,42,.08), rgba(15,23,42,.03), rgba(15,23,42,.08));
  background-size: 200% 100%;
  animation: pcsShimmer 1.2s infinite linear;
}
.pcs-skeleton__line:nth-child(2){ width: 78%; }
.pcs-skeleton__line:nth-child(3){ width: 62%; }
@keyframes pcsShimmer{ 0%{ background-position:0 0 } 100%{ background-position:200% 0 } }

/* ===================== SECTION ===================== */
.pcs-section{
  background: #fff;
  border: 1px solid rgba(15,23,42,.09);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(2,6,23,.04);
  box-sizing: border-box;
}
.pcs-section:last-child{ margin-bottom: 0; }

.pcs-section-title{
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1.5px solid rgba(15,23,42,.08);
  display: block;
}

/* ===================== CUSTOMER INFO FIELDS ===================== */
.pcs-fields{
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pcs-field{
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pcs-field label,
.pcs-notes-label,
.pcs-attr-label{
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  display: block;
}
.pcs-required{ color: #dc2626; }

.pcs-input{
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid rgba(15,23,42,.15);
  border-radius: 10px;
  font-size: 14px;
  color: #0f172a;
  background: #f8fafc;
  box-sizing: border-box;
  font-family: inherit;
  display: block;
  transition: border-color .15s, background .15s;
  outline: none;
}
.pcs-input:focus{
  border-color: #3b82f6;
  background: #fff;
}

/* ===================== VARIANT BLOCK ===================== */
.pcs-variant-block{
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pcs-attr-row{
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pcs-select-wrap{
  position: relative;
}
.pcs-select-wrap::after{
  content: '▾';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
  font-size: 13px;
}
.pcs-attr-select{
  width: 100%;
  padding: 10px 36px 10px 12px;
  border: 1.5px solid rgba(15,23,42,.15);
  border-radius: 10px;
  font-size: 14px;
  color: #0f172a;
  background: #f8fafc;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color .15s;
  box-sizing: border-box;
  outline: none;
}
.pcs-attr-select:focus{
  border-color: #3b82f6;
  background: #fff;
}
.pcs-attr-select:hover{ border-color: rgba(15,23,42,.35); }
.pcs-attr-error{
  font-size: 11px;
  color: #dc2626;
  margin-top: 2px;
}

/* ===================== DELIVERY OPTIONS ===================== */
.pcs-delivery-options{
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pcs-delivery-option{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 2px solid rgba(15,23,42,.12);
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s ease;
  background: #f8fafc;
  box-sizing: border-box;
}
.pcs-delivery-option:hover{ border-color: var(--pcs-primary); background: #eff6ff; }
.pcs-delivery-option.pcs-selected{ border-color: var(--pcs-primary); background: #eff6ff; }
.pcs-delivery-option input[type="radio"]{
  accent-color: var(--pcs-primary);
  width: 16px; height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.pcs-delivery-option__label{
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--pcs-text);
}
.pcs-delivery-option__price{
  font-size: 14px;
  font-weight: 700;
  color: var(--pcs-primary);
  white-space: nowrap;
}
.pcs-delivery-error{
  font-size: 12px;
  color: #dc2626;
  margin-top: 6px;
  display: none;
  padding: 6px 10px;
  background: #fef2f2;
  border-radius: 8px;
}

/* ===================== PRODUCT ROW ===================== */
.pcs-product-row{
  display: flex;
  align-items: center;
  gap: 12px;
}
.pcs-product-img{
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--pcs-border);
}
.pcs-product-info{
  flex: 1;
  min-width: 0;
}
.pcs-product-name{
  font-size: 13px;
  font-weight: 700;
  color: var(--pcs-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pcs-product-price{
  font-size: 13px;
  color: var(--pcs-muted);
  margin-top: 2px;
}
#pcs-badges{ min-height: 0; margin-top: 4px; }

/* ── Qty controls ── */
.pcs-qty-control{
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid rgba(15,23,42,.15);
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}
.pcs-qty-btn{
  width: 34px; height: 34px;
  border: none;
  background: #f1f5f9;
  color: var(--pcs-text);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s ease;
  line-height: 1;
}
.pcs-qty-btn:hover{ background: #e2e8f0; }
.pcs-qty-num{
  width: 38px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--pcs-text);
  border: none;
  background: #fff;
  outline: none;
}

/* ===================== PRICE SUMMARY ===================== */
.pcs-price-summary{
  background: #f8fafc;
  border: 1px solid rgba(15,23,42,.09);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.pcs-price-row{
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--pcs-muted);
  padding: 4px 0;
}
.pcs-price-row.pcs-total{
  border-top: 1px dashed rgba(15,23,42,.12);
  margin-top: 6px;
  padding-top: 10px;
  font-size: 16px;
  font-weight: 800;
  color: var(--pcs-text);
}
.pcs-price-row.pcs-total span:last-child{ color: var(--pcs-primary); }

/* ===================== VARIANT BADGES ===================== */
.pcs-badge{
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 5px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 4px;
  margin-bottom: 3px;
}

/* ===================== NOTES FIELD ===================== */
.pcs-notes-label{
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  display: block;
  margin-bottom: 5px;
}

/* ===================== PAYMENT ROW ===================== */
.pcs-payment-row{
  border: 1.5px solid rgba(15,23,42,.10);
  border-radius: 12px;
  padding: 13px 14px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  box-sizing: border-box;
}
.pcs-payment-icon{ font-size: 22px; }
.pcs-payment-title{ font-weight: 700; font-size: 14px; color: #0f172a; }
.pcs-payment-sub  { font-size: 12px; color: #64748b; margin-top: 2px; }

/* ===================== ORDER BUTTON ===================== */
.pcs-order-btn{
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 800;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: #fff;
  letter-spacing: .3px;
  box-shadow: 0 4px 18px rgba(30,64,175,.35);
  transition: opacity .15s, transform .1s;
  display: block;
  box-sizing: border-box;
}
.pcs-order-btn:hover{ transform: translateY(-1px); box-shadow: 0 6px 22px rgba(30,64,175,.4); }
.pcs-order-btn:disabled{ opacity: .7; cursor: not-allowed; transform: none; }

/* ===================== ERROR ===================== */
.pcs-error{
  padding: 14px;
  border: 1px solid rgba(220,38,38,.2);
  border-radius: 12px;
  color: #dc2626;
  background: #fef2f2;
  font-size: 13px;
}
#pcs-msg{ margin-top: 12px; }

/* ===================== LAYOUT NORMALIZE (WC overrides) ===================== */
#pcs-popup-checkout-modal .woocommerce,
#pcs-popup-checkout-modal .woocommerce *{ box-sizing: border-box; }
#pcs-popup-checkout-modal .woocommerce,
#pcs-popup-checkout-modal .woocommerce-checkout,
#pcs-popup-checkout-modal .woocommerce form.checkout{
  width: 100% !important; max-width: 100% !important;
}
#pcs-popup-checkout-modal .woocommerce-checkout .col2-set,
#pcs-popup-checkout-modal .woocommerce-checkout .col2-set .col-1,
#pcs-popup-checkout-modal .woocommerce-checkout .col2-set .col-2,
#pcs-popup-checkout-modal #customer_details,
#pcs-popup-checkout-modal #order_review{
  float: none !important; width: 100% !important; max-width: 100% !important;
}
#pcs-popup-checkout-modal .woocommerce form .form-row{
  float: none !important; width: 100% !important;
  display: block !important; margin-bottom: 12px !important;
}
#pcs-popup-checkout-modal .woocommerce form .form-row-first,
#pcs-popup-checkout-modal .woocommerce form .form-row-last{
  float: none !important; width: 100% !important;
}
#pcs-popup-checkout-modal .select2-container{ width: 100% !important; }
#pcs-popup-checkout-modal #billing_country_field,
#pcs-popup-checkout-modal .woocommerce-shipping-fields,
#pcs-popup-checkout-modal #ship-to-different-address,
#pcs-popup-checkout-modal .woocommerce-checkout .wc-backward,
#pcs-popup-checkout-modal a.wc-backward,
#pcs-popup-checkout-modal .checkout-next-step-button,
#pcs-popup-checkout-modal .woocommerce-form-coupon-toggle,
#pcs-popup-checkout-modal .checkout_coupon,
#pcs-popup-checkout-modal .woocommerce-privacy-policy-text,
#pcs-popup-checkout-modal #order_review,
#pcs-popup-checkout-modal .woocommerce-checkout-review-order,
#pcs-popup-checkout-modal .shop_table.woocommerce-checkout-review-order-table,
#pcs-popup-checkout-modal .woocommerce-shipping-totals,
#pcs-popup-checkout-modal .woocommerce-checkout-review-order-table,
#pcs-popup-checkout-modal .cart-subtotal,
#pcs-popup-checkout-modal #order_review_heading,
#pcs-popup-checkout-modal #place_order,
#pcs-popup-checkout-modal .woocommerce-checkout #place_order,
#pcs-woo-hidden #place_order,
#pcs-woo-hidden .wc-block-components-checkout-place-order-button{
  display: none !important;
}

/* ===================== THANK YOU PAGE ===================== */
.pcs-thankyou{ text-align: center; padding: 16px 4px; }
.pcs-ty-icon{
  width: 70px; height: 70px;
  background: linear-gradient(135deg,#10b981,#059669);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 8px 24px rgba(16,185,129,.3);
}
.pcs-ty-title{ color: #0f172a; font-size: 20px; font-weight: 800; margin: 0 0 5px; }
.pcs-ty-sub  { color: #64748b; font-size: 13px; margin: 0 0 18px; }
.pcs-ty-card{
  background: #f8fafc;
  border: 1.5px solid rgba(15,23,42,.08);
  border-radius: 14px;
  padding: 16px;
  text-align: left;
  margin-bottom: 14px;
}
.pcs-ty-card-header{
  font-weight: 700; font-size: 13px; color: #0f172a;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(15,23,42,.08);
  padding-bottom: 8px;
}
.pcs-ty-oid { color: #3b82f6; }
.pcs-ty-info{ display: flex; flex-direction: column; gap: 7px; font-size: 13px; margin-bottom: 12px; }
.pcs-ty-row { display: flex; justify-content: space-between; }
.pcs-ty-row span:first-child{ color: #64748b; }
.pcs-ty-row span:last-child { font-weight: 600; color: #0f172a; }
.pcs-ty-divider{ border-top: 1px dashed rgba(15,23,42,.12); margin: 10px 0; }
.pcs-ty-product{ display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.pcs-ty-img    { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.pcs-ty-product-info{ flex: 1; }
.pcs-ty-product-name{ font-weight: 600; font-size: 13px; color: #0f172a; }
.pcs-ty-badges { margin-top: 4px; }
.pcs-ty-qty   { font-size: 12px; color: #64748b; margin-top: 3px; }
.pcs-ty-prices{ display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.pcs-ty-total span:last-child{ font-weight: 800; font-size: 15px; color: #1e40af; }
.pcs-ty-total{ border-top: 2px solid rgba(15,23,42,.1); padding-top: 7px; margin-top: 3px; }
.pcs-ty-total span:first-child{ font-weight: 700; color: #0f172a; }
.pcs-ty-cod{
  background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 10px; padding: 10px 14px;
  font-size: 12px; color: #92400e;
  margin-bottom: 14px; text-align: left;
}
.pcs-ty-home-btn{
  display: block; width: 100%; padding: 14px;
  font-size: 15px; font-weight: 800; border-radius: 12px;
  border: none; cursor: pointer;
  background: linear-gradient(135deg,#1e40af,#2563eb);
  color: #fff; text-decoration: none;
  box-sizing: border-box; text-align: center;
}

/* ===================== MOBILE ===================== */
@media (max-width: 640px){
  .pcs-modal__dialog{
    margin: 8px auto;
    max-height: 97vh;
    width: calc(100% - 12px);
    border-radius: 14px;
  }
  .pcs-inner{
    padding: 14px 14px 24px 14px;
  }
  .pcs-section{ padding: 12px 14px; }
  .pcs-order-btn{ font-size: 15px; padding: 14px; }
}
