/* =============================================================
 * polish.css — design refinement layer
 *
 * Sits ABOVE the per-screen stylesheets in the cascade so the
 * cross-cutting upgrades (skeletons, elevations, micro-interactions)
 * apply uniformly without rewriting each screen.
 *
 * Organized by the design phases:
 *   §1  Skeleton shimmer primitive
 *   §2  Card elevation hierarchy
 *   §3  Wallet card refinement
 *   §4  Tab bar elevation
 *   §5  Unified header spec
 *   §6  Profile hero
 *   §7  Tappable feedback
 *   §8  Empty-state pattern
 * ============================================================= */


/* ---------- §1 Skeleton shimmer ----------
   The skeleton block is the in-flight placeholder for any field that
   hydrates from the API. It animates a subtle horizontal gradient so
   the user sees "this is loading, not broken." Sized by callers via
   width/height or width: <px>/height: <px> utilities. */
@keyframes lhs-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton {
  display: inline-block;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: lhs-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-lg);
  color: transparent;
  user-select: none;
  vertical-align: middle;
}
.skeleton.sk-text { height: 12px; min-width: 60px; }
.skeleton.sk-text-lg { height: 18px; min-width: 80px; }
.skeleton.sk-text-xl { height: 28px; min-width: 120px; }
.skeleton.sk-pill { height: 16px; min-width: 64px; border-radius: var(--radius-full); }
.skeleton.sk-line { display: block; height: 12px; }
.skeleton.sk-card { display: block; height: 88px; width: 100%; border-radius: var(--radius-xl); }
.skeleton.sk-avatar { width: 40px; height: 40px; border-radius: var(--radius-full); }

/* When a skeleton sits on the wallet card (orange surface) the white
   stripe gets blown out — soften it. */
.wallet-card .skeleton,
.balance-card .skeleton,
.hero-card .skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(255, 255, 255, 0.32) 50%,
    rgba(255, 255, 255, 0.18) 100%
  );
  background-size: 200% 100%;
}


/* ---------- §2 Card elevation hierarchy ----------
   Three levels. Default (no class) = flat surface. .elevated adds a
   1px highlight rim and a soft drop. .featured adds an accent-tinted
   glow so the user's eye lands on it first. */
.elevated {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 8px 18px rgba(0, 0, 0, 0.35);
}
.featured {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 12px 28px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 106, 0, 0.12),
    0 6px 24px rgba(255, 106, 0, 0.18);
}


/* ---------- §3 Wallet card ---------- */
.wallet-card {
  position: relative;
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(255, 255, 255, 0.22) 0%, transparent 55%),
    linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: var(--radius-3xl);
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.30) inset,
    0 18px 32px rgba(255, 106, 0, 0.25);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.wallet-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 100% at 0% 100%, rgba(10, 10, 10, 0.14) 0%, transparent 60%);
  pointer-events: none;
}
.wallet-card .label {
  color: var(--on-accent);
  opacity: 0.78;
  font-size: 12px;
  font-weight: 500;
}
.wallet-card .amount {
  color: var(--on-accent);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.wallet-card .amount small {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.7;
  margin-inline-end: 6px;
}
/* Equalize the two action buttons: both translucent dark with rim. */
.wallet-card .actions { gap: 10px; }
.wallet-card .actions button {
  background: rgba(10, 10, 10, 0.22);
  border: 1px solid rgba(10, 10, 10, 0.28);
  color: var(--on-accent);
  font-weight: 700;
  padding: 11px;
  border-radius: var(--radius-lg);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
}
.wallet-card .actions button.primary {
  background: var(--on-accent);
  color: #fff;
  border-color: rgba(0, 0, 0, 0.55);
}
.wallet-card .actions button svg { color: currentColor; }


/* ---------- §4 Tab bar elevation ---------- */
.tabbar {
  background: rgba(28, 28, 30, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 6px 16px rgba(0, 0, 0, 0.45),
    0 16px 36px rgba(0, 0, 0, 0.35);
}
.tabbar .tab {
  transition: color 0.18s ease;
}
.tabbar .tab.active { color: var(--accent); }
.tabbar .tab.shop .shop-circle {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 6px 16px rgba(255, 106, 0, 0.45);
}


/* ---------- §5 Unified header spec ----------
   .page-header is the new pattern; legacy headers can opt in by
   adding the class. Defaults: title right, optional action left. */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 12px;
  gap: 12px;
}
.page-header .title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.page-header .sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.page-header .action {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: border-color 0.18s, color 0.18s;
}
.page-header .action:hover { border-color: var(--accent); color: var(--accent); }


/* Legacy headers — quietly inherit the polish without rewriting markup. */
.detail-header, .header-row, .subs-header, .shop-header {
  padding-top: 14px;
  padding-bottom: 12px;
}
.subs-header .title,
.shop-header .title,
.detail-header .title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
}


/* ---------- §6 Profile hero ---------- */
.profile-screen .hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 8px 18px rgba(0, 0, 0, 0.35);
}
.profile-screen .hero .avatar {
  width: 52px;
  height: 52px;
  background: var(--surface-2);
  color: var(--accent);
  border: 1px solid var(--border);
  font-weight: 800;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.profile-screen .hero .meta { flex: 1; text-align: start; min-width: 0; }
.profile-screen .hero .meta .name {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-screen .hero .meta .id {
  font-size: 12px;
  color: var(--text-muted);
  direction: ltr;
  text-align: start;
  margin-top: 4px;
}


/* ---------- §7 Tappable feedback ----------
   Subtle press for any primary CTA / pill / card the user can tap. */
.cta-primary,
.buy-new,
.sheet .cta-primary,
.tabbar .tab,
.more-tile,
.plan-card .buy,
.filter-pills .pill,
.sub-list-card .btns button,
.wallet-card .actions button,
.balance-card .btns button,
.invite-card .share,
.profile-row .switch,
.faq-item summary,
.notif-card,
.sheet-plan,
.page-header .action {
  transition:
    transform 0.12s ease-out,
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}
.cta-primary:active,
.buy-new:active,
.sheet .cta-primary:active,
.more-tile:active,
.plan-card .buy:active,
.sub-list-card .btns button:active,
.wallet-card .actions button:active,
.balance-card .btns button:active,
.invite-card .share:active,
.notif-card:active,
.sheet-plan:active {
  transform: scale(0.985);
}


/* ---------- §8 Empty-state pattern ----------
   Centered icon + headline + sub + optional action. Replaces the
   plain bordered "خطا در بارگذاری" boxes across the app. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 18px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-xl);
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}
.empty-state .icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.empty-state .icon svg { width: 20px; height: 20px; }
.empty-state .title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.empty-state .sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 280px;
}
.empty-state .retry {
  margin-top: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
}
.empty-state .retry:hover { border-color: var(--accent); color: var(--accent); }


/* ---------- Misc rhythm tightening ---------- */
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
}
.section-title > span { color: var(--text-primary); font-size: 14px; }
.section-title .more {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

#app {
  /* Slightly cooler background so the orange CTA pops without
     vibrating against pure-black. */
  background: linear-gradient(180deg, #0B0B0D 0%, var(--bg) 220px);
}
