/* Visibility toggle */
.pack-modal.hidden {
  display: none;
}

/* Modal shell */
.pack-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

/* Backdrop */
.pack-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

/* Modal card */
.pack-modal-content {
  position: relative;
  max-width: 520px;
  margin: 10vh auto;
  background: #fff;
  color: #111;
  border-radius: 12px;
  padding: 0;
  z-index: 1;
  max-height: 85vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.15),
    0 1px 2px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.pack-modal-content * {
  box-sizing: border-box;
}

.pack-modal-content img {
  max-width: 100%;
  height: auto;
}

/* Modal header */
.pack-modal-header {
  padding: 5px 26px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* Close button */
.pack-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: #666;
  font-size: 22px;
  cursor: pointer;
  z-index: 1;
}

.pack-modal-close:hover {
  color: #000;
}

/* Title */
#packTitle {
  margin: 8px 0;
  font-size: 20px;
  font-weight: 600;
}

/* Description */
#packDescription {
  margin: 0;
  font-size: 14px;
  color: #444;
}

/* Modal body */
.pack-modal-body {
  padding: 16px 26px;
}

/* Order summary section */
.order-summary {
  background: #f9fafb;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  overflow: hidden;
  max-width: 100%;
}

.order-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.order-summary-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: #111;
}

.order-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  max-width: 100%;
}

.order-item-image {
  width: 30px;
  height: auto;
  min-width: 30px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
}

.order-item-image:not([src]),
.order-item-image[src=""] {
  display: none;
}

.order-item-details {
  flex: 1;
  min-width: 0;
}

.order-item-name {
  font-size: 14px;
  margin-bottom: 4px;
}

.order-item-qty {
  font-size: 13px;
  color: #666;
}

.order-item-price {
  text-align: right;
  flex-shrink: 0;
}

.order-item-amount {
  font-size: 15px;
  display: block;
}

.order-item-points {
  font-size: 12px;
  color: #666;
}

.order-totals {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.order-total-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 14px;
}

.points-earned {
  color: #059669;
}

.discount-amount {
  color: #dc2626;
}

/* Promo Code Section */
.promo-code-section {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  flex-wrap: wrap;
}

.promo-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  min-width: 150px;
}

.promo-input:focus {
  outline: none;
  border-color: #2563eb;
}

.promo-input:disabled {
  background: #f3f4f6;
  color: #6b7280;
}

.promo-apply-btn {
  padding: 8px 16px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.promo-apply-btn:hover:not(:disabled) {
  background: #e5e7eb;
}

.promo-apply-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.promo-success {
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  background: #d1fae5;
  color: #065f46;
  border-radius: 6px;
  font-size: 13px;
  display: none;
}

.promo-error {
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 6px;
  font-size: 13px;
  display: none;
}

/* Payment method tabs */
.payment-tabs {
  margin-bottom: 16px;
}

.payment-tabs-header {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 16px;
}

.payment-tab {
  flex: 1;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.2s;
}

.payment-tab:hover {
  color: #111;
}

.payment-tab.active {
  color: #111;
  border-bottom-color: #111;
}

.payment-tab-content {
  display: none;
}

.payment-tab-content.active {
  display: block;
}

/* Payment method specific styles */
.payment-method-card {
  background: #f9fafb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.balance-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  border-radius: 6px;
  margin-bottom: 8px;
  border: 1px solid #e5e7eb;
}

.balance-label {
  font-size: 13px;
  color: #6b7280;
}

.balance-amount {
  font-weight: 600;
  font-size: 15px;
}

.payment-breakdown {
  background: #f9fafb;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
}

.breakdown-row:last-child {
  margin-bottom: 0;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
  font-weight: 500;
}

.insufficient-balance {
  background: #fef2f2;
  border-color: #fecaca;
  padding: 10px;
  border-radius: 6px;
  margin-top: 8px;
}

.insufficient-balance-text {
  font-size: 13px;
  color: #991b1b;
  margin: 0;
}

.add-funds-link {
  color: #2563eb;
  text-decoration: underline;
  font-weight: 500;
}

/* Stripe Payment Element container */
#payment-element {
  margin-bottom: 8px;
}

#payment-errors {
  color: #dc2626;
  font-size: 13px;
  margin-top: 8px;
  min-height: 20px;
}

/* TOS Disclaimer */
.tos-disclaimer {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #9ca3af;
  text-align: center;
}

.tos-disclaimer a {
  color: #9ca3af;
  text-decoration: underline;
}

/* Small inline spinner */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: rgba(255, 255, 255, 1);
  border-radius: 50%;
  animation: btnSpin 0.8s linear infinite;
}

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

/* Mobile responsive */
@media (max-width: 640px) {
  .pack-modal-content {
    margin: 5vh 16px;
    max-height: 90vh;
  }

  .payment-tab {
    font-size: 13px;
    padding: 10px 12px;
  }
}
