/**
 * Simorix StarPay - Telegram Mini App (TMA) Stylesheet
 * Developer & Sponsor: Simorix IT (https://simorixit.ir)
 * Responsive, Glassmorphism, Dark Theme, Telegram WebApp Native
 */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg-primary: #07090e;
  --bg-secondary: #0d121d;
  --bg-card: rgba(16, 22, 36, 0.78);
  --bg-card-hover: rgba(22, 30, 48, 0.88);
  
  --border-subtle: 1px solid rgba(255, 255, 255, 0.08);
  --border-cyan: 1px solid rgba(0, 242, 254, 0.35);
  --border-card: 1px solid rgba(255, 255, 255, 0.1);
  
  --neon-cyan: #00f2fe;
  --neon-blue: #4facfe;
  --neon-purple: #8b5cf6;
  --neon-green: #10b981;
  --neon-gold: #f59e0b;
  
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #64748b;
  
  --font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family);
  direction: rtl;
  text-align: right;
  line-height: 1.5;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

body {
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(32px, env(safe-area-inset-bottom));
}

/* Ambient Glowing Orbs */
.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.25;
  pointer-events: none;
}

.orb-top {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, var(--neon-cyan) 0%, transparent 70%);
  top: -100px;
  right: -80px;
}

.orb-bottom {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, var(--neon-purple) 0%, transparent 70%);
  bottom: 5%;
  left: -80px;
}

/* Container */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 14px 16px;
}

/* App Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  color: #07090e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.35);
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
}

.user-handle {
  font-size: 0.75rem;
  color: var(--neon-cyan);
  font-weight: 600;
  direction: ltr;
  text-align: right;
}

.rate-chip {
  padding: 7px 12px;
  border-radius: 12px;
  background: rgba(0, 242, 254, 0.08);
  border: var(--border-cyan);
  font-size: 0.76rem;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  white-space: nowrap;
}

.rate-chip span {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.rate-chip strong {
  color: var(--neon-cyan);
  font-weight: 800;
}

.user-wallet-chip {
  padding: 5px 10px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.35);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.user-wallet-chip:active {
  background: rgba(16, 185, 129, 0.2);
  transform: scale(0.97);
}

/* Hero Promo Banner */
.hero-banner {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.12) 0%, rgba(139, 92, 246, 0.12) 100%);
  border: 1px solid rgba(0, 242, 254, 0.28);
  margin-bottom: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: shimmer 6s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  30%, 100% { left: 200%; }
}

.hero-icon {
  font-size: 2.4rem;
  line-height: 1;
  flex-shrink: 0;
  animation: floatBounce 4s ease-in-out infinite;
}

@keyframes floatBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.hero-text-content {
  flex: 1;
}

.hero-tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(0, 242, 254, 0.2);
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--neon-cyan);
  margin-bottom: 4px;
}

.hero-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.hero-subtitle {
  font-size: 0.78rem;
  color: #cbd5e1;
  line-height: 1.45;
}

/* Category Tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.tab-chip {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  flex-shrink: 0;
}

.tab-chip:hover, .tab-chip.active {
  background: rgba(0, 242, 254, 0.14);
  border-color: var(--neon-cyan);
  color: #fff;
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.2);
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

@media (max-width: 360px) {
  .products-grid {
    grid-template-columns: 1fr;
  }
}

.product-card {
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: var(--border-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: all 0.28s ease;
  cursor: pointer;
  min-height: 220px;
}

.product-card:hover, .product-card:active {
  border-color: rgba(0, 242, 254, 0.5);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), 0 0 16px rgba(0, 242, 254, 0.15);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.product-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: inset 0 0 10px rgba(0, 242, 254, 0.1);
}

.product-badge {
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 800;
  background: rgba(0, 242, 254, 0.15);
  color: var(--neon-cyan);
  border: 1px solid rgba(0, 242, 254, 0.3);
  white-space: nowrap;
}

.card-info {
  flex: 1;
  margin-bottom: 12px;
}

.product-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.35;
}

.product-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
}

.price-box {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.price-toman {
  font-size: 0.95rem;
  font-weight: 900;
  color: #fff;
}

.price-ton {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--neon-cyan);
  direction: ltr;
}

.buy-btn {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-blue) 100%);
  color: #07090e;
  border: none;
  font-weight: 900;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(0, 242, 254, 0.3);
}

.buy-btn:active {
  transform: scale(0.98);
}

/* Sponsor & Developer Footer */
.sponsor-footer {
  text-align: center;
  padding: 24px 10px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.sponsor-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--neon-cyan);
  text-decoration: none;
  font-weight: 800;
  padding: 4px 12px;
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.2);
  border-radius: 12px;
  margin-top: 6px;
  transition: all 0.2s;
}

.sponsor-link:hover, .sponsor-link:active {
  background: rgba(0, 242, 254, 0.16);
  border-color: var(--neon-cyan);
}

/* Checkout Bottom Sheet (Drawer) */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.32s ease;
}

.sheet-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.sheet-card {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 520px;
  margin: 0 auto;
  background: rgba(13, 18, 30, 0.98);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-top: 1px solid rgba(0, 242, 254, 0.35);
  border-radius: 28px 28px 0 0;
  padding: 20px 20px 30px;
  z-index: 1001;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -15px 50px rgba(0, 0, 0, 0.95);
  max-height: 88vh;
  overflow-y: auto;
}

.sheet-card.active {
  transform: translateY(0);
}

.sheet-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sheet-handle {
  width: 44px;
  height: 5px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  margin: 0 auto 12px;
}

.sheet-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.sheet-close-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

/* Product selected summary inside sheet */
.checkout-summary-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.summary-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
}

.summary-subtitle {
  font-size: 0.72rem;
  color: var(--neon-cyan);
}

.summary-price-toman {
  font-weight: 900;
  font-size: 1.1rem;
  color: #fff;
  text-align: left;
}

.summary-price-ton {
  font-size: 0.75rem;
  color: var(--neon-cyan);
  text-align: left;
  direction: ltr;
}

/* Payment Selector Tabs */
.payment-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.pay-option {
  padding: 11px 8px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: var(--border-subtle);
  text-align: center;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.25s;
}

.pay-option.active {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--neon-cyan);
  color: #fff;
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.2);
}

/* Physical Styled Bank Card Widget */
.bank-card-widget {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

.bank-card-widget::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

.bank-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.bank-card-chip {
  width: 32px;
  height: 24px;
  background: linear-gradient(135deg, #ffd700, #b8860b);
  border-radius: 5px;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.4);
}

.bank-card-bankname {
  font-size: 0.85rem;
  font-weight: 800;
  color: #e2e8f0;
}

.bank-card-number-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 10px;
  direction: ltr;
}

.bank-card-number-text {
  font-family: monospace;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
}

.bank-card-holder-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #cbd5e1;
}

.bank-card-holder-name {
  font-weight: 800;
  color: #fff;
}

/* TON Crypto Wallet Box */
.ton-widget {
  background: linear-gradient(135deg, rgba(0, 152, 234, 0.12) 0%, rgba(13, 18, 30, 0.9) 100%);
  border: 1px solid rgba(0, 242, 254, 0.3);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
}

.ton-widget-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.ton-badge {
  background: #0098ea;
  color: #fff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
}

.ton-amount-highlight {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--neon-cyan);
  direction: ltr;
}

.ton-address-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 12px;
  border-radius: 12px;
  margin-bottom: 10px;
  gap: 8px;
}

.ton-address-text {
  font-family: monospace;
  font-size: 0.74rem;
  color: #cbd5e1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
  text-align: left;
  flex: 1;
}

.copy-btn {
  background: var(--neon-cyan);
  color: #07090e;
  border: none;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.copy-btn:active {
  transform: scale(0.95);
}

/* Form Controls */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-label span.req {
  color: #ef4444;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 14px rgba(0, 242, 254, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

.form-input::placeholder {
  color: #64748b;
  font-size: 0.8rem;
}

/* Toast Message Notification */
.toast-msg {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--neon-cyan);
  color: #fff;
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 800;
  z-index: 2000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(0, 242, 254, 0.3);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

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

/* Order Success Modal */
.success-modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.success-modal.active {
  opacity: 1;
  visibility: visible;
}

.success-card {
  width: 100%;
  max-width: 420px;
  background: rgba(17, 24, 39, 0.98);
  border: 1px solid var(--neon-cyan);
  border-radius: 24px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(0, 242, 254, 0.2);
}

.success-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: pulseIcon 1.5s infinite;
}

@keyframes pulseIcon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.success-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 8px;
}

.success-desc {
  font-size: 0.84rem;
  color: #cbd5e1;
  line-height: 1.6;
  margin-bottom: 16px;
}

.order-id-badge {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid var(--neon-cyan);
  border-radius: 12px;
  font-family: monospace;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--neon-cyan);
  margin-bottom: 18px;
}
