/**
 * GilGamez Sovereign Store Platform — Storefront CSS
 * Strictly adheres to DEVELOPMENT_RULES.md (Rule #2 Zero Emoji, Rule #6 >=44px Touch Targets, Rule #19 0-Scroll)
 * and ui-spec.md & copy-deck.md.
 */

@import './tokens.css';

/* ─────────────────────────────────────────────────────────────
   1. Reset & Global Base
───────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--store-surface-0);
  color: var(--store-text-primary);
  font-family: var(--store-font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.mono {
  font-family: var(--store-font-mono);
}

.text-gold {
  color: var(--store-text-gold);
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 1920px) {
  .container {
    max-width: 1440px;
    padding: 0 24px;
  }
}

/* Accessibility Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--store-accent-primary);
  color: #0a0d14;
  padding: 10px 16px;
  font-weight: 700;
  border-radius: var(--store-radius-sm);
  z-index: 9999;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 16px;
}

/* ─────────────────────────────────────────────────────────────
   2. Storefront Pinned Header & Commerce Mode Bar
───────────────────────────────────────────────────────────── */
.storefront-header {
  position: sticky;
  top: 0;
  width: 100%;
  height: 68px;
  background-color: var(--store-surface-1);
  border-bottom: 1px solid var(--store-border-subtle);
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 16px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--store-accent-subtle);
  color: var(--store-accent-primary);
  border: 1px solid rgba(197, 160, 89, 0.2);
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--store-text-primary);
}

.brand-name-gold {
  color: var(--store-accent-primary);
}

/* Commerce Mode Segmented Tabs */
.commerce-mode-nav {
  display: inline-flex;
  align-items: center;
  background: var(--store-surface-inset);
  padding: 4px;
  border-radius: var(--store-radius-full);
  border: 1px solid var(--store-border-subtle);
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 18px;
  border-radius: var(--store-radius-full);
  border: 0;
  background: transparent;
  color: var(--store-text-secondary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.mode-tab:hover {
  color: var(--store-text-primary);
}

.mode-tab.is-active {
  background: var(--store-accent-primary);
  color: #0a0d14;
  box-shadow: 0 2px 8px var(--store-accent-glow);
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* User Chip / Sign In Slot */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--store-surface-inset);
  padding: 4px 12px 4px 6px;
  border-radius: var(--store-radius-full);
  border: 1px solid var(--store-border-subtle);
  min-height: 44px;
}

.user-avatar-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--store-radius-full);
  background: var(--store-accent-primary);
  color: #0a0d14;
  font-weight: 800;
  font-size: 13px;
}

.user-name-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--store-text-primary);
}

/* ─────────────────────────────────────────────────────────────
   3. Buttons & Interactive Controls (Rule #6 >=44px)
───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 18px;
  border-radius: var(--store-radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  text-align: center;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--store-shadow-focus);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--store-accent-primary);
  color: #0a0d14;
  border-color: var(--store-accent-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--store-accent-hover);
  border-color: var(--store-accent-hover);
}

.btn-outline {
  background: transparent;
  color: var(--store-text-primary);
  border-color: var(--store-border-medium);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--store-accent-primary);
  color: var(--store-accent-primary);
  background: var(--store-accent-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--store-text-secondary);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--store-surface-hover);
  color: var(--store-text-primary);
}

.btn-danger {
  background: var(--store-status-danger);
  color: #ffffff;
  border-color: var(--store-status-danger);
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
}

.btn-sm {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 13px;
}

.btn-lg {
  min-height: 48px;
  padding: 12px 24px;
  font-size: 15px;
}

.btn-full {
  width: 100%;
}

/* ─────────────────────────────────────────────────────────────
   4. Form Controls & Inputs
───────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--store-text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  background: var(--store-surface-inset);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-sm);
  color: var(--store-text-primary);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--store-border-focus);
  box-shadow: var(--store-shadow-focus);
}

.form-hint {
  display: block;
  font-size: 12px;
  color: var(--store-text-muted);
  margin-top: 4px;
}

/* ─────────────────────────────────────────────────────────────
   5. Badges & Pills
───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--store-radius-full);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--store-status-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--store-status-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--store-status-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-gold {
  background: var(--store-accent-subtle);
  color: var(--store-text-gold);
  border: 1px solid rgba(197, 160, 89, 0.3);
}

.badge-neutral {
  background: rgba(100, 116, 139, 0.15);
  color: var(--store-status-neutral);
  border: 1px solid rgba(100, 116, 139, 0.3);
}

/* ─────────────────────────────────────────────────────────────
   6. Main Content Area & Surface Layouts
───────────────────────────────────────────────────────────── */
#store-main {
  min-height: calc(100vh - 68px);
  padding: 24px 0 64px 0;
}

.page-header-deck {
  margin-bottom: 24px;
}

.page-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--store-text-primary);
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--store-text-secondary);
}

/* Filter Bar & Search */
.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.category-filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.category-filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--store-radius-full);
  background: var(--store-surface-1);
  border: 1px solid var(--store-border-subtle);
  color: var(--store-text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.filter-pill:hover {
  color: var(--store-text-primary);
  border-color: var(--store-border-medium);
}

.filter-pill.is-active {
  background: var(--store-accent-primary);
  color: #0a0d14;
  border-color: var(--store-accent-primary);
  font-weight: 700;
}

.search-input-wrapper {
  position: relative;
  min-width: 260px;
  max-width: 360px;
  flex: 1;
}

.search-icon-slot {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--store-text-muted);
  pointer-events: none;
}

.search-input {
  padding-left: 42px;
}

/* ─────────────────────────────────────────────────────────────
   7. Game Top-Up Catalog & Wizard Layout
───────────────────────────────────────────────────────────── */
/* Game Catalog Grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.game-card {
  display: flex;
  flex-direction: column;
  background: var(--store-surface-1);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-md);
  padding: 16px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  min-height: 180px;
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: var(--store-border-focus);
  box-shadow: var(--store-shadow-card);
}

.game-card-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: var(--store-surface-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--store-accent-primary);
  margin-bottom: 12px;
  border: 1px solid var(--store-border-subtle);
}

.game-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--store-text-primary);
  margin-bottom: 4px;
}

.game-card-publisher {
  font-size: 12px;
  color: var(--store-text-secondary);
  margin-bottom: 12px;
}

.game-card-badge {
  margin-top: auto;
  align-self: flex-start;
}

/* 4-Step Purchase Wizard Layout */
.topup-wizard-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: flex-start;
}

.wizard-steps-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.wizard-step-card {
  background: var(--store-surface-1);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-md);
  padding: 24px;
  box-shadow: var(--store-shadow-card);
}

.step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.step-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-number-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--store-radius-full);
  background: var(--store-accent-subtle);
  color: var(--store-accent-primary);
  font-weight: 800;
  font-size: 13px;
  border: 1px solid rgba(197, 160, 89, 0.3);
}

.step-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--store-text-primary);
}

/* Selected Game Banner in Step 1 */
.selected-game-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--store-surface-inset);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-sm);
  padding: 14px 18px;
  margin-bottom: 20px;
}

.banner-icon-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--store-surface-1);
  color: var(--store-accent-primary);
  border: 1px solid var(--store-border-subtle);
}

.banner-meta-title {
  font-size: 16px;
  font-weight: 700;
}

.banner-meta-publisher {
  font-size: 13px;
  color: var(--store-text-secondary);
}

/* Nickname Validation Status */
.player-validation-deck {
  margin-top: 10px;
}

/* Step 2: Denomination Selector Cards (SKU Grid) */
.denomination-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.nominal-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--store-surface-inset);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 96px;
  position: relative;
}

.nominal-card:hover {
  border-color: var(--store-border-medium);
  background: var(--store-surface-hover);
}

.nominal-card.is-selected {
  border-color: var(--store-accent-primary);
  background: var(--store-accent-subtle);
  box-shadow: 0 0 0 1px var(--store-accent-primary);
}

.nominal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.nominal-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--store-text-primary);
}

.bonus-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--store-status-success);
  white-space: nowrap;
}

.nominal-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 6px;
}

.nominal-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--store-text-gold);
  white-space: nowrap;
}

.nominal-badge-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--store-accent-subtle);
  color: var(--store-text-gold);
  white-space: nowrap;
  line-height: 1.2;
}

/* Step 3: Payment Method Tabs & Accordion */
.payment-channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.payment-tab-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--store-surface-inset);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 60px;
  text-align: left;
}

.payment-tab-btn:hover {
  border-color: var(--store-border-medium);
  background: var(--store-surface-hover);
}

.payment-tab-btn.is-selected {
  border-color: var(--store-accent-primary);
  background: var(--store-accent-subtle);
  box-shadow: 0 0 0 1px var(--store-accent-primary);
}

.channel-icon-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--store-surface-1);
  color: var(--store-accent-primary);
  border: 1px solid var(--store-border-subtle);
  flex-shrink: 0;
}

.channel-info-deck {
  flex: 1;
}

.channel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--store-text-primary);
}

.channel-fee-label {
  font-size: 12px;
  color: var(--store-text-muted);
}

/* Step 4: Sticky Checkout Summary Deck */
.checkout-summary-column {
  position: sticky;
  top: 88px;
}

.checkout-summary-card {
  background: var(--store-surface-1);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-md);
  padding: 24px;
  box-shadow: var(--store-shadow-card);
}

.summary-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--store-border-subtle);
}

.summary-line-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: var(--store-text-secondary);
  margin-bottom: 10px;
}

.summary-total-divider {
  border-top: 1px dashed var(--store-border-medium);
  margin: 16px 0;
}

.summary-total-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.total-due-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--store-text-primary);
}

.total-due-figure {
  font-size: 22px;
  font-weight: 800;
  color: var(--store-text-gold);
}

/* ─────────────────────────────────────────────────────────────
   8. Official Merchandise Storefront
───────────────────────────────────────────────────────────── */
.merch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.merch-card {
  background: var(--store-surface-1);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.merch-card:hover {
  transform: translateY(-3px);
  border-color: var(--store-border-focus);
  box-shadow: var(--store-shadow-card);
}

.merch-card-figure {
  width: 100%;
  height: 220px;
  background: var(--store-surface-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--store-accent-primary);
  border-bottom: 1px solid var(--store-border-subtle);
  position: relative;
}

.merch-card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.merch-brand-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--store-text-gold);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.merch-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--store-text-primary);
  margin-bottom: 6px;
}

.merch-card-desc {
  font-size: 13px;
  color: var(--store-text-secondary);
  margin-bottom: 16px;
  flex: 1;
}

.merch-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--store-border-subtle);
}

.merch-card-price {
  font-size: 17px;
  font-weight: 800;
  color: var(--store-text-gold);
}

/* Merchandise Product Detail & Variant Picker View */
.merch-detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  align-items: flex-start;
  background: var(--store-surface-1);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-lg);
  padding: 32px;
}

.merch-gallery-deck {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--store-surface-inset);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--store-accent-primary);
}

.merch-spec-deck {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.variant-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.variant-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.variant-group-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--store-text-secondary);
}

.size-pill-row, .color-swatch-row, .edition-chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.size-pill-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--store-radius-sm);
  background: var(--store-surface-inset);
  border: 1px solid var(--store-border-subtle);
  color: var(--store-text-primary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.size-pill-btn:hover {
  border-color: var(--store-border-medium);
}

.size-pill-btn.is-selected {
  border-color: var(--store-accent-primary);
  background: var(--store-accent-subtle);
  color: var(--store-text-gold);
  box-shadow: 0 0 0 1px var(--store-accent-primary);
}

.color-swatch-btn {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: var(--store-radius-sm);
  background: var(--store-surface-inset);
  border: 1px solid var(--store-border-subtle);
  color: var(--store-text-primary);
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-swatch-btn.is-selected {
  border-color: var(--store-accent-primary);
  background: var(--store-accent-subtle);
  color: var(--store-text-gold);
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: var(--store-radius-full);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.edition-chip-btn {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--store-radius-sm);
  background: var(--store-surface-inset);
  border: 1px solid var(--store-border-subtle);
  color: var(--store-text-primary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.edition-chip-btn.is-selected {
  border-color: var(--store-accent-primary);
  background: var(--store-accent-subtle);
  color: var(--store-text-gold);
}

/* Quantity Stepper */
.quantity-stepper {
  display: inline-flex;
  align-items: center;
  background: var(--store-surface-inset);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-sm);
  min-height: 44px;
}

.stepper-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--store-text-primary);
  cursor: pointer;
  transition: background 0.2s;
}

.stepper-btn:hover {
  background: var(--store-surface-hover);
}

.stepper-value {
  width: 48px;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
}

/* Merch Actions Row */
.merch-actions-row {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

/* ─────────────────────────────────────────────────────────────
   9. Real-Time Payment Drawer & Countdown Modal
───────────────────────────────────────────────────────────── */
.cmc-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.cmc-modal.is-open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 13, 20, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  background: var(--store-surface-2);
  border: 1px solid var(--store-border-medium);
  border-radius: var(--store-radius-lg);
  box-shadow: var(--store-shadow-modal);
  width: 100%;
  max-width: 460px;
  padding: 24px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--store-border-subtle);
  padding-bottom: 14px;
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--store-text-primary);
}

.order-ref {
  font-size: 13px;
  color: var(--store-text-secondary);
  margin-top: 2px;
}

.btn-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  min-width: 36px;
  border-radius: var(--store-radius-full);
  background: var(--store-surface-inset);
  border: 1px solid var(--store-border-subtle);
  color: var(--store-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-close:hover {
  background: var(--store-surface-hover);
  color: var(--store-text-primary);
}

/* 15-Minute Countdown Timer Banner */
.countdown-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--store-radius-sm);
  padding: 12px 16px;
}

.timer-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--store-status-warning);
}

.timer-clock {
  font-size: 20px;
  font-weight: 800;
  color: var(--store-status-warning);
}

/* Total Due Card */
.total-due-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--store-surface-inset);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-sm);
  padding: 14px 18px;
}

.total-label {
  font-size: 14px;
  color: var(--store-text-secondary);
}

.total-amount {
  font-size: 22px;
  font-weight: 800;
  color: var(--store-text-gold);
}

/* Dynamic QRIS Panel */
.qris-payment-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--store-surface-inset);
  border-radius: var(--store-radius-sm);
  border: 1px solid var(--store-border-subtle);
}

.qr-canvas-wrapper {
  background: #ffffff;
  padding: 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.qris-code {
  width: 180px;
  height: 180px;
  object-fit: contain;
}

.instruction-note {
  font-size: 13px;
  color: var(--store-text-secondary);
  text-align: center;
}

/* Virtual Account Panel */
.va-payment-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--store-surface-inset);
  border-radius: var(--store-radius-sm);
  border: 1px solid var(--store-border-subtle);
}

.va-number-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--store-surface-2);
  border: 1px solid var(--store-border-medium);
  border-radius: var(--store-radius-sm);
  padding: 12px 16px;
}

.va-number-string {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--store-text-primary);
}

/* Live SSE Fulfillment Status Tracker */
.fulfillment-tracker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 18px;
  background: var(--store-surface-inset);
  border-radius: var(--store-radius-sm);
  border: 1px solid var(--store-border-subtle);
}

.tracker-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--store-text-gold);
}

.status-indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--store-radius-full);
  background: var(--store-text-gold);
}

.status-indicator-dot.pulse {
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.tracker-explanation {
  font-size: 12px;
  color: var(--store-text-muted);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--store-border-subtle);
  padding-top: 16px;
}

/* ─────────────────────────────────────────────────────────────
   10. Order Delivery Tracking Timeline View
───────────────────────────────────────────────────────────── */
.tracking-view-deck {
  max-width: 680px;
  margin: 0 auto;
}

.tracking-search-card {
  background: var(--store-surface-1);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-md);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--store-shadow-card);
}

.tracking-form-inline {
  display: flex;
  gap: 12px;
  align-items: center;
}

.tracking-result-card {
  background: var(--store-surface-1);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-md);
  padding: 24px;
  box-shadow: var(--store-shadow-card);
}

.tracking-meta-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--store-border-subtle);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.tracking-timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 32px;
}

.tracking-timeline::before {
  content: '';
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 10px;
  width: 2px;
  background: var(--store-border-medium);
}

.timeline-item {
  position: relative;
  padding-bottom: 24px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -32px;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: var(--store-radius-full);
  background: var(--store-surface-inset);
  border: 2px solid var(--store-border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.timeline-item.is-completed .timeline-dot {
  background: var(--store-accent-primary);
  border-color: var(--store-accent-primary);
  color: #0a0d14;
}

.timeline-stage-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--store-text-primary);
}

.timeline-item.is-completed .timeline-stage-title {
  color: var(--store-text-gold);
}

.timeline-stage-desc {
  font-size: 13px;
  color: var(--store-text-secondary);
  margin-top: 2px;
}

.timeline-timestamp {
  font-size: 12px;
  color: var(--store-text-muted);
  margin-top: 4px;
}

/* ─────────────────────────────────────────────────────────────
   11. Shipping Address & Courier Drawer
───────────────────────────────────────────────────────────── */
.shipping-drawer {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 480px;
  height: 100%;
  background: var(--store-surface-2);
  border-left: 1px solid var(--store-border-medium);
  box-shadow: var(--store-shadow-drawer);
  z-index: 1000;
  padding: 24px;
  overflow-y: auto;
  flex-direction: column;
  gap: 20px;
}

.shipping-drawer.is-open {
  display: flex;
}

.courier-option-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--store-surface-inset);
  border: 1px solid var(--store-border-subtle);
  border-radius: var(--store-radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 10px;
}

.courier-option-card:hover {
  border-color: var(--store-border-medium);
}

.courier-option-card.is-selected {
  border-color: var(--store-accent-primary);
  background: var(--store-accent-subtle);
}

/* ─────────────────────────────────────────────────────────────
   12. Toast Notification Container
───────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
  max-width: 360px;
  width: calc(100% - 32px);
}

.toast-card {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--store-surface-2);
  border: 1px solid var(--store-border-medium);
  border-radius: var(--store-radius-sm);
  box-shadow: var(--store-shadow-modal);
  color: var(--store-text-primary);
  font-size: 14px;
  animation: toast-slide-in 0.25s ease forwards;
}

.toast-card.is-dismissing {
  animation: toast-fade-out 0.2s ease forwards;
}

.toast-success {
  border-left: 4px solid var(--store-status-success);
}

.toast-error {
  border-left: 4px solid var(--store-status-danger);
}

.toast-info {
  border-left: 4px solid var(--store-accent-primary);
}

.toast-warning {
  border-left: 4px solid var(--store-status-warning);
}

.toast-close-btn {
  background: transparent;
  border: 0;
  color: var(--store-text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.toast-close-btn:hover {
  color: var(--store-text-primary);
}

@keyframes toast-slide-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-fade-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(16px); }
}

/* ─────────────────────────────────────────────────────────────
   13. Responsive Breakpoints (360, 768, 1280, 1920 px)
───────────────────────────────────────────────────────────── */
/* Mobile Portrait (< 768px, specifically 360x800) */
@media (max-width: 767px) {
  .storefront-header {
    height: auto;
    padding: 12px 0;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 10px;
  }

  .commerce-mode-nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .mode-tab {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
  }

  .topup-wizard-layout {
    grid-template-columns: 1fr;
  }

  .checkout-summary-column {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 90;
    background: var(--store-surface-1);
    border-top: 1px solid var(--store-border-medium);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
    padding: 12px 16px;
  }

  .checkout-summary-card {
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .checkout-summary-card .summary-title,
  .checkout-summary-card .summary-line-item,
  .checkout-summary-card .summary-total-divider {
    display: none;
  }

  .checkout-summary-card .summary-total-item {
    margin-bottom: 8px;
  }

  /* Pad main bottom so content isn't covered by sticky deck */
  #store-main {
    padding-bottom: 120px;
  }

  .merch-detail-layout {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .merch-grid {
    grid-template-columns: 1fr;
  }

  .denomination-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .payment-channel-grid {
    grid-template-columns: 1fr;
  }

  .tracking-form-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .tracking-form-inline .search-input-wrapper {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .tracking-form-inline .btn {
    width: 100%;
  }

  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
    width: auto;
  }
}

/* Tablet Portrait (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .topup-wizard-layout {
    grid-template-columns: 1fr;
  }
  
  .checkout-summary-column {
    position: static;
  }

  .merch-detail-layout {
    grid-template-columns: 1fr;
  }

  .denomination-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .merch-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop Laptop (1024px - 1919px) */
@media (min-width: 1024px) {
  .denomination-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .merch-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Desktop Widescreen (>= 1920px) */
@media (min-width: 1920px) {
  .merch-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .denomination-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
