<?php declare(strict_types=1);
/**
 * College2U — B.E / B.Tech Admission Guide Bangalore
 * public_html/engineering/engineering-admission.php · v5.0.0 · May 2026
 *
 * SEO intent: "engineering admission Bangalore 2026"
 * Schema: HowTo + FAQPage + EducationalOccupationalProgram + BreadcrumbList
 * Lead form: CSRF protected, rate-limited, inserts via c2u_submit_lead()
 */

// ── 1. Bootstrap ─────────────────────────────────────────────────────────────
require_once dirname(__DIR__) . '/includes/bootstrap.php';

// ── 2. Lead form handler ──────────────────────────────────────────────────────
$form_success = false;
$form_error   = '';

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['c2u_eng_lead'])) {
    if (!c2u_rate_limit('eng_lead_' . ($_SERVER['REMOTE_ADDR'] ?? 'x'), 3, 60)) {
        $form_error = 'Too many requests. Please try again in a minute.';
    } elseif (!c2u_csrf_valid()) {
        $form_error = 'Session expired. Please refresh the page and try again.';
    } else {
        $name  = trim($_POST['name']  ?? '');
        $phone = trim($_POST['phone'] ?? '');
        $email = trim($_POST['email'] ?? '');
        $rank  = trim($_POST['kcet_rank'] ?? '');
        $exam  = trim($_POST['exam'] ?? 'KCET');

        if ($name === '' || $phone === '') {
            $form_error = 'Please enter your name and mobile number.';
        } elseif (!c2u_valid_phone($phone)) {
            $form_error = 'Please enter a valid 10-digit Indian mobile number.';
        } else {
            $message = "Exam: {$exam} | Rank: {$rank}";
            $lead_id = c2u_submit_lead([
                'name'        => $name,
                'email'       => $email,
                'contact'     => $phone,
                'course'      => 'B.E / B.Tech Engineering',
                'location'    => 'Bangalore',
                'message'     => $message,
                'source_page' => 'engineering/engineering-admission',
                'aria_heat'   => 45,
                'aria_intent' => 'HOT',
            ]);
            $form_success = ($lead_id > 0);
            if (!$form_success) {
                $form_error = 'Submission failed. Please call us at ' . C2U_PHONE . '.';
            }
        }
    }
}

// ── 3. Page data ──────────────────────────────────────────────────────────────
$current_year = (int) date('Y');

$eligibility_points = [
    ['title' => '10+2 Academics',   'detail' => 'Passed 10+2 (PUC) with Physics, Chemistry, Mathematics — minimum 45% aggregate (40% for SC/ST).', 'icon' => 'M4 19.5A2.5 2.5 0 0 1 6.5 17H20'],
    ['title' => 'KCET / COMEDK',    'detail' => 'Valid KCET or COMEDK UGET score in ' . $current_year . '. JEE Main is accepted by deemed universities.', 'icon' => 'M9 11l3 3L22 4'],
    ['title' => 'Age',              'detail' => 'No upper age limit for engineering. Minimum age: 17 years on the date of admission.', 'icon' => 'M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2M12 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8z'],
    ['title' => 'Domicile (KCET)',  'detail' => 'KCET seats are reserved for Karnataka domicile students. COMEDK and management quota are open to all-India students.', 'icon' => 'M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 0 0 1 1h3m10-11l2 2m-2-2v10a1 1 0 0 1-1 1h-3m-6 0a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1m-6 0h16'],
];

$howto_steps = [
    [1, 'Clear KCET or COMEDK',
     'Appear in KCET ' . $current_year . ' (conducted by KEA, April) or COMEDK UGET (May). JEE Main scores are accepted by PES University and other deemed institutions. Download your rank card after results.',
     'https://kea.kar.nic.in', 'KEA KCET portal'],
    [2, 'Register on KEA / COMEDK Portal',
     'Register at cetonline.karnataka.gov.in/kea (KCET) or comedk.org (COMEDK). Upload: 10th/12th marks cards, entrance rank card, category certificate, income/domicile proof.',
     'https://comedk.org', 'COMEDK portal'],
    [3, 'Shortlist Colleges by Branch & Rank',
     'Study previous-year closing ranks for your preferred branch at each college. RVCE CSE closes around rank 250; MSRIT CSE around 1,200. College2U provides a free personalised shortlist.',
     c2u_url('engineering/top-engineering-colleges'), 'View closing rank data'],
    [4, 'Option Entry & Seat Lock',
     'Fill your preferred college–branch combinations in priority order during the option-entry window. Lock your choices before the deadline — changes are not permitted after locking.',
     '', ''],
    [5, 'Seat Allotment & Reporting',
     'Accept the allotted seat online, pay the acceptance fee within the deadline, and report to the college with original documents: rank card, marks cards, TC, migration certificate, category certificate, 8 passport photos.',
     c2u_url('contact'), 'Get document checklist from College2U'],
];

$fee_table = [
    ['quota' => 'KCET Govt-Aided (KEA)',  'annual_fee' => '₹35,000 – ₹80,000',    'seats_pct' => 'Karnataka domicile', 'process' => 'KCET counselling · KEA allotment'],
    ['quota' => 'KCET Private Unaided',   'annual_fee' => '₹80,000 – ₹1.5 lakh',  'seats_pct' => 'Karnataka domicile', 'process' => 'KCET counselling · option entry'],
    ['quota' => 'COMEDK UGET',            'annual_fee' => '₹1.5 lakh – ₹2.5 lakh','seats_pct' => 'All-India open',     'process' => 'COMEDK rank · counselling'],
    ['quota' => 'Management Quota',       'annual_fee' => '₹2 lakh – ₹4 lakh',    'seats_pct' => '15% of intake',      'process' => 'Direct · college contact'],
];

$branches = [
    ['branch' => 'CSE (Computer Science)',         'rvce_rank' => '~250',   'msrit_rank' => '~1,200', 'nhce_rank' => '~5,000'],
    ['branch' => 'AI & Machine Learning',           'rvce_rank' => '~450',   'msrit_rank' => '~2,000', 'nhce_rank' => '~7,000'],
    ['branch' => 'ECE (Electronics & Comm.)',       'rvce_rank' => '~2,500', 'msrit_rank' => '~4,000', 'nhce_rank' => '~12,000'],
    ['branch' => 'Mechanical Engineering',          'rvce_rank' => '~5,000', 'msrit_rank' => '~8,000', 'nhce_rank' => '~20,000'],
    ['branch' => 'Civil Engineering',              'rvce_rank' => '~9,000', 'msrit_rank' => '~15,000','nhce_rank' => '~30,000'],
    ['branch' => 'Information Science (ISE)',       'rvce_rank' => '~700',   'msrit_rank' => '~2,500', 'nhce_rank' => '~8,000'],
];

$faqs = [
    ['q' => 'What KCET rank is needed for B.E CSE at RVCE Bangalore ' . $current_year . '?',
     'a' => 'CSE at R V College of Engineering (RVCE) closed at approximately rank 250 in KCET ' . ($current_year - 1) . '. For ' . $current_year . ', expect a similar closing rank — possibly 230–280 depending on overall merit. MSRIT CSE closes around 1,200 and NHCE CSE at around 5,000. Category seats (SC/ST/OBC) have separate, higher closing ranks.'],
    ['q' => 'Can I get engineering admission in Bangalore with a KCET rank of 10,000?',
     'a' => 'A KCET rank of 10,000 provides access to ECE at several reputed colleges and CSE/ISE at mid-tier AICTE-approved colleges in Bangalore ' . $current_year . '. College2U recommends using previous-year rank data to identify colleges where your rank falls within the closing rank for your preferred branch.'],
    ['q' => 'What is the fee for B.Tech at RVCE, BMS, and MSRIT?',
     'a' => 'RVCE and BMS College of Engineering (BMSCE) are government-aided, so KCET-allotted fees are approximately ₹35,000–₹80,000 per year for ' . $current_year . '. MSRIT (private unaided) charges ₹80,000–₹1.2 lakh per year. COMEDK seats at these colleges cost more — typically ₹1.5–₹2.5 lakh per year.'],
    ['q' => 'How many KCET counselling rounds are there for engineering ' . $current_year . '?',
     'a' => 'KCET engineering counselling for ' . $current_year . ' typically has 3 rounds: Round 1 (main allotment), Round 2 (first mop-up for seats left vacant), and a final extended round. After KCET rounds, colleges directly fill remaining management quota seats.'],
    ['q' => 'Is there a lateral entry to B.E for diploma holders in Bangalore?',
     'a' => 'Yes. Diploma holders can join the second year of B.E directly through DCET (Diploma Common Entrance Test), conducted by KEA. DCET is a separate exam from KCET and covers all engineering disciplines. Seats are limited and reserved for Karnataka-domicile diploma holders.'],
    ['q' => 'Which engineering branch has the best salary in Bangalore colleges?',
     'a' => 'CSE and AI/ML branches have the highest average campus placements at Bangalore engineering colleges. Average CTC for CSE graduates from top colleges like RVCE and BMSCE ranges from ₹6–₹20 lakh per year in ' . $current_year . '. Microsoft, Google, Amazon, Infosys, and Wipro are the top recruiters.'],
];

// ── 4. SEO ────────────────────────────────────────────────────────────────────
$page_title       = 'Engineering Admission Bangalore ' . $current_year . ' — KCET &amp; COMEDK Guide | College2U';
$meta_description = 'B.E/B.Tech admission in Bangalore ' . $current_year . ': KCET vs COMEDK explained, branch cutoffs, counselling rounds, and top college shortlist. Free expert guidance.';
$canonical_path   = 'engineering/engineering-admission';
$body_class       = 'c2u-page c2u-page--admission c2u-page--eng-admission';
$og_image         = c2u_asset('images/og/engineering-admission-og.webp');
$schema_type      = 'WebPage';

$breadcrumbs = [
    ['name' => 'Engineering', 'url' => c2u_url('engineering')],
    ['name' => 'B.E Admission ' . $current_year, 'url' => c2u_url('engineering/engineering-admission')],
];

// ── 5. Schemas ────────────────────────────────────────────────────────────────
$howto_schema = [
    '@context'    => 'https://schema.org',
    '@type'       => 'HowTo',
    'name'        => 'How to Get Engineering Admission in Bangalore ' . $current_year,
    'description' => 'Step-by-step guide to B.E / B.Tech admission in Bangalore ' . $current_year . ' through KCET or COMEDK counselling.',
    'totalTime'   => 'P4M',
    'step'        => array_map(fn($s) => [
        '@type'    => 'HowToStep',
        'position' => $s[0],
        'name'     => $s[1],
        'text'     => $s[2],
    ], $howto_steps),
];

$faq_schema = [
    '@context'   => 'https://schema.org',
    '@type'      => 'FAQPage',
    'mainEntity' => array_map(fn($f) => [
        '@type'          => 'Question',
        'name'           => $f['q'],
        'acceptedAnswer' => ['@type' => 'Answer', 'text' => $f['a']],
    ], $faqs),
];

$program_schema = [
    '@context'              => 'https://schema.org',
    '@type'                 => 'EducationalOccupationalProgram',
    'name'                  => 'B.E / B.Tech (Bachelor of Engineering / Technology)',
    'description'           => '4-year undergraduate engineering degree covering CSE, ECE, Mechanical, Civil, AI/ML, and 20+ specialisations at AICTE-approved colleges in Bangalore.',
    'timeToComplete'        => 'P4Y',
    'programPrerequisites'  => '10+2 with PCM · Minimum 45% marks · Valid KCET or COMEDK score',
    'offers'                => [
        '@type'         => 'Offer',
        'priceCurrency' => 'INR',
        'price'         => '150000',
        'description'   => 'Approximate annual fee (COMEDK / management quota) ' . $current_year,
    ],
    'provider' => [
        '@type' => 'CollegeOrUniversity',
        'name'  => 'AICTE-approved Engineering Colleges in Bangalore',
        'address' => ['@type' => 'PostalAddress', 'addressLocality' => 'Bangalore', 'addressRegion' => 'Karnataka', 'addressCountry' => 'IN'],
    ],
];

$extra_schemas = [
    c2u_schema_breadcrumb($breadcrumbs),
    $howto_schema,
    $faq_schema,
    $program_schema,
];

// ── 6. CSS ────────────────────────────────────────────────────────────────────
$hero_img = c2u_asset('images/banners/engineering-admission-hero.webp');
$extra_head = '<link rel="preload" as="image" href="' . c2u_e($hero_img) . '" fetchpriority="high">
<style nonce="' . c2u_e(C2U_CSP_NONCE) . '">
:root{--blue:#3b82f6;--blue-d:#1d4ed8;--blue-l:#eff6ff;--blue-m:#dbeafe;--surface:#f8fafc;--border:#e2e8f0;--text:#0f172a;--muted:#64748b;--radius:1rem;--shadow:0 4px 24px rgba(0,0,0,.09);}
.adm-hero{background:linear-gradient(145deg,#050d1a 0%,#0a1f3b 100%);min-height:min(55vh,480px);display:flex;align-items:center;overflow:hidden;position:relative;isolation:isolate;}
.adm-hero__bg{position:absolute;inset:0;background-image:url("' . c2u_e($hero_img) . '");background-size:cover;background-position:center 30%;opacity:.18;z-index:-1;}
.adm-hero__inner{width:100%;max-width:1200px;margin:0 auto;padding:3.5rem 1.5rem;display:grid;grid-template-columns:1fr min(400px,40%);gap:2.5rem;align-items:center;}
@media(max-width:840px){.adm-hero__inner{grid-template-columns:1fr;}}
.adm-eyebrow{display:inline-flex;align-items:center;gap:.5rem;background:rgba(59,130,246,.2);border:1px solid rgba(59,130,246,.4);color:#93c5fd;border-radius:2rem;padding:.375rem .875rem;font-size:.8rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase;margin-bottom:1rem;}
.adm-h1{font-size:clamp(1.75rem,4vw,2.75rem);font-weight:800;color:#fff;letter-spacing:-.025em;margin:0 0 .5rem;line-height:1.15;}
.adm-h1 em{color:#93c5fd;font-style:normal;}
.adm-sub-tags{display:flex;flex-wrap:wrap;gap:.5rem;margin:.75rem 0 1.5rem;}
.adm-tag{background:rgba(255,255,255,.12);color:rgba(255,255,255,.8);border-radius:2rem;padding:.3rem .75rem;font-size:.8rem;font-weight:500;}
.adm-ctas{display:flex;flex-wrap:wrap;gap:.75rem;}
.btn-primary{background:var(--blue);color:#fff;font-weight:700;font-size:.9375rem;padding:.75rem 1.75rem;border-radius:.5rem;border:none;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:.5rem;transition:background .2s,transform .15s;}
.btn-primary:hover{background:var(--blue-d);transform:translateY(-1px);}
.btn-secondary{background:rgba(255,255,255,.1);color:#fff;font-weight:600;font-size:.9375rem;padding:.75rem 1.75rem;border-radius:.5rem;border:1px solid rgba(255,255,255,.25);text-decoration:none;transition:background .2s;}
.btn-secondary:hover{background:rgba(255,255,255,.18);}
.adm-form-card{background:#fff;border-radius:var(--radius);padding:1.75rem;box-shadow:0 8px 40px rgba(0,0,0,.2);}
.adm-form-card h2{font-size:1.0625rem;font-weight:700;color:var(--text);margin:0 0 .25rem;}
.adm-form-card p{font-size:.8125rem;color:var(--muted);margin:0 0 1.25rem;}
.fg{margin-bottom:.875rem;}
.fg label{display:block;font-size:.8125rem;font-weight:600;color:var(--text);margin-bottom:.35rem;}
.fg input,.fg select{width:100%;padding:.625rem .875rem;border:1.5px solid var(--border);border-radius:.5rem;font-size:.9rem;color:var(--text);background:#fff;transition:border-color .2s,box-shadow .2s;box-sizing:border-box;}
.fg input:focus,.fg select:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 3px rgba(59,130,246,.15);}
.fg select{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'12\' height=\'8\' viewBox=\'0 0 12 8\'%3E%3Cpath d=\'M1 1l5 5 5-5\' stroke=\'%2364748b\' stroke-width=\'1.5\' fill=\'none\' stroke-linecap=\'round\'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right .875rem center;}
.btn-form-submit{width:100%;background:var(--text);color:#fff;font-weight:700;font-size:.9375rem;padding:.75rem;border-radius:.5rem;border:none;cursor:pointer;transition:background .2s,transform .15s;margin-top:.25rem;}
.btn-form-submit:hover{background:#1d4ed8;transform:translateY(-1px);}
.form-success{background:#ecfdf5;border:1px solid #a7f3d0;border-radius:.5rem;padding:1rem;color:#065f46;font-weight:600;text-align:center;}
.form-error{background:var(--blue-l);border:1px solid #93c5fd;border-radius:.5rem;padding:.625rem 1rem;color:#1e3a8a;font-size:.875rem;margin-bottom:.75rem;}
.c2u-section{padding:4rem 1.5rem;}
.c2u-section--alt{background:var(--surface);}
.c2u-section-inner{max-width:1200px;margin:0 auto;}
.c2u-section-heading{font-size:clamp(1.375rem,3vw,2rem);font-weight:800;color:var(--text);letter-spacing:-.025em;margin:0 0 .5rem;}
.c2u-section-heading em{color:var(--blue-d);font-style:normal;}
.c2u-section-sub{font-size:.9375rem;color:var(--muted);margin:0 0 2.5rem;line-height:1.6;max-width:600px;}
.highlight-row{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:1.25rem;}
.highlight-box{background:#fff;border:1.5px solid var(--border);border-radius:var(--radius);padding:1.5rem;position:relative;overflow:hidden;}
.highlight-box::before{content:\'\';position:absolute;top:0;left:0;right:0;height:3px;background:linear-gradient(90deg,var(--blue),var(--blue-d));}
.hb-icon{width:44px;height:44px;background:var(--blue-l);border-radius:.625rem;display:flex;align-items:center;justify-content:center;color:var(--blue-d);margin-bottom:1rem;}
.hb-title{font-size:.9375rem;font-weight:700;color:var(--text);margin:0 0 .375rem;}
.hb-detail{font-size:.875rem;color:var(--muted);line-height:1.55;margin:0;}
.howto-list{display:flex;flex-direction:column;gap:0;max-width:840px;}
.timeline-item{display:grid;grid-template-columns:48px 1fr;gap:1.25rem;padding:1.5rem 0;border-bottom:1px solid var(--border);position:relative;}
.timeline-item:last-child{border-bottom:none;}
.tl-num{width:40px;height:40px;border-radius:50%;background:var(--blue);color:#fff;font-weight:800;font-size:.9375rem;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.tl-title{font-size:1rem;font-weight:700;color:var(--text);margin:0 0 .5rem;}
.tl-desc{font-size:.9rem;color:var(--muted);line-height:1.6;margin:0 0 .75rem;}
.tl-link{font-size:.8125rem;font-weight:600;color:var(--blue-d);text-decoration:none;}
.tl-link:hover{text-decoration:underline;}
.fee-table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;margin-top:1.5rem;table-layout:fixed;}
.fee-table{width:100%;border-collapse:collapse;font-size:.9rem;table-layout:fixed;}
.fee-table th{text-align:left;padding:.75rem 1rem;font-size:.8rem;font-weight:700;color:var(--muted);letter-spacing:.04em;text-transform:uppercase;border-bottom:2px solid var(--border);background:var(--surface);}
.fee-table th:first-child,.fee-table td:first-child{width:38%;}
.fee-table td{padding:.875rem 1rem;border-bottom:1px solid var(--border);color:var(--text);}
.fee-table tr:last-child td{border-bottom:none;}
.fee-highlight{font-weight:700;color:var(--blue-d);}
.compare-table{width:100%;border-collapse:collapse;font-size:.9rem;table-layout:fixed;}
.compare-table th:first-child,.compare-table td:first-child{width:38%;}
.compare-table th{text-align:left;padding:.75rem 1rem;font-size:.8rem;font-weight:700;color:var(--muted);letter-spacing:.04em;text-transform:uppercase;border-bottom:2px solid var(--border);background:var(--surface);}
.compare-table td{padding:.875rem 1rem;border-bottom:1px solid var(--border);color:var(--text);}
@media(max-width:600px){.compare-table{font-size:.8rem;}.compare-table th,.compare-table td{padding:.625rem .75rem;}}
.college-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:1.125rem;}
.college-card{background:#fff;border:1.5px solid var(--border);border-radius:var(--radius);padding:1.25rem;display:flex;align-items:flex-start;gap:.875rem;transition:border-color .2s,box-shadow .2s;}
.college-card:hover{border-color:var(--blue);box-shadow:var(--shadow);}
.college-meta{flex:1;min-width:0;}
.college-name{font-size:.9375rem;font-weight:700;color:var(--text);margin:0 0 .375rem;line-height:1.3;}
.college-cutoff{font-size:.8125rem;color:var(--muted);margin:0 0 .25rem;}
.college-cutoff strong{color:var(--blue-d);}
.faq-list{max-width:800px;}
.faq-item{border-bottom:1px solid var(--border);}
.faq-q{width:100%;display:flex;justify-content:space-between;align-items:center;background:none;border:none;cursor:pointer;padding:1.125rem 0;font-size:.9375rem;font-weight:600;color:var(--text);text-align:left;gap:1rem;}
.faq-q__icon{flex-shrink:0;transition:transform .25s;color:var(--muted);}
.faq-q[aria-expanded="true"] .faq-q__icon{transform:rotate(180deg);}
.faq-a{padding:0 0 1.125rem;font-size:.9375rem;line-height:1.65;color:var(--muted);}
.faq-a[hidden]{display:none;}
.cta-banner{background:linear-gradient(135deg,var(--blue-l),var(--blue-m));border:1.5px solid #93c5fd;border-radius:var(--radius);padding:2.5rem;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:1.5rem;margin-top:3rem;}
.cta-banner h2{font-size:1.25rem;font-weight:800;color:#1e3a8a;margin:0;}
.cta-banner p{font-size:.9375rem;color:var(--blue-d);margin:.25rem 0 0;}
.btn-cta{background:var(--blue);color:#fff;font-weight:700;font-size:.9375rem;padding:.75rem 1.75rem;border-radius:.5rem;border:none;cursor:pointer;text-decoration:none;white-space:nowrap;transition:background .2s;flex-shrink:0;}
.btn-cta:hover{background:var(--blue-d);}
.sidebar-card{background:#fff;border:1.5px solid var(--border);border-radius:var(--radius);padding:1.5rem;position:sticky;top:80px;}
.sidebar-card h3{font-size:.9375rem;font-weight:700;color:var(--text);margin:0 0 1rem;}
.sidebar-links{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:.5rem;}
.sidebar-links a{font-size:.875rem;color:var(--blue-d);text-decoration:none;display:flex;align-items:center;gap:.5rem;font-weight:500;}
.sidebar-links a:hover{text-decoration:underline;}
.content-with-sidebar{display:grid;grid-template-columns:1fr 300px;gap:2.5rem;align-items:start;}
@media(max-width:900px){.content-with-sidebar{grid-template-columns:1fr;}}
@media(max-width:600px){.highlight-row{grid-template-columns:1fr;}.college-grid{grid-template-columns:1fr;}}
</style>';

$page_js = <<<'JS'
(function(){
  document.querySelectorAll('.faq-q').forEach(function(btn){
    btn.addEventListener('click',function(){
      var expanded=this.getAttribute('aria-expanded')==='true';
      document.querySelectorAll('.faq-q').forEach(function(b){
        b.setAttribute('aria-expanded','false');
        var p=document.getElementById(b.getAttribute('aria-controls'));
        if(p){p.hidden=true;}
      });
      if(!expanded){
        this.setAttribute('aria-expanded','true');
        var panel=document.getElementById(this.getAttribute('aria-controls'));
        if(panel){panel.hidden=false;}
      }
    });
  });
})();
JS;

// ── 7. Header ─────────────────────────────────────────────────────────────────
require_once C2U_INCLUDES . '/header.php';
?>

<!-- ══════════════════════════════════════════════════════════════════════════
     ADMISSION HERO — H1: B.E / B.Tech Admission in Bangalore 2026
══════════════════════════════════════════════════════════════════════════════ -->
<section class="adm-hero" aria-labelledby="adm-h1">
  <div class="adm-hero__bg" role="presentation" aria-hidden="true"></div>
  <div class="adm-hero__inner">

    <!-- Left -->
    <div class="adm-hero__left">
      <nav aria-label="Breadcrumb" style="margin-bottom:1rem;">
        <ol style="list-style:none;padding:0;margin:0;display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;font-size:.8125rem;color:rgba(255,255,255,.5);">
          <li><a href="<?= c2u_e(c2u_url('')) ?>" style="color:rgba(255,255,255,.5);text-decoration:none;">Home</a></li>
          <li aria-hidden="true" style="color:rgba(255,255,255,.3);">/</li>
          <li><a href="<?= c2u_e(c2u_url('engineering')) ?>" style="color:rgba(255,255,255,.5);text-decoration:none;">Engineering</a></li>
          <li aria-hidden="true" style="color:rgba(255,255,255,.3);">/</li>
          <li aria-current="page" style="color:rgba(255,255,255,.8);">B.E Admission <?= $current_year ?></li>
        </ol>
      </nav>

      <p class="adm-eyebrow">
        <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="2" y="3" width="20" height="14" rx="2"/><path d="M8 21h8M12 17v4"/></svg>
        KCET · COMEDK · JEE Main · <?= $current_year ?>
      </p>

      <h1 class="adm-h1" id="adm-h1">
        B.E / B.Tech Admission in <em>Bangalore</em> <?= $current_year ?>
      </h1>

      <div class="adm-sub-tags" role="list" aria-label="Admission pathways">
        <?php foreach (['KCET Counselling', 'COMEDK UGET', 'Management Quota', 'Lateral Entry (DCET)', 'Deemed Universities'] as $tag): ?>
        <span class="adm-tag" role="listitem"><?= $tag ?></span>
        <?php endforeach; ?>
      </div>

      <div class="adm-ctas">
        <a href="#howto" class="btn-primary">
          <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true" focusable="false"><polyline points="9 18 15 12 9 6"/></svg>
          Admission process →
        </a>
        <a href="<?= c2u_e(c2u_url('counselor-booking')) ?>" class="btn-secondary">
          Book free counselling
        </a>
      </div>
    </div>

    <!-- Right: lead form -->
    <aside class="adm-hero__right" aria-label="Engineering admission enquiry form">
      <div class="adm-form-card">
        <h2>Get a free college shortlist</h2>
        <p>Based on your KCET / COMEDK rank. Counsellors call back within 2 hours.</p>

        <?php if ($form_success): ?>
          <div class="form-success" role="alert">
            <strong>We'll call you soon!</strong><br>
            Your engineering counsellor will reach you within 2 hours.
          </div>
        <?php else: ?>
          <?php if ($form_error): ?>
            <p class="form-error" role="alert"><?= c2u_e($form_error) ?></p>
          <?php endif; ?>
          <form method="POST"
                action="<?= c2u_e(c2u_url('engineering/engineering-admission')) ?>#adm-form"
                id="adm-form" novalidate>
            <?= c2u_csrf_field() ?>
            <input type="hidden" name="c2u_eng_lead" value="1">

            <div class="fg">
              <label for="eng-name">Full name <span aria-hidden="true">*</span></label>
              <input type="text" id="eng-name" name="name" placeholder="e.g. Priya Sharma"
                     value="<?= c2u_e($_POST['name'] ?? '') ?>" autocomplete="name" required aria-required="true">
            </div>
            <div class="fg">
              <label for="eng-phone">Mobile number <span aria-hidden="true">*</span></label>
              <input type="tel" id="eng-phone" name="phone" placeholder="10-digit number"
                     value="<?= c2u_e($_POST['phone'] ?? '') ?>" autocomplete="tel" required aria-required="true" maxlength="13">
            </div>
            <div class="fg">
              <label for="eng-exam">Entrance exam</label>
              <select id="eng-exam" name="exam">
                <?php foreach (['KCET', 'COMEDK UGET', 'JEE Main', 'Management Quota'] as $ex): ?>
                <option value="<?= c2u_e($ex) ?>"<?= (($_POST['exam'] ?? '') === $ex) ? ' selected' : '' ?>><?= c2u_e($ex) ?></option>
                <?php endforeach; ?>
              </select>
            </div>
            <div class="fg">
              <label for="eng-rank">Your rank (approximate)</label>
              <input type="text" id="eng-rank" name="kcet_rank" placeholder="e.g. 5000"
                     value="<?= c2u_e($_POST['kcet_rank'] ?? '') ?>" inputmode="numeric">
            </div>
            <button type="submit" class="btn-form-submit">Get free engineering shortlist →</button>
          </form>
        <?php endif; ?>
        <p style="font-size:.75rem;color:#94a3b8;text-align:center;margin:.75rem 0 0;">Free service. No referral fees. No spam.</p>
      </div>
    </aside>
  </div>
</section>

<!-- ══════════════════════════════════════════════════════════════════════════
     ELIGIBILITY
     H2: What is the eligibility for B.E / B.Tech in Bangalore 2026?
══════════════════════════════════════════════════════════════════════════════ -->
<section class="c2u-section" id="eligibility" aria-labelledby="elig-h2">
  <div class="c2u-section-inner">
    <header style="margin-bottom:2.5rem;">
      <h2 class="c2u-section-heading" id="elig-h2">
        What is the eligibility for B.E / B.Tech in Bangalore <?= $current_year ?>?
      </h2>
      <p class="c2u-section-sub">
        All four criteria are mandatory. Missing any one makes a candidate ineligible regardless of rank.
      </p>
    </header>
    <div class="highlight-row" data-animate="stagger" role="list">
      <?php foreach ($eligibility_points as $ep): ?>
      <div class="highlight-box" role="listitem">
        <div class="hb-icon" aria-hidden="true">
          <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
            <path d="<?= c2u_e($ep['icon']) ?>"/>
          </svg>
        </div>
        <h3 class="hb-title"><?= c2u_e($ep['title']) ?></h3>
        <p class="hb-detail"><?= c2u_e($ep['detail']) ?></p>
      </div>
      <?php endforeach; ?>
    </div>
  </div>
</section>

<!-- ══════════════════════════════════════════════════════════════════════════
     HOW DOES KCET / COMEDK COUNSELLING WORK?
     H2: How does KCET and COMEDK counselling work in 2026?
══════════════════════════════════════════════════════════════════════════════ -->
<section class="c2u-section c2u-section--alt" id="howto" aria-labelledby="howto-h2">
  <div class="c2u-section-inner content-with-sidebar">
    <div>
      <header style="margin-bottom:2rem;">
        <h2 class="c2u-section-heading" id="howto-h2" data-aeo-speakable>
          How does <abbr title="Karnataka Common Entrance Test">KCET</abbr> and <abbr title="COMEDK Undergraduate Entrance Test">COMEDK</abbr> counselling work in <?= $current_year ?>?
        </h2>
        <p class="c2u-section-sub">
          From clearing the entrance exam to sitting in your first B.E lecture — five steps for engineering admission in Bangalore <?= $current_year ?>.
        </p>
      </header>

      <ol class="howto-list" aria-label="B.E admission steps <?= $current_year ?>">
        <?php foreach ($howto_steps as [$num, $title, $desc, $href, $linkLabel]): ?>
        <li class="timeline-item">
          <div class="tl-num" aria-label="Step <?= $num ?>"><?= $num ?></div>
          <div class="tl-content">
            <h3 class="tl-title"><?= c2u_e($title) ?></h3>
            <p class="tl-desc"><?= c2u_e($desc) ?></p>
            <?php if ($href): ?>
            <a href="<?= c2u_e($href) ?>" class="tl-link"
               <?= (str_starts_with($href, 'http') ? 'rel="noopener noreferrer" target="_blank"' : '') ?>>
              <?= c2u_e($linkLabel) ?> →
            </a>
            <?php endif; ?>
          </div>
        </li>
        <?php endforeach; ?>
      </ol>
    </div>

    <aside aria-label="Quick links — engineering admission">
      <div class="sidebar-card">
        <h3>Quick links</h3>
        <ul class="sidebar-links">
          <li><a href="<?= c2u_e(c2u_url('engineering')) ?>">← Back to Engineering hub</a></li>
          <li><a href="<?= c2u_e(c2u_url('engineering/top-engineering-colleges')) ?>">Top engineering colleges Bangalore</a></li>
          <li><a href="<?= c2u_e(c2u_url('exams/kcet-2026')) ?>">KCET <?= $current_year ?> guide</a></li>
          <li><a href="<?= c2u_e(c2u_url('exams/comedk-2026')) ?>">COMEDK UGET <?= $current_year ?> guide</a></li>
          <li><a href="<?= c2u_e(c2u_url('management/mba-admission')) ?>">MBA admission guide</a></li>
          <li><a href="<?= c2u_e(c2u_url('counselor-booking')) ?>">Book free counselling</a></li>
        </ul>
      </div>
    </aside>
  </div>
</section>

<!-- ══════════════════════════════════════════════════════════════════════════
     FEE COMPARISON
     H2: Government vs private engineering fees in Bangalore 2026
══════════════════════════════════════════════════════════════════════════════ -->
<section class="c2u-section" id="fees" aria-labelledby="fees-h2">
  <div class="c2u-section-inner" style="max-width:900px;">
    <header style="margin-bottom:1.5rem;">
      <h2 class="c2u-section-heading" id="fees-h2">
        Government vs private B.E fees in Bangalore <?= $current_year ?>
      </h2>
      <p class="c2u-section-sub">
        KCET government-aided fees are set by the Karnataka government. COMEDK and management quota fees are set by individual colleges within <abbr title="All India Council for Technical Education">AICTE</abbr> guidelines.
      </p>
    </header>
    <div class="fee-table-wrap">
      <table class="fee-table" aria-label="Engineering fee comparison Bangalore <?= $current_year ?>">
        <thead>
          <tr>
            <th scope="col">Quota</th>
            <th scope="col">Annual fee (<?= $current_year ?>)</th>
            <th scope="col">Eligibility</th>
            <th scope="col">Process</th>
          </tr>
        </thead>
        <tbody>
          <?php foreach ($fee_table as $row): ?>
          <tr>
            <td style="font-weight:600;"><?= c2u_e($row['quota']) ?></td>
            <td class="fee-highlight"><?= c2u_e($row['annual_fee']) ?></td>
            <td><?= c2u_e($row['seats_pct']) ?></td>
            <td style="font-size:.875rem;color:#64748b;"><?= c2u_e($row['process']) ?></td>
          </tr>
          <?php endforeach; ?>
        </tbody>
      </table>
    </div>
    <p style="margin-top:1rem;font-size:.8125rem;color:#94a3b8;">
      * Fees are indicative and sourced from AICTE fee approval orders and college websites for <?= $current_year ?>. Verify directly with the institution before decision.
    </p>
  </div>
</section>

<!-- ══════════════════════════════════════════════════════════════════════════
     BRANCH CUTOFF COMPARISON
     H2: Which engineering branch should you choose in Bangalore?
══════════════════════════════════════════════════════════════════════════════ -->
<section class="c2u-section c2u-section--alt" id="branches" aria-labelledby="branches-h2">
  <div class="c2u-section-inner" style="max-width:900px;">
    <header style="margin-bottom:1.5rem;">
      <h2 class="c2u-section-heading" id="branches-h2">
        Which engineering branch should you choose in Bangalore?
      </h2>
      <p class="c2u-section-sub">
        KCET closing ranks for General category, <?= $current_year - 1 ?>–<?= substr((string)$current_year, 2) ?> allotment. Verify at <a href="https://kea.kar.nic.in" rel="noopener noreferrer" target="_blank" style="color:var(--blue-d);">kea.kar.nic.in</a>.
      </p>
    </header>
    <div style="overflow-x:auto;">
      <table class="compare-table" aria-label="Branch-wise KCET closing ranks Bangalore <?= $current_year ?>">
        <thead>
          <tr>
            <th scope="col">Branch</th>
            <th scope="col">RVCE</th>
            <th scope="col">MSRIT</th>
            <th scope="col">NHCE</th>
          </tr>
        </thead>
        <tbody>
          <?php foreach ($branches as $br): ?>
          <tr>
            <td style="font-weight:600;"><?= c2u_e($br['branch']) ?></td>
            <td style="color:var(--blue-d);font-weight:600;"><?= c2u_e($br['rvce_rank']) ?></td>
            <td style="color:var(--blue-d);font-weight:600;"><?= c2u_e($br['msrit_rank']) ?></td>
            <td style="color:var(--blue-d);font-weight:600;"><?= c2u_e($br['nhce_rank']) ?></td>
          </tr>
          <?php endforeach; ?>
        </tbody>
      </table>
    </div>
    <p style="margin-top:1rem;font-size:.8125rem;color:#94a3b8;">Ranks are approximate from KEA <?= $current_year - 1 ?> final allotment data.</p>
  </div>
</section>

<!-- ══════════════════════════════════════════════════════════════════════════
     FAQ
     H2: Frequently Asked Questions — Engineering Admission 2026
══════════════════════════════════════════════════════════════════════════════ -->
<section class="c2u-section" id="faq" aria-labelledby="faq-h2">
  <div class="c2u-section-inner">
    <header style="margin-bottom:2.5rem;">
      <h2 class="c2u-section-heading" id="faq-h2">
        Frequently Asked Questions — Engineering Admission <?= $current_year ?>
      </h2>
      <p class="c2u-section-sub">Answers sourced from KEA, AICTE, and COMEDK official publications.</p>
    </header>

    <div class="faq-list" role="list">
      <?php foreach ($faqs as $i => $faq): ?>
      <div class="faq-item" role="listitem">
        <button class="faq-q" id="engfaq-btn-<?= $i ?>" type="button"
                aria-expanded="false" aria-controls="engfaq-a-<?= $i ?>">
          <span><?= c2u_e($faq['q']) ?></span>
          <span class="faq-q__icon" aria-hidden="true">
            <svg width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M4 6l5 5 5-5"/></svg>
          </span>
        </button>
        <div class="faq-a" id="engfaq-a-<?= $i ?>"
             role="region" aria-labelledby="engfaq-btn-<?= $i ?>"
             data-aeo-speakable hidden>
          <p><?= c2u_e($faq['a']) ?></p>
        </div>
      </div>
      <?php endforeach; ?>
    </div>

    <div class="cta-banner" role="complementary" aria-label="Get personalised engineering guidance">
      <div>
        <h2>Get a free engineering college shortlist for <?= $current_year ?></h2>
        <p>Based on your KCET / COMEDK rank and preferred branch — from College2U counsellors.</p>
      </div>
      <a href="<?= c2u_e(c2u_url('counselor-booking')) ?>" class="btn-cta">Book free counselling →</a>
    </div>

    <nav aria-label="Related engineering guides" style="margin-top:3rem;">
      <h3 style="font-size:.8125rem;font-weight:700;color:#94a3b8;letter-spacing:.04em;text-transform:uppercase;margin:0 0 1rem;">You might also need</h3>
      <ul style="list-style:none;padding:0;margin:0;display:flex;flex-wrap:wrap;gap:.5rem;">
        <?php
        $related = [
            ['Top Engineering Colleges Bangalore',            c2u_url('engineering/top-engineering-colleges')],
            ['KCET ' . $current_year . ' Cutoff & Guide',    c2u_url('exams/kcet-2026')],
            ['COMEDK UGET ' . $current_year,                 c2u_url('exams/comedk-2026')],
            ['Engineering Stream Hub',                        c2u_url('engineering')],
            ['All Engineering Colleges Bangalore',           c2u_url('colleges')],
            ['MBA Admission Bangalore ' . $current_year,     c2u_url('management/mba-admission')],
        ];
        foreach ($related as [$label, $href]): ?>
        <li>
          <a href="<?= c2u_e($href) ?>"
             style="display:inline-block;padding:.35rem .8rem;background:#fff;border:1.5px solid #e2e8f0;border-radius:2rem;font-size:.8rem;font-weight:600;color:#374151;text-decoration:none;">
            <?= c2u_e($label) ?>
          </a>
        </li>
        <?php endforeach; ?>
      </ul>
    </nav>
  </div>
</section>

<?php require_once C2U_INCLUDES . '/footer.php'; ?>
