<?php require_once 'includes/config.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Refund &amp; Return Policy — <?= SITE_NAME ?></title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@700;800;900&family=Poppins:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="<?= SITE_URL ?>/assets/css/style.css">
<link rel="icon" type="image/png" href="https://studytrack.edurx.icu/studytrack/images/studytrack.png">
<style>
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{background:#08080f;color:#e2e8f0;font-family:'Poppins',sans-serif;overflow-x:hidden}
a{text-decoration:none;color:inherit}
:root{--vi:#7c6af0;--vi2:#a78bfa;--cy:#22d3ee;--card:#13131f;--card2:#1a1a2e;--border:rgba(255,255,255,.07);--border2:rgba(255,255,255,.12);--ink:#e2e8f0;--ink-dim:#94a3b8;--ink-ghost:#475569;--glow-vi:rgba(124,106,240,.35);--r:14px;--r2:20px}

/* NAV */
.nav{position:sticky;top:0;z-index:999;background:rgba(8,8,15,.92);backdrop-filter:blur(20px);border-bottom:1px solid var(--border);padding:0 24px}
.nav-inner{max-width:1100px;margin:0 auto;display:flex;align-items:center;justify-content:space-between;height:68px}
.nav-logo{display:flex;align-items:center;gap:10px}
.nav-logo img{width:34px;height:34px;border-radius:9px}
.nav-logo-text{font-family:'Nunito',sans-serif;font-size:18px;font-weight:800;background:linear-gradient(135deg,#fff 30%,var(--vi2));-webkit-background-clip:text;-webkit-text-fill-color:transparent}
.nav-logo-by{font-size:9px;font-weight:500;color:var(--ink-ghost);letter-spacing:.5px;text-transform:uppercase;display:block;line-height:1}
.nav-links{display:flex;align-items:center;gap:4px}
.nav-links a{padding:7px 14px;border-radius:9px;font-size:14px;font-weight:500;color:var(--ink-dim);transition:all .2s}
.nav-links a:hover{color:var(--ink);background:rgba(255,255,255,.05)}
.nav-pill{background:linear-gradient(135deg,var(--vi),#9333ea)!important;color:#fff!important;box-shadow:0 0 24px var(--glow-vi);font-weight:600!important}

/* HERO */
.legal-hero{padding:72px 24px 60px;text-align:center;position:relative;overflow:hidden;background:linear-gradient(180deg,rgba(124,106,240,.08) 0%,transparent 100%);border-bottom:1px solid var(--border)}
.legal-eyebrow{display:inline-block;font-size:12px;font-weight:700;color:var(--vi2);text-transform:uppercase;letter-spacing:2px;margin-bottom:16px}
.legal-title{font-family:'Nunito',sans-serif;font-size:clamp(30px,5vw,48px);font-weight:900;color:var(--ink);letter-spacing:-.5px;margin-bottom:14px}
.legal-title span{background:linear-gradient(110deg,var(--vi2),var(--cy));-webkit-background-clip:text;-webkit-text-fill-color:transparent}
.legal-sub{font-size:15px;color:var(--ink-dim);line-height:1.75;max-width:560px;margin:0 auto 22px}
.legal-meta{display:flex;gap:20px;justify-content:center;flex-wrap:wrap;font-size:12px;color:var(--ink-ghost)}
.legal-meta span{display:flex;align-items:center;gap:6px}

/* BODY LAYOUT */
.legal-wrap{max-width:1060px;margin:0 auto;padding:48px 24px 100px;display:grid;grid-template-columns:200px 1fr;gap:32px;align-items:start}

/* TOC */
.toc-panel{position:sticky;top:88px;background:var(--card);border:1px solid var(--border2);border-radius:var(--r2);padding:20px 16px;overflow:hidden}
.toc-panel::before{content:'';position:absolute;top:0;left:0;right:0;height:3px;background:linear-gradient(90deg,var(--vi),var(--cy))}
.toc-heading{font-size:10px;font-weight:700;letter-spacing:1.5px;text-transform:uppercase;color:var(--ink-ghost);margin-bottom:13px}
.toc-list{list-style:none;display:flex;flex-direction:column;gap:1px}
.toc-list a{display:block;padding:7px 10px;border-radius:8px;font-size:12px;color:var(--ink-ghost);transition:all .18s;line-height:1.4}
.toc-list a:hover{color:var(--vi2);background:rgba(124,106,240,.08);padding-left:14px}
.toc-list a.active{color:var(--vi2);background:rgba(124,106,240,.1);font-weight:600}

/* SECTIONS */
.legal-body{min-width:0;display:flex;flex-direction:column;gap:12px}
.legal-section{background:var(--card);border:1px solid var(--border2);border-radius:var(--r2);padding:30px;transition:border-color .2s;scroll-margin-top:100px}
.legal-section:hover{border-color:rgba(124,106,240,.25)}
.sec-top{display:flex;align-items:center;gap:13px;margin-bottom:18px}
.sec-badge{width:36px;height:36px;border-radius:11px;flex-shrink:0;background:rgba(124,106,240,.1);border:1px solid rgba(124,106,240,.2);display:flex;align-items:center;justify-content:center;font-size:17px}
.sec-title{font-family:'Nunito',sans-serif;font-size:17px;font-weight:800;color:var(--ink)}
.legal-section p{font-size:14px;line-height:1.85;color:var(--ink-dim);margin-bottom:12px}
.legal-section p:last-child{margin-bottom:0}
.legal-section ul{list-style:none;display:flex;flex-direction:column;gap:8px;margin:12px 0}
.legal-section ul li{font-size:14px;line-height:1.75;color:var(--ink-dim);padding-left:20px;position:relative}
.legal-section ul li::before{content:'';position:absolute;left:2px;top:9px;width:7px;height:7px;border-radius:50%;background:linear-gradient(135deg,var(--vi2),var(--cy));opacity:.75}
.note{background:rgba(124,106,240,.07);border:1px solid rgba(124,106,240,.18);border-left:3px solid var(--vi2);border-radius:10px;padding:13px 15px;margin:13px 0;font-size:13px;line-height:1.7;color:var(--ink-dim)}
.warn{background:rgba(245,158,11,.07);border:1px solid rgba(245,158,11,.18);border-left:3px solid #f59e0b;border-radius:10px;padding:13px 15px;margin:13px 0;display:flex;gap:9px;align-items:flex-start;font-size:13px;line-height:1.7;color:var(--ink-dim)}
.warn-icon{font-size:15px;flex-shrink:0;margin-top:1px}
strong.hi{color:var(--ink)}

/* FOOTER */
.st-footer{background:#0f0f1a;border-top:1px solid var(--border);padding:48px 24px 24px}
.st-footer-inner{max-width:1100px;margin:0 auto}
.st-footer-grid{display:grid;grid-template-columns:1.6fr repeat(3,1fr);gap:40px;margin-bottom:36px}
.st-footer-desc{font-size:13px;color:var(--ink-ghost);line-height:1.75;margin-top:12px;max-width:220px}
.st-footer-col h5{font-size:11px;font-weight:700;color:var(--ink-ghost);text-transform:uppercase;letter-spacing:1.5px;margin-bottom:13px}
.st-footer-col a{display:block;font-size:13px;color:var(--ink-dim);margin-bottom:8px;transition:color .15s}
.st-footer-col a:hover{color:var(--vi2)}
.st-footer-bottom{border-top:1px solid var(--border);padding-top:20px;display:flex;align-items:center;justify-content:space-between;font-size:12px;color:var(--ink-ghost);flex-wrap:wrap;gap:8px}

@media(max-width:780px){.legal-wrap{grid-template-columns:1fr}.toc-panel{display:none}}
@media(max-width:768px){.nav-links{display:none!important}.st-footer-grid{grid-template-columns:1fr 1fr}}
@media(max-width:480px){.st-footer-grid{grid-template-columns:1fr}}
</style>
</head>
<body>

<nav class="nav">
  <div class="nav-inner">
    <a href="<?= SITE_URL ?>/home" class="nav-logo">
      <img src="https://studytrack.edurx.icu/studytrack/images/studytrack.png" alt="StudyTrack">
      <div><div class="nav-logo-text">StudyTrack</div><span class="nav-logo-by">by EduRx</span></div>
    </a>
    <div class="nav-links">
      <?php if(isLoggedIn()): ?>
        <a href="<?= SITE_URL ?>/dashboard">Dashboard</a>
        <a href="<?= SITE_URL ?>/logout">Sign Out</a>
      <?php else: ?>
        <a href="<?= SITE_URL ?>/login">Sign In</a>
        <a href="<?= SITE_URL ?>/register" class="nav-pill">Get Started Free</a>
      <?php endif; ?>
    </div>
  </div>
</nav>

<div class="legal-hero">
  <div class="legal-eyebrow">📄 Legal</div>
  <h1 class="legal-title">Refund &amp; <span>Return Policy</span></h1>
  <p class="legal-sub">This policy explains how cancellations and refunds work for <?= SITE_NAME ?> Pro subscriptions, purchased and processed through PayHere.</p>
  <div class="legal-meta">
    <span>📅 Effective: August 12, 2026</span>
    <span>🔄 Updated: August 12, 2026</span>
    <span>⏱️ 3 min read</span>
  </div>
</div>

<div class="legal-wrap">
  <aside class="toc-panel" aria-label="Table of contents">
    <div class="toc-heading">Contents</div>
    <ul class="toc-list">
      <li><a href="#r1">1. What This Policy Covers</a></li>
      <li><a href="#r2">2. Nature of the Product</a></li>
      <li><a href="#r3">3. Refund Eligibility</a></li>
      <li><a href="#r4">4. Non-Refundable Situations</a></li>
      <li><a href="#r5">5. How to Request a Refund</a></li>
      <li><a href="#r6">6. Refund Processing Time</a></li>
      <li><a href="#r7">7. Cancellations</a></li>
      <li><a href="#r8">8. Failed / Duplicate Payments</a></li>
      <li><a href="#r9">9. Contact Us</a></li>
    </ul>
  </aside>

  <div class="legal-body">
    <div class="legal-section" id="r1">
      <div class="sec-top"><div class="sec-badge">📋</div><div class="sec-title">1. What This Policy Covers</div></div>
      <p>This Refund &amp; Return Policy applies only to paid purchases of <strong class="hi"><?= SITE_NAME ?> Pro</strong> subscriptions made through our payment gateway, PayHere. <?= SITE_NAME ?>'s free plan does not involve any payment and is not covered by this policy.</p>
      <div class="note">🎓 Core study-tracking features (study log, marks, subjects, tasks, progress, heatmap, etc.) remain free and are unaffected by this policy.</div>
    </div>

    <div class="legal-section" id="r2">
      <div class="sec-top"><div class="sec-badge">💾</div><div class="sec-title">2. Nature of the Product</div></div>
      <p><?= SITE_NAME ?> Pro is a <strong class="hi">digital subscription service</strong> — not a physical product. No item is shipped, and there is nothing to "return" in the traditional sense. Upon successful payment, Pro access (unlimited AI Study Tips, AI Chat, and AI Analysis) is activated on your account automatically and immediately.</p>
    </div>

    <div class="legal-section" id="r3">
      <div class="sec-top"><div class="sec-badge">✅</div><div class="sec-title">3. Refund Eligibility</div></div>
      <p>Because Pro access activates immediately, we generally do not offer refunds once a subscription period has started. However, we will consider a full refund in the following cases:</p>
      <ul>
        <li>You were charged but Pro access was <strong>not activated</strong> on your account due to a technical error on our end, and the issue could not be resolved within 48 hours.</li>
        <li>You were charged <strong>more than once</strong> for the same subscription period (duplicate payment).</li>
        <li>You request a cancellation within <strong>24 hours</strong> of purchase and have not made substantial use of Pro-only features (e.g. AI Analysis, AI Chat) during that period.</li>
      </ul>
    </div>

    <div class="legal-section" id="r4">
      <div class="sec-top"><div class="sec-badge">🚫</div><div class="sec-title">4. Non-Refundable Situations</div></div>
      <p>Refunds will <strong class="hi">not</strong> be issued in the following situations:</p>
      <ul>
        <li>You simply changed your mind after actively using Pro features for more than 24 hours.</li>
        <li>Partial-period refunds for cancelling partway through a paid monthly or yearly term.</li>
        <li>Dissatisfaction with AI-generated content quality (AI responses are generated by a third-party model and may vary).</li>
        <li>Account suspension or termination due to a violation of our <a href="<?= SITE_URL ?>/terms" style="color:var(--vi2)">Terms &amp; Conditions</a>.</li>
      </ul>
      <div class="warn"><span class="warn-icon">⚠️</span><span>Since <?= SITE_NAME ?> Pro does not currently auto-renew, you will not be charged again unless you manually make a new payment — so there is no "forgot to cancel" scenario to worry about.</span></div>
    </div>

    <div class="legal-section" id="r5">
      <div class="sec-top"><div class="sec-badge">✉️</div><div class="sec-title">5. How to Request a Refund</div></div>
      <p>To request a refund, email us at <a href="mailto:support@edurx.icu" style="color:var(--vi2)">support@edurx.icu</a> with:</p>
      <ul>
        <li>The email address registered on your <?= SITE_NAME ?> account</li>
        <li>The PayHere Order ID or payment confirmation (found in your payment receipt/email)</li>
        <li>A brief reason for the refund request</li>
      </ul>
      <p>We will review your request and respond within 3 business days.</p>
    </div>

    <div class="legal-section" id="r6">
      <div class="sec-top"><div class="sec-badge">⏱️</div><div class="sec-title">6. Refund Processing Time</div></div>
      <p>Approved refunds are processed back to your original payment method through PayHere. Depending on your bank or card issuer, refunds typically take <strong class="hi">5–14 business days</strong> to reflect in your account after approval. <?= SITE_NAME ?> does not control bank processing times.</p>
    </div>

    <div class="legal-section" id="r7">
      <div class="sec-top"><div class="sec-badge">🔚</div><div class="sec-title">7. Cancellations</div></div>
      <p>Since Pro subscriptions do not auto-renew, there is no ongoing subscription to "cancel" — your Pro access simply ends at the close of the period you paid for, and you decide whether to purchase another period. If you'd like to stop using Pro features immediately and request an eligible refund under Section 3, contact us using the steps in Section 5.</p>
    </div>

    <div class="legal-section" id="r8">
      <div class="sec-top"><div class="sec-badge">🔁</div><div class="sec-title">8. Failed / Duplicate Payments</div></div>
      <p>If a payment fails or is interrupted but an amount was still deducted from your account, this is typically reversed automatically by PayHere or your bank within a few business days. If it is not reversed, contact us with your payment reference and we'll help resolve it with PayHere directly.</p>
    </div>

    <div class="legal-section" id="r9">
      <div class="sec-top"><div class="sec-badge">📬</div><div class="sec-title">9. Contact Us</div></div>
      <p>For any refund, billing, or payment questions:</p>
      <ul>
        <li>Platform: <strong class="hi"><?= SITE_NAME ?></strong></li>
        <li>Website: <a href="<?= SITE_URL ?>/home" style="color:var(--vi2)"><?= SITE_URL ?></a></li>
        <li>Email: <a href="mailto:support@edurx.icu" style="color:var(--vi2)">support@edurx.icu</a></li>
      </ul>
      <div class="note" style="margin-top:16px">💳 Payments are processed by PayHere, a licensed Sri Lankan payment gateway. This policy governs refunds from <?= SITE_NAME ?> for its own subscription product; it does not override PayHere's own terms of service.</div>
    </div>
  </div>
</div>

<footer class="st-footer">
  <div class="st-footer-inner">
    <div class="st-footer-grid">
      <div>
        <a href="<?= SITE_URL ?>/home" class="nav-logo"><img src="https://studytrack.edurx.icu/studytrack/images/studytrack.png" alt="" style="width:30px;height:30px;border-radius:8px"><div><div class="nav-logo-text" style="font-size:16px">StudyTrack</div><span class="nav-logo-by">by EduRx</span></div></a>
        <p class="st-footer-desc">Free study tracker for Sri Lankan A/L students.</p>
      </div>
      <div class="st-footer-col"><h5>Platform</h5><a href="<?= SITE_URL ?>/register">Register</a><a href="<?= SITE_URL ?>/login">Sign In</a><a href="<?= SITE_URL ?>/home">Home</a></div>
      <div class="st-footer-col"><h5>Legal</h5><a href="<?= SITE_URL ?>/terms">Terms & Conditions</a><a href="<?= SITE_URL ?>/privacy">Privacy Policy</a><a href="<?= SITE_URL ?>/refund-policy" style="color:var(--vi2)">Refund &amp; Return Policy</a></div>
      <div class="st-footer-col"><h5>Support</h5><a href="<?= SITE_URL ?>/forgot-password">Forgot Password</a><a href="<?= SITE_URL ?>/contact">Contact Us</a></div>
    </div>
    <div class="st-footer-bottom"><span>© <?= date('Y') ?> <?= SITE_NAME ?>. All rights reserved.</span><span>Built with ❤️ for Sri Lankan A/L students</span></div>
  </div>
</footer>

<script>
(function(){
  var sections=document.querySelectorAll('.legal-section[id]');
  var links=document.querySelectorAll('.toc-list a');
  if(!sections.length) return;
  var io=new IntersectionObserver(function(entries){
    entries.forEach(function(e){
      if(!e.isIntersecting) return;
      links.forEach(function(l){l.classList.remove('active')});
      var a=document.querySelector('.toc-list a[href="#'+e.target.id+'"]');
      if(a) a.classList.add('active');
    });
  },{rootMargin:'-15% 0px -75% 0px'});
  sections.forEach(function(s){io.observe(s)});
  links.forEach(function(a){a.addEventListener('click',function(e){e.preventDefault();var t=document.querySelector(a.getAttribute('href'));if(t)t.scrollIntoView({behavior:'smooth',block:'start'})})});
})();
</script>
</body>
</html>
