/* ==========================================================================
   1-Click Fast Checkout Modal & Mobile Bottom Sheet UX (v4.0)
   ========================================================================== */
.qo-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10050;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.qo-backdrop.is-open {
  display: block;
  opacity: 1;
}

.qo-modal {
  display: none;
  position: fixed;
  z-index: 10051;
  background: #ffffff;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

/* Desktop: Centered Floating Dialog */
@media (min-width: 641px) {
  .qo-modal {
    top: 50%;
    left: 50%;
    width: 480px;
    max-width: 95vw;
    max-height: 88vh;
    border-radius: 16px;
    transform: translate(-50%, -46%) scale(0.96);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .qo-modal.is-open {
    display: flex;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  .qo-sheet-handle { display: none; }
}

/* Mobile: Native Bottom Sheet Modal */
@media (max-width: 640px) {
  .qo-modal {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .qo-modal.is-open {
    display: flex;
    opacity: 1;
    transform: translateY(0);
  }
  .qo-sheet-handle {
    width: 42px;
    height: 4.5px;
    background: #cbd5e1;
    border-radius: 4px;
    margin: 8px auto 2px auto;
    flex-shrink: 0;
  }
}

.qo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
  flex-shrink: 0;
}
.qo-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}
.qo-icon {
  font-size: 18px;
  color: #e11d48;
}
.qo-close-btn {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.qo-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.qo-body {
  padding: 16px 18px 24px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex-grow: 1;
}

/* Loading */
.qo-loading {
  padding: 40px 10px;
  text-align: center;
  color: #64748b;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
}
.qo-spinner {
  width: 36px;
  height: 36px;
  border: 3.5px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: qoSpin 0.7s linear infinite;
}
@keyframes qoSpin {
  to { transform: rotate(360deg); }
}

/* Product Snippet */
.qo-product-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 14px;
}
.qo-prod-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.qo-prod-info {
  flex-grow: 1;
  min-width: 0;
}
.qo-prod-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qo-prod-price-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.qo-prod-price {
  font-size: 16px;
  font-weight: 800;
  color: #e11d48;
}
.qo-prod-old-price {
  font-size: 13px;
  color: #94a3b8;
  text-decoration: line-through;
}

/* Form Fields */
.qo-field-group {
  margin-bottom: 12px;
}
.qo-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.qo-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 5px;
}
.qo-input, .qo-textarea, .qo-select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.qo-input:focus, .qo-textarea:focus, .qo-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.qo-textarea {
  resize: vertical;
  min-height: 54px;
}

/* Quantity Stepper */
.qo-qty-row {
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin-bottom: 14px;
}
.qo-qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}
.qo-qty-btn {
  width: 34px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  font-size: 17px;
  font-weight: 800;
  color: #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.qo-qty-btn:hover { background: #e2e8f0; }
.qo-qty-input {
  width: 44px;
  height: 32px;
  border: none;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  outline: none;
  background: transparent;
}

/* Shipping Radio Pills */
.qo-shipping-radios {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.qo-radio-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  background: #ffffff;
  transition: all 0.15s;
}
.qo-radio-pill.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
}
.qo-radio-pill input {
  accent-color: #2563eb;
  margin: 0;
}

/* Summary Card */
.qo-summary-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 14px 0 10px 0;
}
.qo-summary-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #64748b;
  margin-bottom: 5px;
}
.qo-summary-total {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  padding-top: 6px;
  border-top: 1px dashed #cbd5e1;
  margin-top: 6px;
}
.qo-summary-total span:last-child {
  color: #e11d48;
  font-size: 17px;
}

.qo-cod-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 6px;
  margin-bottom: 14px;
}

.qo-error-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.qo-submit-btn {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 18px;
  border: none;
  border-radius: 9px;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}
.qo-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(22, 163, 74, 0.45);
}
.qo-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Success View */
.qo-success-view {
  text-align: center;
  padding: 24px 10px;
}
.qo-success-icon {
  font-size: 52px;
  margin-bottom: 10px;
}
.qo-success-title {
  font-size: 20px;
  font-weight: 800;
  color: #15803d;
  margin: 0 0 6px 0;
}
.qo-success-subtitle {
  font-size: 13.5px;
  color: #475569;
  line-height: 1.5;
  margin: 0 0 18px 0;
}
.qo-order-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 10px;
}
.qo-order-badge strong {
  color: #2563eb;
  font-family: monospace;
  font-size: 15px;
}
.qo-order-total-pill {
  font-size: 14px;
  color: #334155;
  margin-bottom: 22px;
}
.qo-order-total-pill b {
  color: #e11d48;
  font-size: 16px;
}
.qo-continue-btn {
  background: #0f172a;
  color: #ffffff;
  border: none;
  padding: 11px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

/* Sticky Mobile Buy Bar for Product Detail Page */
.sticky-mobile-buy-bar {
  display: none;
}
@media (max-width: 768px) {
  body.has-sticky-bar {
    padding-bottom: 74px;
  }
  .sticky-mobile-buy-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
    padding: 8px 12px;
    z-index: 999;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .sticky-bar-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .sticky-bar-price {
    font-size: 16px;
    font-weight: 800;
    color: #e11d48;
    line-height: 1.2;
  }
  .sticky-bar-oldprice {
    font-size: 11.5px;
    color: #94a3b8;
    text-decoration: line-through;
  }
  .sticky-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  .sticky-bar-chat {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #25d366;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 19px;
    box-shadow: 0 2px 6px rgba(37, 211, 102, 0.3);
  }
  .sticky-bar-order-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #16a34a;
    color: #ffffff;
    font-size: 14.5px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(22, 163, 74, 0.3);
  }
}
