/* ========================================
   Checkout Page Styles
   ======================================== */

.checkout-page {
  padding: 40px 0 80px;
  min-height: 70vh;
}

.checkout-title {
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  font-weight: 900;
  margin-bottom: 32px;
  text-align: center;
}

/* ========== Orders Paused Banner ========== */
.checkout-paused-banner {
  background: linear-gradient(90deg, rgba(255, 170, 0, 0.15), rgba(255, 170, 0, 0.08));
  border: 1px solid rgba(255, 170, 0, 0.4);
  border-radius: 10px;
  padding: 14px 20px;
  margin-bottom: 24px;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: #ffaa00;
}
.checkout-paused-banner.hidden { display: none; }

/* ========== Progress Steps ========== */
.checkout-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 48px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.progress-step.active .step-circle {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}
.progress-step.completed .step-circle {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: #000;
}

.step-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.progress-step.active .step-name,
.progress-step.completed .step-name {
  color: var(--accent);
}

.progress-line {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  margin: 0 12px;
  margin-bottom: 24px;
}

/* ========== Layout ========== */
.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 40px;
  align-items: start;
}

/* ========== Step Content ========== */
.checkout-step {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.step-heading {
  font-size: clamp(1rem, 3vw, 1.3rem);
  font-weight: 800;
  margin-bottom: 4px;
}
.step-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 24px;
}

.step-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}
.step-actions .btn {
  flex: 1;
  justify-content: center;
}

/* ========== Roblox Lookup ========== */
.lookup-input-row {
  display: flex;
  gap: 10px;
}
.lookup-input-row .form-input {
  flex: 1;
}

.roblox-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 255, 136, 0.15);
  margin-top: 16px;
}
.roblox-preview-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--accent);
}
.roblox-preview-name {
  font-weight: 700;
  font-size: 1.05rem;
}
.roblox-preview-username {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.roblox-preview-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.roblox-confirmed {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 255, 136, 0.3);
  margin-top: 16px;
}

.roblox-confirmed-badge {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(0, 255, 136, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.roblox-lookup-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(255, 68, 102, 0.1);
  border: 1px solid rgba(255, 68, 102, 0.2);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.85rem;
}

/* ========== Form ========== */
.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.checkout-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checkout-form .form-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.checkout-form .form-input {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
.checkout-form .form-input:focus {
  border-color: var(--accent);
}

.consent-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  cursor: pointer;
}
.consent-label input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.consent-label a {
  color: var(--accent);
  text-decoration: underline;
}
.consent-label a:hover {
  opacity: 0.8;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.code-input-row {
  display: flex;
  gap: 8px;
}
.code-input-row .form-input {
  flex: 1;
}

.code-status {
  transition: color 0.2s;
}
.code-status.valid {
  color: var(--accent);
  font-weight: 600;
}
.code-status.invalid {
  color: var(--danger);
  font-weight: 600;
}

/* ========== Payment Options Grid ========== */
.payment-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 480px;
  margin: 0 auto;
}

.payment-option-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  background: var(--bg-secondary);
  border: 2px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  color: var(--text-primary);
  font-family: inherit;
  font-size: inherit;
}
.payment-option-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
}
.payment-option-card.active {
  border-color: var(--accent);
  background: rgba(0, 255, 136, 0.06);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.08);
}
.payment-option-card.active .payment-card-icon {
  color: var(--accent);
  background: rgba(0, 255, 136, 0.1);
}

.payment-card-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
}

.payment-option-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.payment-option-card strong {
  font-size: 0.92rem;
  font-weight: 700;
}
.payment-option-card span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ========== Order Summary ========== */
.checkout-summary {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: sticky;
  top: 80px;
}

.summary-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.summary-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.summary-item {
  display: flex;
  gap: 12px;
  align-items: center;
}
.summary-item-img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.summary-item-info {
  flex: 1;
  min-width: 0;
}
.summary-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.summary-item-qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.summary-qty-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s;
}
.summary-qty-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.summary-item-qty {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 16px;
  text-align: center;
}
.summary-item-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.bulk-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  background: rgba(11,221,57,0.12);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 4px;
  vertical-align: middle;
}

.summary-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 14px 0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--text-secondary);
}
.summary-total {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}
.summary-total span:last-child {
  color: var(--accent);
}
.discount-amount {
  color: var(--accent);
  font-weight: 600;
}

/* ========== Empty Cart ========== */
.checkout-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.checkout-empty h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}
.checkout-empty p {
  margin-bottom: 20px;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .checkout-layout {
    grid-template-columns: 1fr;
  }

  .checkout-summary {
    position: static;
    order: -1;
  }

  .checkout-step {
    padding: 24px 20px;
  }

  .checkout-progress {
    max-width: 100%;
  }

  .step-name {
    font-size: 0.65rem;
  }

  .roblox-preview,
  .roblox-confirmed {
    flex-wrap: wrap;
  }

  .roblox-preview-actions {
    width: 100%;
    margin-left: 0;
    margin-top: 8px;
  }
}

@media (max-width: 480px) {
  .checkout-page { padding: 20px 0 48px; }
  .checkout-title { font-size: 1.4rem; margin-bottom: 20px; }
  .checkout-step { padding: 18px 16px; }
  .step-heading { font-size: 1.1rem; }
  .step-desc { font-size: 0.82rem; }
  .checkout-progress { margin-bottom: 28px; }
  .progress-line { margin: 0 6px; }
  .step-circle { width: 30px; height: 30px; font-size: 0.78rem; }
  .step-name { font-size: 0.6rem; }
  .checkout-form .form-input { padding: 10px 14px; font-size: 0.85rem; }
  .lookup-input-row { flex-direction: column; }
  .code-input-row { flex-direction: column; }
  .payment-options-grid { grid-template-columns: 1fr; max-width: 100%; }
  .payment-option-card { padding: 16px 18px; }
  .payment-card-icon { width: 42px; height: 42px; min-width: 42px; }
  .payment-option-card strong { font-size: 0.85rem; }
  .step-actions { flex-direction: column; }
  .step-actions .btn { width: 100%; justify-content: center; }
  .checkout-summary { padding: 18px; }
  .summary-item-img { width: 40px; height: 40px; }
  .roblox-preview-avatar { width: 48px; height: 48px; }
  .roblox-confirmed-badge { font-size: 0.7rem; padding: 3px 10px; }
}

@media (max-width: 360px) {
  .payment-options-grid { grid-template-columns: 1fr; gap: 10px; }
  .checkout-title { font-size: 1.2rem; }
  .step-name { display: none; }
  .checkout-step { padding: 14px 12px; }
  .step-heading { font-size: 1rem; }
  .checkout-summary { padding: 14px; }
  .roblox-preview { flex-direction: column; text-align: center; }
  .roblox-preview-actions { margin-left: 0; justify-content: center; }
  .roblox-confirmed { flex-direction: column; text-align: center; }
  .roblox-confirmed-badge { margin-left: 0; }
}

/* Turnstile widget centering */
#checkoutTurnstile iframe {
  margin: 0 auto;
}
#checkoutTurnstile > div {
  margin: 0 auto;
}

/* Highlight pulse for unconfirmed Roblox preview */
.highlight-pulse {
  animation: highlightPulse 0.5s ease-in-out 2;
}
@keyframes highlightPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
  50% { box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.5); }
}

/* Base Space Confirmation Modal */
.base-space-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(6px);
  animation: bsm-fade-in 0.2s ease;
}
@keyframes bsm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.base-space-card {
  background: var(--bg-card, #1a1a2e);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 36px 32px 28px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  animation: bsm-slide-up 0.25s ease;
}
@keyframes bsm-slide-up {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.base-space-icon {
  margin-bottom: 16px;
}
.base-space-icon svg {
  color: var(--accent, #00d2ff);
  opacity: 0.85;
}
.base-space-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}
.base-space-card p {
  color: var(--text-secondary, #ccc);
  margin-bottom: 8px;
  font-size: 0.95rem;
  line-height: 1.5;
}
.base-space-card strong {
  color: var(--accent, #00d2ff);
  font-size: 1.15em;
  font-weight: 800;
}
.base-space-hint {
  font-size: 0.82rem !important;
  color: var(--text-muted, #888) !important;
  margin-bottom: 24px !important;
}
.base-space-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.base-space-actions .btn {
  flex: 1;
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 12px;
  white-space: nowrap;
}

/* ========== Checkout — 600px breakpoint ========== */
@media (max-width: 600px) {
  .checkout-layout {
    grid-template-columns: 1fr;
  }
  .checkout-summary {
    position: static;
    order: -1;
  }
  .checkout-step {
    padding: 20px 16px;
  }
  /* Stack form fields vertically */
  .checkout-form .form-group {
    width: 100%;
  }
  .lookup-input-row {
    flex-direction: column;
  }
  .code-input-row {
    flex-direction: column;
  }
  /* Full-width buttons */
  .step-actions {
    flex-direction: column;
  }
  .step-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
  /* Payment grid to single column */
  .payment-options-grid {
    grid-template-columns: 1fr;
    max-width: 100%;
  }
  /* Touch targets */
  .payment-option-card {
    min-height: 44px;
  }
  .consent-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }
  /* Images */
  .roblox-preview-avatar,
  .summary-item-img {
    max-width: 100%;
  }
  .base-space-actions {
    flex-direction: column;
  }
  .base-space-actions .btn {
    width: 100%;
    min-height: 44px;
  }
}
