// SS5 — Paywall sheet, Light Mode

function CloseX({ size = 56, color = '#0F172A' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none">
      <path d="M6 6 L18 18 M18 6 L6 18" stroke={color}
        strokeWidth="2" strokeLinecap="round" />
    </svg>
  );
}

function ProductCard({ tier, price, period, sub, footnote, selected, recommended }) {
  return (
    <div style={{
      position: 'relative',
      background: selected ? 'rgba(21,128,61,0.04)' : RC.surfaceLight,
      borderRadius: 28,
      padding: '40px 44px',
      border: selected
        ? `3px solid ${RC.accentLight}`
        : `1.5px solid ${RC.borderLight}`,
      display: 'flex', alignItems: 'center', gap: 32,
    }}>
      {/* Radio */}
      <div style={{
        width: 56, height: 56, borderRadius: 9999, flexShrink: 0,
        border: selected ? 'none' : `2px solid ${RC.borderLight}`,
        background: selected ? RC.accentLight : 'transparent',
        display: 'flex', alignItems: 'center', justifyContent: 'center',
      }}>
        {selected && (
          <svg width="32" height="32" viewBox="0 0 24 24" fill="none">
            <path d="M5 12.5 L10 17.5 L19 7"
              stroke="#FFFFFF" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round" />
          </svg>
        )}
      </div>
      {/* Text */}
      <div style={{ flex: 1, minWidth: 0 }}>
        <div style={{
          fontSize: 42, fontWeight: 600, color: RC.textPrimaryLight,
          letterSpacing: -0.5, fontFamily: RC.fontSans,
        }}>{tier}</div>
        <div style={{
          marginTop: 6,
          fontSize: 28, color: RC.textSecondaryLight, fontWeight: 400,
        }}>{sub}</div>
        {footnote && (
          <div style={{
            marginTop: 4,
            fontSize: 24, color: RC.textSecondaryLight, fontWeight: 500,
          }}>{footnote}</div>
        )}
      </div>
      {/* Price */}
      <div style={{ textAlign: 'right', flexShrink: 0 }}>
        <div style={{
          fontSize: 48, fontWeight: 700, color: RC.textPrimaryLight,
          letterSpacing: -1, fontFamily: RC.fontSans,
          fontVariantNumeric: 'tabular-nums',
        }}>{price}</div>
        <div style={{
          fontSize: 26, color: RC.textSecondaryLight, fontWeight: 400, marginTop: 2,
        }}>/ {period}</div>
      </div>
      {/* Recommended badge */}
      {recommended && (
        <div style={{
          position: 'absolute', top: -22, right: 36,
          padding: '8px 22px',
          borderRadius: 9999,
          background: RC.accentLight, color: '#FFFFFF',
          fontSize: 24, fontWeight: 600,
          fontFamily: RC.fontSans, letterSpacing: 1,
          boxShadow: '0 4px 12px rgba(21,128,61,0.3)',
        }}>★ 推荐</div>
      )}
    </div>
  );
}

function ChecklistItem({ children }) {
  return (
    <div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
      <svg width="32" height="32" viewBox="0 0 24 24" fill="none">
        <circle cx="12" cy="12" r="11" fill={RC.accentLight} opacity="0.12"/>
        <path d="M7 12.5 L10.5 16 L17 8.5"
          stroke={RC.accentLight} strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round" />
      </svg>
      <span style={{
        fontSize: 30, color: RC.textPrimaryLight, fontWeight: 500,
        fontFamily: RC.fontSans, letterSpacing: -0.2,
      }}>{children}</span>
    </div>
  );
}

function SS5Paywall() {
  return (
    <ScreenshotShell
      dark={false}
      headline="帮孩子沉进日常练习"
      subline="3天免费体验 · 随时取消"
      caption="App Store 内购 · 苹果官方渠道保障"
    >
      <div style={{ position: 'absolute', inset: 0, background: RC.surfaceLight, overflow: 'hidden' }}>
        <StatusBar dark={false} />

        {/* Sheet handle */}
        <div style={{
          position: 'absolute', top: 150, left: '50%',
          transform: 'translateX(-50%)',
          width: 96, height: 8, borderRadius: 9999,
          background: '#CBD5E1',
        }} />

        {/* Close × top-left */}
        <div style={{ position: 'absolute', top: 200, left: 48 }}>
          <CloseX size={60} color={RC.textPrimaryLight} />
        </div>

        {/* Compliance hint near top */}
        <div style={{
          position: 'absolute', top: 230, left: '50%',
          transform: 'translateX(-50%)',
          fontSize: 26, color: RC.textTertiaryLight, fontWeight: 400,
        }}>建议在家长指导下开通订阅</div>

        {/* Main content */}
        <div style={{
          position: 'absolute', top: 320, left: 0, right: 0,
          padding: '0 56px',
        }}>
          {/* Title */}
          <div style={{
            fontSize: 64, fontWeight: 700, color: RC.textPrimaryLight,
            letterSpacing: -1.6, fontFamily: RC.fontSans,
            lineHeight: 1.1,
          }}>帮孩子稳定提升<br/>中考体测成绩</div>

          {/* Subtitle */}
          <div style={{
            marginTop: 22,
            fontSize: 32, color: RC.textSecondaryLight, fontWeight: 400,
            lineHeight: 1.4, letterSpacing: -0.2,
          }}>9省中考标准 · 实时分数对照 · 隐私本地</div>

          {/* Feature checklist */}
          <div style={{
            marginTop: 44,
            display: 'flex', flexDirection: 'column', gap: 22,
          }}>
            <ChecklistItem>摄像头自动计数，无需手数</ChecklistItem>
            <ChecklistItem>实时对照中考评分，跳完即知</ChecklistItem>
            <ChecklistItem>完整历史与趋势，看见进步轨迹</ChecklistItem>
            <ChecklistItem>数据本地处理，不上传云端</ChecklistItem>
          </div>

          {/* Product cards */}
          <div style={{
            marginTop: 48,
            display: 'flex', flexDirection: 'column', gap: 20,
          }}>
            <ProductCard
              tier="月订阅"
              price="¥6"
              period="月"
              sub="灵活短期备考"
              selected={false}
              recommended={false}
            />
            <ProductCard
              tier="年订阅"
              price="¥58"
              period="年"
              sub="3 天免费试用"
              footnote="≈ ¥4.83 / 月  最划算"
              selected={true}
              recommended={true}
            />
          </div>

          {/* Primary CTA */}
          <button style={{
            marginTop: 36,
            width: '100%', height: 124, borderRadius: 22,
            background: RC.accentLight, color: '#FFFFFF',
            fontSize: 42, fontWeight: 600, letterSpacing: 1,
            border: 'none', cursor: 'pointer',
            fontFamily: RC.fontSans,
            boxShadow: '0 6px 18px rgba(21,128,61,0.28)',
          }}>开始 3 天免费试用</button>

          {/* Renewal disclosure */}
          <div style={{
            marginTop: 20,
            fontSize: 24, color: RC.textTertiaryLight, fontWeight: 400,
            textAlign: 'center', lineHeight: 1.4,
          }}>试用结束后自动按 ¥58/年 续费，可随时在设置取消</div>

          {/* Footer links */}
          <div style={{
            marginTop: 28,
            display: 'flex', alignItems: 'center', justifyContent: 'center',
            gap: 30,
            fontSize: 26, color: RC.textSecondaryLight, fontWeight: 500,
          }}>
            <span>恢复购买</span>
            <span style={{ opacity: 0.4 }}>·</span>
            <span>隐私政策</span>
            <span style={{ opacity: 0.4 }}>·</span>
            <span>用户协议</span>
          </div>
        </div>
      </div>
    </ScreenshotShell>
  );
}

window.SS5Paywall = SS5Paywall;
