/* Scoped and isolated styles for Quick Order Popup */
:where(#MWQOE-popup) {
  --MWQOE-accent: #1f7a8c; /* Default from admin settings */
  --MWQOE-total-bg: #1f7a8c; /* Default from admin settings */
  --MWQOE-product-price: #6b7280; /* Default from admin settings */
  --MWQOE-bg: #ffffff;
  --MWQOE-text: #1f2a44;
  --MWQOE-border: #e5e7eb;
  --MWQOE-error: #dc2626;

  all: initial; /* Reset inherited styles */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
  contain: content; /* CSS containment to limit style leakage */
}

#MWQOE-popup * {
  box-sizing: inherit;
}

#MWQOE-popup {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2147483647 !important;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}

#MWQOE-popup.MWQOE-open {
  display: flex;
}

#MWQOE-popup .MWQOE-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: inherit;
}

#MWQOE-popup .MWQOE-popup-content {
  background: var(--MWQOE-bg);
  color: var(--MWQOE-text);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  padding: 16px;
  margin: 0 auto; /* Ensure no side offset */
}

/* Header */
#MWQOE-popup .MWQOE-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--MWQOE-border);
}

#MWQOE-popup .MWQOE-popup-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

#MWQOE-popup .MWQOE-close {
  position: absolute;
  right: 0;
  top: 0;
  display: block;
  margin-top: -20px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--MWQOE-text);
}

/* Customer Information */
#MWQOE-popup .MWQOE-customer-info h4 {
  font-size: 1.1rem;
  margin: 16px 0 8px;
}

#MWQOE-popup .MWQOE-form-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#MWQOE-popup .MWQOE-form-group {
  display: flex;
  flex-direction: column;
}

#MWQOE-popup .MWQOE-form-group label {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

#MWQOE-popup .MWQOE-form-group input,
#MWQOE-popup .MWQOE-form-group textarea,
#MWQOE-popup .MWQOE-form-group select {
  border: 1px solid var(--MWQOE-border);
  border-radius: 4px;
  padding: 8px;
  font-size: 0.9rem;
  width: 100%;
}

#MWQOE-popup .MWQOE-form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* Product Information */
#MWQOE-popup .MWQOE-products h4 {
  font-size: 1.1rem;
  margin: 16px 0 8px;
}

#MWQOE-popup .MWQOE-product-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--MWQOE-border);
}

#MWQOE-popup .MWQOE-product-image img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

#MWQOE-popup .MWQOE-product-info {
  flex: 1;
}

#MWQOE-popup .MWQOE-product-title {
  font-size: 1rem;
  margin: 0 0 4px;
}

#MWQOE-popup .MWQOE-variation-info {
  font-size: 0.85rem;
  color: var(--MWQOE-product-price);
}

#MWQOE-popup .MWQOE-product-price {
  font-size: 0.9rem;
  color: var(--MWQOE-product-price);
}

#MWQOE-popup .MWQOE-quantity-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

#MWQOE-popup .MWQOE-qty-btn {
  background: var(--MWQOE-border);
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 4px;
}

#MWQOE-popup .MWQOE-quantity {
  width: 60px;
  text-align: center;
  border: 1px solid var(--MWQOE-border);
  border-radius: 4px;
  padding: 4px;
}

#MWQOE-popup .MWQOE-row-total {
  font-size: 0.9rem;
  font-weight: 600;
}

#MWQOE-popup .MWQOE-remove-product {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--MWQOE-error);
}

#MWQOE-popup .MWQOE-variation-required {
  color: var(--MWQOE-error);
}

#MWQOE-popup .MWQOE-subtotal {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 1rem;
}

/* Shipping Method */
#MWQOE-popup .MWQOE-shipping h4 {
  font-size: 1.1rem;
  margin: 16px 0 8px;
}

#MWQOE-popup .MWQOE-shipping select {
  width: 100%;
  padding: 8px;
}

#MWQOE-popup .MWQOE-shipping-cost {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 1rem;
}

#MWQOE-popup .MWQOE-payment-methods {
  margin: 16px 0;
}

#MWQOE-popup .MWQOE-payment-methods legend {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

#MWQOE-popup .MWQOE-payment-method {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

#MWQOE-popup .MWQOE-payment-title {
  font-weight: 600;
}

#MWQOE-popup .MWQOE-payment-desc {
  font-size: 0.85rem;
  color: var(--MWQOE-product-price);
}

/* Total */
#MWQOE-popup .MWQOE-total {
  display: flex;
  justify-content: space-between;
  padding: 12px 10px;
  font-size: 1.1rem;
  font-weight: 600;
  background: var(--MWQOE-total-bg);
  color: #ffffff;
  border-radius: 4px;
}

/* Footer Actions */
#MWQOE-popup .MWQOE-footer {
  display: flex;
  justify-content: space-between;
  padding-top: 16px;
  gap: 12px;
}

#MWQOE-popup .MWQOE-footer button {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

#MWQOE-popup .MWQOE-cancel {
  background: var(--MWQOE-cancel-bg, var(--MWQOE-border));
  color: var(--MWQOE-text);
}

#MWQOE-popup .MWQOE-place-order {
  background: var(--MWQOE-accent);
  color: #ffffff;
}

#MWQOE-popup .MWQOE-place-order:disabled {
  background: #cccccc;
  cursor: not-allowed;
}

/* Responsive Design */
@media (min-width: 480px) {
  #MWQOE-popup .MWQOE-popup-content {
    width: 85%;
    max-width: 450px;
  }
}

@media (min-width: 768px) {
  #MWQOE-popup .MWQOE-form-row {
    flex-direction: row;
  }

  #MWQOE-popup .MWQOE-form-group {
    flex: 1;
  }

  #MWQOE-popup .MWQOE-popup-content {
    padding: 24px;
    width: 80%;
    max-width: 500px;
  }
}

@media (min-width: 1024px) {
  #MWQOE-popup .MWQOE-popup-content {
    width: 70%;
    max-width: 600px;
  }
}

/* Approved combined quick-order layout */
#MWQOE-popup .MWQOE-popup-content{width:min(94vw,980px);max-width:980px;max-height:94vh;padding:22px;border-radius:12px}
#MWQOE-popup .MWQOE-popup-header{justify-content:center;border-bottom:0;padding-bottom:6px;position:relative}
#MWQOE-popup .MWQOE-popup-header h3{font-size:1.65rem;text-align:center}
#MWQOE-popup .MWQOE-close{position:absolute;right:0;top:0}
#MWQOE-popup .MWQOE-customer-info,#MWQOE-popup .MWQOE-products,#MWQOE-popup .MWQOE-addon-catalog,#MWQOE-popup .MWQOE-order-summary{padding:14px;border:1px solid #edf0f2;border-radius:10px;margin:12px 0;background:#fff}
#MWQOE-popup .MWQOE-customer-info h4,#MWQOE-popup .MWQOE-products h4,#MWQOE-popup .MWQOE-addon-catalog h4,#MWQOE-popup .MWQOE-order-summary h4{margin:0 0 5px;font-size:1.12rem;color:#15251b}
#MWQOE-popup .MWQOE-section-caption{margin:0 0 10px;color:#687078;font-size:.9rem}
#MWQOE-popup .MWQOE-form-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:14px;margin-top:10px}
#MWQOE-popup .MWQOE-address-row{grid-template-columns:minmax(0,1fr)}
#MWQOE-popup .MWQOE-form-group input,#MWQOE-popup .MWQOE-form-group textarea{min-height:44px;border:1px solid #d3d7da;border-radius:8px;padding:10px 12px;font-size:14px}
#MWQOE-popup .MWQOE-form-group textarea{min-height:44px;height:44px}
#MWQOE-popup .MWQOE-product-row{padding:10px 0;gap:12px}
#MWQOE-popup .MWQOE-product-image img{width:78px;height:78px;object-fit:cover;border-radius:8px}
#MWQOE-popup .MWQOE-subtotal{background:#edf8f0;border-radius:8px;padding:12px;color:#14532d;font-weight:700}
#MWQOE-popup .MWQOE-catalog-categories{display:flex;gap:7px;overflow-x:auto;padding:2px 0 12px}
#MWQOE-popup .MWQOE-catalog-category{flex:0 0 auto;border:1px solid #e1e5e8;border-radius:20px;background:#f5f6f7;padding:8px 14px;cursor:pointer;font-size:13px;color:#30363b}
#MWQOE-popup .MWQOE-catalog-category.is-active{background:#159447;color:#fff;border-color:#159447}
#MWQOE-popup .MWQOE-catalog-products{display:grid;grid-template-columns:repeat(var(--MWQOE-catalog-columns,5),minmax(0,1fr));gap:10px}
#MWQOE-popup .MWQOE-catalog-card{border:1px solid #e4e8eb;border-radius:9px;padding:8px;display:flex;flex-direction:column;gap:7px;min-width:0}
#MWQOE-popup .MWQOE-catalog-card img{width:100%;aspect-ratio:1/1;object-fit:contain;border-radius:6px;background:#fff}
#MWQOE-popup .MWQOE-catalog-card-title{font-size:13px;font-weight:600;line-height:1.35;min-height:34px}
#MWQOE-popup .MWQOE-catalog-card-price{font-size:14px;font-weight:700;text-align:right}
#MWQOE-popup .MWQOE-catalog-add{border:1px solid #159447;background:#fff;color:#146c36;border-radius:7px;padding:8px 5px;font-weight:600;cursor:pointer;margin-top:auto}
#MWQOE-popup .MWQOE-catalog-add:hover{background:#edf8f0}
#MWQOE-popup .MWQOE-summary-line{display:flex;justify-content:space-between;gap:12px;padding:6px 0;color:#4b5563}
#MWQOE-popup .MWQOE-summary-subtotal{color:#14532d}
@media(max-width:650px){#MWQOE-popup .MWQOE-popup-content{width:96vw;max-height:96vh;padding:12px}#MWQOE-popup .MWQOE-form-row{grid-template-columns:1fr;gap:9px}#MWQOE-popup .MWQOE-catalog-products{grid-template-columns:repeat(2,minmax(0,1fr))}#MWQOE-popup .MWQOE-product-row{flex-wrap:wrap}#MWQOE-popup .MWQOE-product-image img{width:60px;height:60px}}
#MWQOE-popup .MWQOE-quantity-readonly{min-width:32px;text-align:center;font-weight:600;padding:6px 8px}
