/* ========================================
   WebGame Topup - Gaming Style UI
   Modern, Bold, Mobile-First
   ======================================== */

:root {
  /* Colors - Cyber Gaming Theme */
  --primary: #00f5d4;
  --primary-dark: #00c4a7;
  --primary-glow: rgba(0, 245, 212, 0.3);
  --secondary: #7b2cbf;
  --accent: #ff6b6b;
  --accent-gold: #ffd700;
  
  /* Backgrounds */
  --bg-dark: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-hover: #1a1a25;
  --bg-input: #1e1e2a;
  --bg-gradient: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #0f0f1a 100%);
  
  /* Text */
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);
  
  /* Effects */
  --border-color: rgba(255, 255, 255, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px var(--primary-glow);
  
  /* Spacing */
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* App Container */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-gradient);
  position: relative;
}

.app::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 20%, rgba(0, 245, 212, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(123, 44, 191, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ========================================
   Header
   ======================================== */
.header {
  position: relative;
  padding: var(--spacing-md);
  padding-top: calc(var(--spacing-md) + env(safe-area-inset-top));
  z-index: 10;
}

.header-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0, 245, 212, 0.1) 0%, transparent 100%);
  z-index: -1;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 10px var(--primary));
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 10px var(--primary)); }
  50% { filter: drop-shadow(0 0 20px var(--primary)); }
}

.logo-text {
  font-family: 'Orbitron', monospace;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--primary) 0%, #fff 50%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-badge {
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 6px 12px;
  background: var(--primary);
  color: var(--bg-dark);
  border-radius: 20px;
  letter-spacing: 2px;
}

/* ========================================
   Progress Bar
   ======================================== */
.progress-bar {
  padding: 0 var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  position: relative;
  z-index: 10;
}

.progress-track {
  height: 3px;
  background: var(--border-color);
  border-radius: 10px;
  margin-bottom: var(--spacing-sm);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 10px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px var(--primary-glow);
}

.steps {
  display: flex;
  justify-content: space-between;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.4;
  transition: all 0.3s ease;
}

.step.active, .step.done {
  opacity: 1;
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  font-weight: 700;
  transition: all 0.3s ease;
}

.step.active .step-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--bg-dark);
  box-shadow: 0 0 15px var(--primary-glow);
}

.step.done .step-dot {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
}

.step span {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
  flex: 1;
  padding: 0 var(--spacing-md);
  padding-bottom: var(--spacing-xl);
  position: relative;
  z-index: 10;
}

.section {
  animation: fadeInUp 0.4s ease;
}

.section.hidden {
  display: none;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Section Header */
.section-header {
  margin-bottom: var(--spacing-lg);
}

.section-title {
  font-family: 'Orbitron', monospace;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-icon {
  font-size: 24px;
}

/* Search Box */
.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 12px 16px;
  padding-left: 44px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.5;
}

/* Category Tabs */
.category-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: var(--spacing-lg);
}

.cat-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cat-tab:hover {
  background: var(--bg-card-hover);
}

.cat-tab.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: var(--primary);
  color: var(--bg-dark);
}

.cat-icon {
  font-size: 18px;
}

/* ========================================
   Game Grid
   ======================================== */
.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (min-width: 400px) {
  .game-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.game-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.game-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.game-card:hover::before {
  transform: scaleX(1);
}

.game-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 20px var(--primary-glow);
}

.game-card.selected::before {
  transform: scaleX(1);
}

.game-icon {
  font-size: 32px;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.game-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ========================================
   Back Button
   ======================================== */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: var(--spacing-md);
  transition: all 0.3s ease;
}

.back-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ========================================
   Game Banner
   ======================================== */
.game-banner {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  overflow: hidden;
}

.game-banner-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.1) 0%, rgba(123, 44, 191, 0.1) 100%);
  z-index: 0;
}

.game-banner-content {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  z-index: 1;
}

.game-banner-icon {
  width: 60px;
  height: 60px;
  background: var(--bg-dark);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: var(--shadow-md);
}

.game-banner-info h3 {
  font-family: 'Orbitron', monospace;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.game-banner-tag {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
}

/* ========================================
   Product List
   ======================================== */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
}

.product-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(0, 245, 212, 0.3);
}

.product-card.selected {
  border-color: var(--primary);
  background: rgba(0, 245, 212, 0.05);
}

.product-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.product-name {
  font-size: 13px;
  font-weight: 600;
}

.product-price {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

/* ========================================
   Selected Product Card
   ======================================== */
.selected-product-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.1) 0%, rgba(123, 44, 191, 0.1) 100%);
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-lg);
}

.selected-product-icon {
  font-size: 28px;
}

.selected-product-info {
  display: flex;
  flex-direction: column;
}

.selected-product-name {
  font-size: 14px;
  font-weight: 600;
}

.selected-product-price {
  font-family: 'Orbitron', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

/* ========================================
   Input Card
   ======================================== */
.input-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
}

.input-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--spacing-lg);
}

.input-icon {
  font-size: 24px;
}

.input-card-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.form-fields {
  display: flex;
  gap: 12px;
  margin-bottom: var(--spacing-md);
}

.input-group {
  flex: 1;
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.input-group input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  outline: none;
  transition: all 0.3s ease;
}

.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

/* Nickname Box */
.nickname-box {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: var(--spacing-md);
}

.nickname-box.hidden {
  display: none;
}

.nickname-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.nickname-box.success .nickname-status {
  color: var(--primary);
}

.nickname-box.error .nickname-status {
  color: var(--accent);
}

.nickname-value {
  font-size: 18px;
  font-weight: 700;
}

.nickname-box.error .nickname-value {
  color: var(--accent);
  font-size: 14px;
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  border-radius: var(--radius-md);
  color: var(--bg-dark);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-confirm {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--secondary) 0%, #9d4edd 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  margin-top: var(--spacing-sm);
}

.btn-confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(123, 44, 191, 0.4);
}

.btn-confirm.hidden {
  display: none;
}

/* ========================================
   Result Card
   ======================================== */
.result-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  text-align: center;
}

.result-header {
  margin-bottom: var(--spacing-lg);
}

/* Success Animation */
.success-animation {
  margin-bottom: var(--spacing-md);
}

.success-circle {
  width: 70px;
  height: 70px;
  margin: 0 auto;
}

.success-circle svg {
  width: 100%;
  height: 100%;
}

.success-circle circle {
  stroke: var(--primary);
  stroke-width: 2;
  stroke-dasharray: 157;
  stroke-dashoffset: 157;
  animation: circle-draw 0.6s ease forwards;
}

.success-circle path {
  stroke: var(--primary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  animation: check-draw 0.4s ease forwards 0.4s;
}

@keyframes circle-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes check-draw {
  to { stroke-dashoffset: 0; }
}

.result-title {
  font-family: 'Orbitron', monospace;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.result-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Order ID Box */
.order-id-box {
  background: linear-gradient(135deg, rgba(0, 245, 212, 0.1) 0%, rgba(123, 44, 191, 0.1) 100%);
  border: 2px dashed var(--primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  cursor: pointer;
  transition: all 0.3s ease;
}

.order-id-box:hover {
  background: rgba(0, 245, 212, 0.15);
}

.order-id-box:active {
  transform: scale(0.98);
}

.order-id {
  display: block;
  font-family: 'Orbitron', monospace;
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 3px;
  margin-bottom: 4px;
  text-shadow: 0 0 20px var(--primary-glow);
}

.copy-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Order Details */
.order-details {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  text-align: left;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 13px;
  color: var(--text-muted);
}

.detail-value {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.detail-value.highlight {
  color: var(--primary);
}

.detail-row.total {
  padding-top: var(--spacing-sm);
  margin-top: var(--spacing-xs);
}

.detail-row.total .detail-label {
  font-weight: 700;
  color: var(--text-primary);
}

.detail-row.total .detail-value {
  font-family: 'Orbitron', monospace;
  font-size: 16px;
  color: var(--primary);
}

/* Payment Info */
.payment-info {
  display: flex;
  gap: 12px;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  text-align: left;
}

.info-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.payment-info p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.payment-info strong {
  color: var(--accent-gold);
}

/* New Order Button */
.btn-new-order {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.btn-new-order:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  color: var(--primary);
}

/* ========================================
   Footer
   ======================================== */
.footer {
  padding: var(--spacing-lg);
  text-align: center;
  position: relative;
  z-index: 10;
}

.footer p {
  font-size: 11px;
  color: var(--text-muted);
}

/* ========================================
   Loading State
   ======================================== */
.loading-state {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-muted);
}

.loader {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto var(--spacing-sm);
  animation: spin 0.8s linear infinite;
}

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

/* ========================================
   Toast
   ======================================== */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ========================================
   Responsive
   ======================================== */
@media (min-width: 480px) {
  .main-content {
    max-width: 480px;
    margin: 0 auto;
  }
}