/* Modal container */
#qco-overlay.qco-hidden { display: none; }
#qco-overlay { 
  position: fixed; 
  inset: 0; 
  z-index: 999999; 
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Dimmed backdrop with blur */
#qco-overlay .qco-backdrop { 
  position: absolute; 
  inset: 0; 
  background: rgba(0,0,0,.6); 
  backdrop-filter: blur(4px);
}

/* Modal box */
#qco-overlay .qco-modal { 
  position: relative; 
  max-width: 440px; 
  max-height: 85vh; 
  margin: 2vh auto; 
  background: #fff; 
  border-radius: 16px; 
  padding: 0; 
  box-shadow: 0 20px 60px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.15); 
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
}

@keyframes modalSlideIn {
  from { transform: translateY(-20px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Close button */
.qco-close { 
  position: absolute; 
  top: -6px; 
  right: -1px; 
  background: #000; 
  color: #fff;
  font-size: 16px; 
  cursor: pointer; 
  min-width: 10px;
  height: 45px;
  border-radius: 30px;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  line-height: 1;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.qco-close:hover {
  background: #333;
  transform: scale(1.1);
}
/* Modal body with scroll */
.qco-body { 
  display: grid; 
  gap: 24px; 
  padding: 32px; 
  overflow-y: auto; 
  flex: 1;
  max-height: calc(85vh - 40px);
}

/* Product summary header - FIXED LAYOUT */
.qco-product-summary { 
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  margin-bottom: 12px;
}

.qco-thumb { 
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 12px;
  background: #e9ecef;
  border: 1px solid #dee2e6;
  flex-shrink: 0; /* Prevent image from shrinking */
}

.qco-title { 
  font-weight: 600;
  font-size: 18px;
  color: #212529;
  line-height: 1.3;
  flex-grow: 1; /* Take up available space */
  margin: 0 12px;
  word-break: break-word;
}

.qco-price { 
  font-weight: 700;
  font-size: 24px;
  color: #198754;
  white-space: nowrap; /* Prevent price from wrapping */
  flex-shrink: 0; /* Keep price fixed size */
}

/* Form fields */
.qco-field { 
  display: grid; 
  gap: 8px; 
  margin: 0;
}

.qco-field label { 
  font-weight: 500; 
  font-size: 14px; 
  color: #495057; 
  margin-bottom: 4px;
}

/* Inline two columns for name */
.qco-field-inline { 
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: 16px; 
}

#qco-form input, #qco-form select { 
  padding: 4px 16px; 
  border: 2px solid #e9ecef; 
  border-radius: 10px; 
  font-size: 16px;
  font-family: inherit;
  transition: all 0.2s;
  background: #fff;
}

#qco-form input:focus, #qco-form select:focus { 
  outline: none; 
  border-color: #0d6efd; 
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

#qco-form input::placeholder {
  color: #adb5bd;
}

/* Country select arrow */
.qco-country {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
  cursor: pointer;
}

/* Coupon input */
.qco-field input[type="text"][name="coupon_code"] {
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
}

/* Checkbox styling */
.qco-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  accent-color: #0d6efd;
}

.qco-field label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  font-weight: 400;
  cursor: pointer;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  transition: all 0.2s;
}

.qco-field label:has(input[type="checkbox"]):hover {
  background: #e9ecef;
}

/* Submit button */
.qco-submit { 
  margin-top: 16px; 
  padding: 16px 24px; 
  background: linear-gradient(135deg, #000 0%, #333 100%); 
  color: #fff; 
  border: 0; 
  border-radius: 12px; 
  width: 100%; 
  cursor: pointer; 
  font-weight: 700; 
  font-size: 16px;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.qco-submit:hover:not(:disabled) { 
  background: linear-gradient(135deg, #222 0%, #444 100%); 
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
}

.qco-submit:active { 
  transform: translateY(0);
}

.qco-submit:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Add space after sticky button */
.qco-submit::after {
  content: "";
  display: block;
  height: 16px;
}

/* Error message */
.qco-error { 
  color: #dc3545; 
  font-size: 14px; 
  font-weight: 500;
  background: #f8d7da;
  border: 1px solid #f5c2c7;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 12px;
  display: none;
}

.qco-error:not(:empty) {
  display: block;
}

.qco-hidden { display: none !important; }

/* Gumroad-style upsell container */
.qco-upsell-container {
  margin: 24px 0 16px;
  padding: 20px 0 0;
  border-top: 1px solid #e9ecef;
}

/* Title for upsell */
.qco-upsell-title {
  font-weight: 600;
  font-size: 15px;
  color: #495057;
  margin-bottom: 16px;
  text-align: center;
}

/* Grid for upsell products */
.qco-upsell-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

/* Upsell product card */
.qco-upsell-item {
  position: relative;
  background: #fff;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.qco-upsell-item:hover {
  border-color: #0d6efd;
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.1);
  transform: translateY(-2px);
}

/* Selected upsell card */
.qco-upsell-item.selected {
  border-color: #0d6efd;
  background: #f8f9ff;
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.15);
}

/* Upsell badge in corner */
.qco-upsell-badge {
  position: absolute;
  top: -1px;
  right: -1px;
  background: #0d6efd;
  color: white;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 0 8px 0 8px;
  letter-spacing: 0.5px;
}

/* Upsell thumbnail */
.qco-upsell-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  margin: 8px 0 6px;
  border: 1px solid #dee2e6;
}

/* Upsell description */
.qco-upsell-desc {
  font-size: 12px;
  font-weight: 500;
  color: #495057;
  line-height: 1.3;
  margin-bottom: 4px;
  text-align: center;
  flex-grow: 1;
  display: flex;
  align-items: center;
}

/* Upsell price */
.qco-upsell-price {
  font-size: 14px;
  font-weight: 700;
  color: #198754;
  margin-top: 4px;
}

/* Selected checkmark */
.qco-upsell-item.selected::after {
  content: "?";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 20px;
  height: 20px;
  background: #198754;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  #qco-overlay .qco-modal {
    margin: 1vh 8px;
    max-height: 90vh;
    border-radius: 12px;
  }
  
  .qco-body {
    padding: 20px 16px;
    max-height: calc(90vh - 30px);
  }
  
  .qco-product-summary {
    padding: 16px;
    gap: 12px;
  }
  
 .qco-thumb {
    width: 56px;
    height: 56px;
  }

  .qco-title {
    font-size: 16px;
    margin: 0 8px;
  }
  
  .qco-price {
    font-size: 18px;
  }
  
  .qco-field-inline {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .qco-upsell-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  
  .qco-upsell-item {
    min-height: 120px;
    padding: 10px;
  }
  
  .qco-upsell-thumb {
    width: 50px;
    height: 50px;
  }
}

/* Very small screens */
@media (max-width: 360px) {
  .qco-upsell-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .qco-product-summary {
    flex-direction: column;
    text-align: center;
  }
  
  .qco-title {
    margin: 8px 0 4px;
  }
}

/* Loading spinner for submit button */
.qco-submit.loading {
  position: relative;
  color: transparent;
}

.qco-submit.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}



/* Center WooCommerce order-pay page content on desktop */
body.woocommerce-order-pay .woocommerce {
  display: flex !important;
  justify-content: center !important;
  align-items: flex-start !important;
  min-height: 60vh;
  padding: 40px 20px;
}

body.woocommerce-order-pay .woocommerce form.checkout,
body.woocommerce-order-pay .woocommerce .woocommerce-checkout {
  max-width: 500px !important;
  width: 100% !important;
  background: #fff;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  padding: 32px;
  border-radius: 16px;
  border: 1px solid #e9ecef;
}

/* Center the payment methods section */
body.woocommerce-order-pay .woocommerce-checkout-payment {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin-top: 20px;
}

/* Style the Pay button to match your modal */
body.woocommerce-order-pay #place_order {
  background: linear-gradient(135deg, #000 0%, #333 100%) !important;
  color: #fff !important;
  padding: 16px 24px !important;
  border-radius: 12px !important;
  font-weight: 700 !important;
  font-size: 16px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  border: none !important;
  width: 100% !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  box-shadow: 0 4px 12px rgba(0,0,0,.15) !important;
}

body.woocommerce-order-pay #place_order:hover {
  background: linear-gradient(135deg, #222 0%, #444 100%) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 20px rgba(0,0,0,.2) !important;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  body.woocommerce-order-pay .woocommerce {
    padding: 20px 10px !important;
  }
  
  body.woocommerce-order-pay .woocommerce form.checkout,
  body.woocommerce-order-pay .woocommerce .woocommerce-checkout {
    max-width: 100% !important;
    padding: 20px !important;
    box-shadow: none !important;
    border-radius: 8px !important;
  }
}

/* Hide sidebar or other distracting elements on order-pay */
body.woocommerce-order-pay .sidebar,
body.woocommerce-order-pay aside {
  display: none !important;
}

/* Make the main content full width */
body.woocommerce-order-pay .site-main,
body.woocommerce-order-pay main {
  width: 100% !important;
}


