/* Course landing pages for ads and sharing (Meta, WhatsApp, Instagram): /courses/cat · /courses/ipmat · /courses/cuet
   (course.html, served by the server with that course's link-preview tags). Built to turn a visitor into a student:
   the promise and the free trial up top, what's free today, the course's plans with Buy now (Razorpay), how it works,
   FAQs, and the home page's sections at the bottom. A sticky bar keeps the next step one tap away on phones.
   Inside the Android app nothing is sold (no prices / buy buttons). */
const CP_DATA={
cat:{name:'CAT',chips:['CAT 2027','MBA entrance','IIMs & top B-schools'],
h1:['Your IIM call starts with ',<em key="e">one smart plan.</em>],
sub:'Every CAT paper since 2017, full mocks on the exact exam screen, topic tests that find your weak spots, and All-India live mocks — all in one place, at your pace, even at 2 a.m.',
plan:['Full CAT mocks on the real exam interface','VARC, DILR and QA sectional tests','Topic-wise tests for every area','All-India live mocks with your rank','Score, percentile and question-wise analysis'],
free:[['📜','Every CAT paper, 2017–2025','Timed like the real exam','cat-previous-year-papers.html','Free with login'],['🔍','Every question, solved','Answers and step-by-step solutions','/cat/pyq','Free · no login'],
['📖','Daily Reads for RC','A 180-day reading plan','daily-reads.html','Free to read'],['✍️','Grammar Rule Book','125 rules in 13 modules','grammar.html','Free to read'],['🧪','Lexicon Word Lab','1,685 exam words','lexicon.html','Free'],['🧭','MBA Guide 2026','Colleges, cut-offs, timelines','mba-guide-2026.html','Free']],
faq:[['Which CAT tests are in the plan?','Full mocks on the real CAT interface, VARC / DILR / QA sectional tests, topic-wise tests and All-India live mocks — each with score, percentile and a question-by-question analysis.']],
practice:'cat-mock-tests.html?view=mock'},
ipmat:{name:'IPMAT',chips:['After Class 12','IPMAT Indore & Rohtak','JIPMAT','IIM B (B.Sc.)'],
h1:['An IIM seat right after school — ',<em key="e">start practising today.</em>],
sub:'IPMAT Indore & Rohtak, JIPMAT and IIM B (B.Sc.) — four exams, four styles. Real previous-year papers, full mocks and topic tests built for each, so none of them surprises you.',
plan:['Full mocks for IPMAT Indore, Rohtak, JIPMAT and IIM B (B.Sc.)','Quant, Verbal and LR sectional tests','Topic-wise tests, topic by topic','All-India live mocks with your rank','Score, percentile and question-wise analysis'],
free:[['📜','IPMAT, JIPMAT & IIM B (B.Sc.) papers','Every paper since 2019, timed','UG-previous-year-papers.html','Free with login'],['🔍','Every question, solved','Answers and step-by-step solutions','/pyq#ipm','Free · no login'],
['📖','Daily Reads for RC','A 180-day reading plan','daily-reads.html','Free to read'],['✍️','Grammar Rule Book','Error-spotting made simple','grammar.html','Free to read'],['⚖️','Word Pairs','40 families of near-synonyms','almost-the-same-word.html','Free'],['🧭','UG Management Guide 2027','IPMAT, JIPMAT, NPAT, SET & more','ug-management-guide-2027.html','Free']],
faq:[['Does it cover JIPMAT and IIM B (B.Sc.)?','Yes — each exam has its own papers, mocks and topic tests, because each has its own pattern and style.']],
practice:'ipmat-mock-tests.html?view=mock'},
cuet:{name:'CUET',chips:['CUET (UG)','English · GAT · Domain','DU · BHU · JNU'],
h1:['Every subject you pick, ',<em key="e">practised the way it’s tested.</em>],
sub:'English, the General Aptitude Test and your domain subjects — full subject mocks, sectional and topic tests, and real CUET papers since 2022. Pay only for the subjects you take.',
plan:['Full subject mocks for English, GAT and domain subjects','Sectional and topic tests, subject by subject','Plans for all subjects — or just the ones you pick','Real CUET papers since 2022, with solutions','Score, percentile and question-wise analysis'],
free:[['📜','CUET papers since 2022','Every subject, timed','cuet-previous-year-papers.html','Free with login'],['🔍','Every question, solved','Answers and step-by-step solutions','/cuet/pyq','Free · no login'],
['📖','Daily Reads for RC','Reading practice for English','daily-reads.html','Free to read'],['✍️','Grammar Rule Book','Grammar for the English test','grammar.html','Free to read'],['🧪','Lexicon Word Lab','Vocabulary, drilled','lexicon.html','Free'],['🎭','RC Tone Guide','Tone and attitude questions','rc-tone-guide.html','Free']],
faq:[['Can I buy only my domain subjects?','Yes — choose a plan for every CUET subject, a ready subject bundle, or a pack where you pick your own subjects at checkout.']],
practice:'cuet.html?view=full'}};
const CP_CSS=`
.cp-hero{background:var(--navy-900,#131c66);color:#fff;padding:56px 0 60px}
.cp-hero .pk-wrap{display:grid;grid-template-columns:1.1fr .9fr;gap:44px;align-items:center}
.cp-chips{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 18px}.cp-chips span{font:700 11.5px/1 var(--font-body);letter-spacing:.04em;color:#fff;background:transparent;border:1.5px solid rgba(255,255,255,.45);border-radius:999px;padding:7px 12px}.cp-chips span:first-child{background:var(--brand-accent,#e02b2b);border-color:var(--brand-accent,#e02b2b);letter-spacing:.08em;text-transform:uppercase}
.cp-hero h1{font:800 46px/1.1 var(--font-display);letter-spacing:-.02em;margin:0 0 16px;color:#fff}.cp-hero h1 em{font-style:normal;color:var(--magenta-500,#e0457b)}
.cp-hero p.s{font:400 17px/1.6 var(--font-body);color:rgba(255,255,255,.86);margin:0 0 26px;max-width:600px}
.cp-acts{display:flex;gap:12px;flex-wrap:wrap}
.cp-btn{display:inline-flex;align-items:center;gap:8px;border-radius:999px;padding:16px 26px;font:800 15.5px/1 var(--font-body);text-decoration:none;transition:transform .12s}
.cp-btn:active{transform:scale(.97)}.cp-btn.p{background:var(--brand-accent,#e02b2b);color:#fff;box-shadow:0 14px 30px rgba(224,43,43,.3)}.cp-btn.s{border:1.5px solid rgba(255,255,255,.5);color:#fff}
.cp-note{font:500 13px/1.5 var(--font-body);color:rgba(255,255,255,.72);margin:14px 0 0}
.cp-card{background:var(--white);color:var(--text-heading);border-radius:24px;padding:26px;box-shadow:0 30px 70px rgba(0,0,0,.3)}
.cp-card h2{font:800 12px/1 var(--font-body);letter-spacing:.08em;text-transform:uppercase;color:var(--text-muted);margin:0 0 14px}
.cp-card ul{list-style:none;margin:0 0 18px;padding:0;display:grid;gap:10px}.cp-card li{display:flex;gap:10px;font:500 15px/1.45 var(--font-body);color:var(--text-body)}.cp-card li:before{content:"✓";color:var(--teal-700,#0b6b62);font-weight:800}
.cp-from{display:flex;align-items:baseline;gap:6px;border-top:1px solid var(--border-default);padding-top:14px}.cp-from b{font:800 28px/1 var(--font-display);color:var(--text-heading)}.cp-from span{font:600 13.5px/1.3 var(--font-body);color:var(--text-muted)}
.cp-card a{display:block;text-align:center;margin-top:14px;font:700 14px/1 var(--font-body);color:var(--brand-primary,#1d2fa0);text-decoration:none}
.cp-bar{display:none}
@media(max-width:960px){.cp-hero .pk-wrap{grid-template-columns:1fr}.cp-hero h1{font-size:36px}}
@media(max-width:640px){.cp-hero{padding:36px 0 40px}.cp-hero h1{font-size:30px}.cp-hero p.s{font-size:15.5px}.cp-btn{flex:1 1 100%;justify-content:center}
.cp-bar{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:800;gap:8px;padding:10px 12px calc(10px + env(safe-area-inset-bottom));background:var(--white);border-top:1px solid var(--border-default);box-shadow:0 -8px 24px rgba(11,16,51,.12)}
.cp-bar a{flex:1;display:flex;justify-content:center;align-items:center;border-radius:999px;padding:14px 10px;font:800 14.5px/1 var(--font-body);text-decoration:none}
.cp-bar a.p{background:#1d2fa0;color:#fff}.cp-bar a.s{border:1.5px solid var(--border-strong,#c9cee0);color:var(--text-heading)}
body{padding-bottom:76px}#sbgt-badge{bottom:84px!important}}`;
function CoursePage({course}){
const C=CP_DATA[course]||CP_DATA.cat;
const data=usePlans();usePendingBuy(data&&data.plans);
const [,setT]=React.useState(0);React.useEffect(()=>{const f=()=>setT(t=>t+1);window.addEventListener('sbauth:change',f);return()=>window.removeEventListener('sbauth:change',f);},[]);
const me=window.SBAuth&&window.SBAuth.currentUser(),app=!!window.SB_APP;
const days=data?pkTrialDays(course,data.areas):0;
const from=data?(data.plans||[]).filter(p=>{const c={};(p.areas||[]).forEach(k=>{const a=(data.areas||[]).find(x=>x.key===k);if(a&&a.course)c[a.course]=1;if(/^cuet-subj:/.test(k))c.cuet=1;});if(p.pick)c.cuet=1;return c[course];})
.reduce((m,p)=>Math.min(m,...p.options.map(o=>o.priceINR)),Infinity):Infinity;
const start=me?C.practice:'login.html?next=dashboard.html';
return (<div>
<PkStyle/><style>{CP_CSS}</style>
<section className="cp-hero"><div className="pk-wrap">
<div>
<div className="cp-chips">{C.chips.map(c=><span key={c}>{c}</span>)}</div>
<h1>{C.h1}</h1>
<p className="s">{C.sub}</p>
<div className="cp-acts">
<a className="cp-btn p" href={start}>{me?'Continue practising →':days?'Start my '+days+'-day free trial →':'Create my free account →'}</a>
{app?null:<a className="cp-btn s" href="#plans" onClick={pkGo('plans')}>See plans &amp; prices</a>}
</div>
<p className="cp-note">{me?'You’re logged in — pick up where you left off.':(days?'No card needed. ':'')+'Log in with a one-time code — every previous-year paper is free with it.'}</p>
</div>
<div className="cp-card"><h2>What’s in the {C.name} plan</h2>
<ul>{C.plan.map(t=><li key={t}>{t}</li>)}</ul>
{!app&&from<Infinity?<div className="cp-from"><span>Plans from</span><b>{pkInr(from)}</b></div>:null}
{app?null:<a href="#compare" onClick={pkGo('compare')}>Compare plans ↓</a>}
</div>
</div></section>
<section className="pk-sec"><div className="pk-wrap">
<span className="pk-kick">Free · start right now</span><h2 className="pk-h2">Start free — no plan needed</h2>
<p className="pk-lede">The best place to begin: real previous-year papers and the reading and vocabulary tools toppers use — free, today.</p>
<FreeGrid items={C.free}/>
</div></section>
{days?<section className="pk-sec" style={{paddingTop:0}}><div className="pk-wrap"><TrialBand days={days} course={C.name}/></div></section>:null}
{app?null:<section className="pk-sec alt" id="plans"><div className="pk-wrap">
<span className="pk-kick">Plans</span><h2 className="pk-h2">Pick your {C.name} plan</h2>
<p className="pk-lede">Choose a duration, pay securely and start at once. Every plan includes a detailed analysis after every test.</p>
<PlanCards data={data} course={course}/>
<PlanCompare data={data} course={course}/>
</div></section>}
<section className="pk-sec"><div className="pk-wrap">
<span className="pk-kick">How it works</span><h2 className="pk-h2">Three steps to your first mock</h2>
<Steps days={days}/>
</div></section>
<section className="pk-sec alt"><div className="pk-wrap">
<span className="pk-kick">Questions</span><h2 className="pk-h2">Good to know</h2>
<Faq items={C.faq.concat(PK_FAQ_COMMON.filter(f=>!app||!/pay/i.test(f[0])))}/>
</div></section>
<div className="cp-bar"><a className="s" href={app?C.practice:'#plans'} onClick={app?undefined:pkGo('plans')}>{app?'Practice':'See plans'}</a><a className="p" href={start}>{me?'Practise now':days?days+' days free →':'Start free →'}</a></div>
</div>);
}
window.CoursePage=CoursePage;
