const UNIS = [
  { name: 'Aligarh Muslim University',       sub: 'Online · Central University',        file: 'aligarh.png' },
  { name: 'Amity University',                sub: 'Online · NAAC A+',                    file: 'amity.png' },
  { name: 'Amrita Vishwa Vidyapeetham',      sub: 'Online · NAAC A++',                   file: 'amrita.png' },
  { name: 'Andhra University',               sub: 'Online · NAAC A+',                    file: 'andhra.png' },
  { name: 'Chandigarh University',           sub: 'Online · NAAC A+',                    file: 'chandigarh.png' },
  { name: 'DY Patil University, Mumbai',     sub: 'Online · NAAC A++',                   file: 'dypatil-mumbai.png' },
  { name: 'DY Patil University, Pune',       sub: 'Online · Deemed University',          file: 'dypatil-pune.png' },
  { name: 'GLA University, Mathura',         sub: 'Online · NAAC A+',                    file: 'gla.png' },
  { name: 'Jain University',                 sub: 'Online · Deemed-to-be University',    file: 'jain.png' },
  { name: 'Jamia Hamdard University',        sub: 'Online · NAAC A+',                    file: 'jamia.png' },
  { name: 'Kurukshetra University',          sub: 'Online · NAAC A+',                    file: 'kurukshetra.png' },
  { name: 'Lovely Professional University',  sub: 'Online · NAAC A++',                   file: 'lpu.png' },
  { name: 'Mangalayatan University',         sub: 'Online · UGC-entitled',               file: 'mangalayatan.png' },
  { name: 'Manipal Academy of Higher Edu.',  sub: 'Online · Institute of Eminence',      file: 'mahe.png' },
  { name: 'Manipal University',              sub: 'Online · NAAC A+',                    file: 'manipal.png' },
  { name: 'Mizoram University',              sub: 'Online · Central University',         file: 'mizoram.png' },
  { name: 'NMIMS University',                sub: 'Online · NAAC A+',                    file: 'nmims.png' },
  { name: 'Parul University',                sub: 'Online · NAAC A++',                   file: 'parul.png' },
  { name: 'Sharda University',               sub: 'Online · NAAC A+',                    file: 'sharda.png' },
  { name: 'Shoolini University',             sub: 'Online · NAAC A+',                    file: 'shoolini.png' },
  { name: 'Sikkim Manipal University',       sub: 'Online · NAAC A+',                    file: 'smu.png' },
  { name: 'UPES',                            sub: 'Online · NAAC A',                     file: 'upes.png' },
  { name: 'Uttaranchal University, Dehradun',sub: 'Online · NAAC A+',                    file: 'uttaranchal.png' },
  { name: "Vignan's Foundation",             sub: 'Online · Deemed University',          file: 'vignan.png' },
  { name: 'Vivekananda Global University',   sub: 'Online · Jaipur',                     file: 'vgu.png' },
];

const FEATURED_UNIS = [
  {
    name: 'NMIMS University',
    sub: 'NAAC A+ · Est. 1981',
    accred: 'NAAC A+',
    mode: 'Online',
    popular: 'MBA, MCA, BBA',
    rank: 'Top 10',
    programs: ['MBA','MCA','BBA','MCom'],
    variant: 'alt1',
    file: 'nmims.png',
  },
  {
    name: 'Manipal Academy of Higher Education',
    sub: 'Institute of Eminence · Est. 1953',
    accred: 'NAAC A++',
    mode: 'Online',
    popular: 'MBA, MCA, M.Sc',
    rank: 'Top 5',
    programs: ['MBA','MCA','M.Sc','PG Dip'],
    variant: '',
    file: 'mahe.png',
  },
  {
    name: 'Amity University',
    sub: 'NAAC A+ · Est. 2005',
    accred: 'NAAC A+',
    mode: 'Online',
    popular: 'MBA, MA, BBA',
    rank: 'Top 15',
    programs: ['MBA','MA','BBA','B.Com'],
    variant: 'alt2',
    file: 'amity.png',
  },
];

function resolveLogo(file) {
  if (window.__resources && window.__resources['uni_' + file]) return window.__resources['uni_' + file];
  return 'assets/unis/' + file;
}

function Universities() {
  const track = [...UNIS, ...UNIS];
  return (
    <section className="section" id="universities">
      <div className="container">
        <FadeUp>
          <div className="section-head">
            <div className="section-eyebrow">University Partners</div>
            <h2 className="section-title">
              25 universities. One <span className="serif">curated shortlist</span> for you.
            </h2>
            <p className="section-sub">
              Every partner is vetted on recognition, course quality, placement track record, and student experience.
            </p>
          </div>
        </FadeUp>
      </div>

      <div className="unis-marquee">
        <div className="unis-track">
          {track.map((u, i) => (
            <div key={i} className="uni-logo">
              <div className="uni-logo-img-wrap">
                <img src={resolveLogo(u.file)} alt={u.name} className="uni-logo-img" loading="lazy"/>
              </div>
              <div className="uni-logo-main">
                <div className="uni-logo-name">{u.name}</div>
                <div className="uni-logo-sub">{u.sub}</div>
              </div>
            </div>
          ))}
        </div>
      </div>

      <div className="container">
        <div className="unis-featured">
          {FEATURED_UNIS.map((u, i) => (
            <FadeUp key={i} delay={i + 1}>
              <div className="uni-card">
                <div className={`uni-card-top ${u.variant}`}>
                  <div className="uni-card-badge">{u.rank}</div>
                  <div className="uni-card-logo-feat">
                    <img src={resolveLogo(u.file)} alt={u.name}/>
                  </div>
                </div>
                <div className="uni-card-body">
                  <h3>{u.name}</h3>
                  <div className="uni-card-sub">{u.sub}</div>
                  <div className="uni-card-progs">
                    {u.programs.map(p => <span key={p} className="tag">{p}</span>)}
                  </div>
                  <div className="uni-card-meta">
                    <div className="uni-card-meta-item"><strong>Accred.</strong>{u.accred}</div>
                    <div className="uni-card-meta-item"><strong>Mode</strong>{u.mode}</div>
                  </div>
                </div>
              </div>
            </FadeUp>
          ))}
        </div>
        <FadeUp>
          <div style={{marginTop: 40, textAlign: 'center'}}>
            <NavLink to="/universities" className="btn btn-ghost">View all 25 partner universities <ArrowIcon/></NavLink>
          </div>
        </FadeUp>
      </div>
    </section>
  );
}
function UniversityCard({ u }) {
  return (
    <div className="uni-full-card">
      <div className="uni-full-logo">
        <img src={resolveLogo(u.file)} alt={u.name} loading="lazy"/>
      </div>
      <div className="uni-full-body">
        <h3>{u.name}</h3>
        <div className="uni-full-sub">{u.sub}</div>
        <div className="uni-full-meta">
          <span className="uni-full-tag">Online</span>
          <span className="uni-full-tag uni-full-tag-muted">UGC-entitled</span>
        </div>
      </div>
    </div>
  );
}

function UniversitiesAllGrid() {
  return (
    <section className="section" style={{paddingTop: 0}}>
      <div className="container">
        <div className="uni-full-head">
          <div className="section-eyebrow">All partners</div>
          <h2 className="section-title">Every university, <span className="serif">in one place.</span></h2>
        </div>
        <div className="uni-full-grid">
          {UNIS.map((u, i) => (
            <FadeUp key={u.file} delay={(i % 4) + 1}>
              <UniversityCard u={u} />
            </FadeUp>
          ))}
        </div>
      </div>
    </section>
  );
}

window.UniversitiesAllGrid = UniversitiesAllGrid;
window.Universities = Universities;
