/* ═══════════════════════════════════════════════════════
   Skipstars — Full Dashboard Mini App Styles
   ═══════════════════════════════════════════════════════ */

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

:root {
  --bg:          var(--tg-theme-bg-color, #0a0a0f);
  --bg-card:     var(--tg-theme-secondary-bg-color, rgba(255,255,255,0.05));
  --border:      rgba(255,255,255,0.08);
  --text:        var(--tg-theme-text-color, #f0f0f4);
  --text-muted:  var(--tg-theme-hint-color, rgba(240,240,244,0.5));
  --accent:      #7B61FF;
  --accent-2:    #00D4AA;
  --gradient:    linear-gradient(135deg, #7B61FF 0%, #00D4AA 100%);
  --radius:      18px;
  --radius-sm:   12px;
  --font:        'Inter', -apple-system, sans-serif;
  --tab-h:       68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── Background ─────────────────────────────────────── */
.bg-grid {
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(123,97,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(123,97,255,0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none; z-index: 0;
}
body::before {
  content: '';
  position: fixed; top: -160px; left: 50%; transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(123,97,255,0.1) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

/* ── Full-center layout (loading / success / error) ─── */
.full-center {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 24px;
  z-index: 10;
  text-align: center;
}

/* ── Connect / Pay container ─────────────────────────── */
.container {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 16px; gap: 20px;
  overflow-y: auto;
}

/* ── Logo ────────────────────────────────────────────── */
.logo { display: flex; align-items: center; gap: 10px; user-select: none; }
.logo-img { width: 44px; height: 44px; border-radius: 12px; object-fit: contain; }
.logo-img-sm { width: 32px; height: 32px; border-radius: 9px; object-fit: contain; }
.logo-text { font-size: 20px; font-weight: 700; letter-spacing: -.5px; }
.logo-text-sm { font-size: 16px; font-weight: 700; }

@keyframes spin-once {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.spin-once { animation: spin-once 1s ease both; }

/* ── Card ────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  max-width: 460px; width: 100%;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: slideUp .35s ease both;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

h1 { font-size: 28px; font-weight: 700; letter-spacing: -1px; line-height: 1.2; margin-bottom: 10px; }
.gradient-text { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; line-height: 1.6; }

/* ── Features (connect page) ─────────────────────────── */
.features { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.feature { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-muted); }
.feature-icon { width: 30px; height: 30px; background: rgba(123,97,255,0.12); border-radius: 8px; display: grid; place-items: center; font-size: 15px; flex-shrink: 0; }

/* ── TonConnect button ───────────────────────────────── */
#tc-button-container, #tc-pay-button-container, #tc-settings-button-container { margin-bottom: 16px; }
tc-root button { width: 100% !important; border-radius: var(--radius-sm) !important; font-family: var(--font) !important; font-weight: 600 !important; }

/* ── Pay box ─────────────────────────────────────────── */
.pay-box { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 22px; display: flex; flex-direction: column; gap: 10px; }
.pay-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.pay-label { color: var(--text-muted); }
.pay-value { font-weight: 600; }
.pay-amount-big { font-size: 20px; font-weight: 700; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.mono { font-family: monospace; font-size: 11px; word-break: break-all; text-align: right; max-width: 200px; }
.mono-sm { font-family: monospace; font-size: 11px; word-break: break-all; }

/* Timer */
.timer-box { text-align: center; margin-bottom: 20px; }
.timer-label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 2px; }
.timer-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Status msg */
.status-msg { font-size: 12px; color: var(--text-muted); text-align: center; min-height: 18px; margin-bottom: 8px; }
.status-msg.error { color: #ff6b6b; }

/* Fine print */
.fine-print { font-size: 11px; color: rgba(240,240,244,0.28); text-align: center; line-height: 1.5; }

/* Buttons */
.btn-primary { display: block; width: 100%; padding: 13px 18px; background: var(--gradient); color: white; font-family: var(--font); font-size: 15px; font-weight: 600; border: none; border-radius: var(--radius-sm); cursor: pointer; text-align: center; transition: opacity .15s; }
.btn-primary:hover { opacity: .88; }
.btn-sm { padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; border: none; cursor: pointer; }
.btn-primary-sm { background: var(--gradient); color: white; }

/* Success / error icon */
.success-icon-big { font-size: 64px; margin-bottom: 16px; }

/* ── Spinner ─────────────────────────────────────────── */
.spinner { width: 48px; height: 48px; border: 3px solid rgba(123,97,255,0.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════
   DASHBOARD LAYOUT
   ══════════════════════════════════════════════════════ */
.dashboard-root {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  z-index: 1;
}

/* Header */
.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 12px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative; z-index: 2;
}
.dash-logo-row { display: flex; align-items: center; gap: 8px; }
.dash-user { display: flex; align-items: center; gap: 8px; }
.dash-username { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.wallet-badge { font-size: 11px; background: rgba(0,212,170,0.15); color: var(--accent-2); border-radius: 20px; padding: 3px 9px; font-weight: 600; }

/* Content area */
.dash-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px calc(var(--tab-h) + var(--safe-bottom) + 8px);
  -webkit-overflow-scrolling: touch;
}

/* Tab panels */
.tab-panel { display: none; animation: slideUp .25s ease both; }
.tab-panel.active { display: block; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.stat-card { background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.4); }
.stat-card-wide { grid-column: span 2; display: flex; align-items: center; justify-content: space-between; }
.stat-card-wide .stat-value { font-size: 28px; }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Section title */
.section-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }

/* Action grid */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.action-btn { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; font-family: var(--font); font-size: 12px; font-weight: 500; color: var(--text); transition: background .15s, border-color .15s; }
.action-btn:hover { background: rgba(123,97,255,0.1); border-color: rgba(123,97,255,0.3); }
.action-btn:hover .action-icon i { animation: bounceIcon 0.5s cubic-bezier(0.28, 0.84, 0.42, 1); }
.action-icon { font-size: 26px; display: inline-flex; justify-content: center; align-items: center; }
.action-icon i { 
  display: inline-block; 
  animation: floatIcon 4s ease-in-out infinite; 
}
@keyframes floatIcon {
  0% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}
@keyframes bounceIcon {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Product list */
.product-list { display: flex; flex-direction: column; gap: 10px; }
.product-item { background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.4); }
.product-item-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.product-title { font-size: 14px; font-weight: 600; }
.product-price { font-size: 14px; font-weight: 700; color: var(--accent-2); }
.product-meta { display: flex; align-items: center; justify-content: space-between; }
.product-badge { font-size: 11px; background: rgba(123,97,255,0.12); color: var(--accent); border-radius: 6px; padding: 2px 8px; }
.product-sales { font-size: 11px; color: var(--text-muted); }
.product-share { display: flex; gap: 8px; margin-top: 10px; }
.share-btn { flex: 1; padding: 8px; border-radius: 8px; font-size: 12px; font-weight: 600; border: none; cursor: pointer; font-family: var(--font); transition: opacity .15s; }
.share-btn:hover { opacity: .85; }
.share-btn-primary { background: rgba(255,255,255,0.1); color: var(--text); border: 1px solid rgba(255,255,255,0.2); }
.share-btn-secondary { background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid var(--border); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.status-dot.active { background: var(--accent-2); }
.status-dot.paused { background: #888; }

/* Empty state */
.empty-state { text-align: center; padding: 32px 16px; color: var(--text-muted); font-size: 14px; }

/* Tab header row */
.tab-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tab-title { font-size: 18px; font-weight: 700; }

/* Settings */
.settings-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
.settings-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.settings-label { font-size: 13px; color: var(--text-muted); flex-shrink: 0; }
.settings-value { font-size: 13px; font-weight: 500; text-align: right; word-break: break-all; }

/* ── Bottom Tab Bar ───────────────────────────────────── */
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex; background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 100;
}
.tab-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  border: none; background: transparent; cursor: pointer;
  font-family: var(--font);
  color: var(--text-muted);
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.tab-btn.active { color: var(--accent); }
.tab-icon { font-size: 20px; line-height: 1; }
.tab-label { font-size: 10px; font-weight: 600; letter-spacing: .3px; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 380px) {
  .card { padding: 24px 18px; }
  h1 { font-size: 24px; }
  .stat-value { font-size: 18px; }
}
