<?php
require_once __DIR__ . '/includes/config.php';
requireLogin();
$user        = currentUser();
$currentPage = '';
$pageTitle   = 'Terms & Conditions';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>Terms & Conditions – SPACE</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=Poppins:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/main.css">
<meta name="csrf-token" content="<?= e(csrfToken()) ?>">
<style>
.legal-wrap { max-width: 760px; margin: 0 auto; }
.legal-hero { text-align: center; padding: 32px 0 28px; }
.legal-hero h1 { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.legal-hero p  { font-size: 13px; color: var(--muted); }
.legal-card { background: var(--bg); border-radius: 24px; padding: 32px 28px; box-shadow: var(--neu-out); margin-bottom: 16px; }
.legal-section-title { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.legal-body { font-size: 13px; line-height: 1.8; color: #444; }
.legal-body p { margin-bottom: 12px; }
.legal-body ul { padding-left: 20px; margin-bottom: 12px; }
.legal-body li { margin-bottom: 6px; }
.legal-updated { font-size: 11px; color: var(--muted); text-align: center; margin-top: 20px; }
@media (max-width: 768px) { .legal-card { padding: 22px 18px; } }
</style>
</head>
<body>
<div class="app-layout">
  <?php include __DIR__ . '/includes/sidebar.php'; ?>
  <main class="main-content">
    <div class="mobile-header">
      <button class="menu-open-btn" id="menu-open-btn">
        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" width="20"><path stroke-linecap="round" d="M4 6h16M4 12h16M4 18h16"/></svg>
      </button>
      <div class="logo-circle-sm"><img src="assets/img/logo.svg" alt="SPACE" width="26"></div>
      <a href="ai.php" style="font-size:11px;color:var(--muted);font-weight:600;">← Back</a>
    </div>

    <div class="legal-wrap">
      <div class="legal-hero">
        <div style="font-size:40px;margin-bottom:8px;">📋</div>
        <h1>Terms & Conditions</h1>
        <p>Please read these terms carefully before using SPACE.</p>
      </div>

      <div class="legal-card">
        <div class="legal-section-title">📌 1. Acceptance of Terms</div>
        <div class="legal-body">
          <p>By accessing and using the SPACE application ("the App"), you accept and agree to be bound by these Terms and Conditions. If you do not agree to these terms, please do not use the App.</p>
          <p>These terms apply to all users of the App, including students, educators, and any other individuals who access the service.</p>
        </div>
      </div>

      <div class="legal-card">
        <div class="legal-section-title">🎓 2. Use of the App</div>
        <div class="legal-body">
          <p>SPACE is an educational productivity application designed to assist students in organizing their academic life. You agree to use the App only for lawful educational purposes.</p>
          <p><strong>You may not:</strong></p>
          <ul>
            <li>Use the App to distribute harmful, offensive, or illegal content</li>
            <li>Attempt to gain unauthorized access to any part of the App or its servers</li>
            <li>Use automated tools to scrape, crawl, or extract data from the App</li>
            <li>Share your account credentials with other persons</li>
            <li>Use the AI features to generate plagiarized academic work intended to deceive educational institutions</li>
            <li>Impersonate any person or entity while using the App</li>
          </ul>
        </div>
      </div>

      <div class="legal-card">
        <div class="legal-section-title">🤖 3. AI-Generated Content</div>
        <div class="legal-body">
          <p>The SPACE App includes "Astro AI," an artificial intelligence assistant powered by Groq's language models. You acknowledge that:</p>
          <ul>
            <li>AI-generated content may contain inaccuracies or errors</li>
            <li>You are responsible for verifying any information provided by the AI before relying on it academically</li>
            <li>AI responses should be used as a learning aid, not as a definitive academic source</li>
            <li>Conversations with Astro AI are stored and may be used to improve the service</li>
            <li>The AI should not be used to generate content that violates academic integrity policies of your institution</li>
          </ul>
        </div>
      </div>

      <div class="legal-card">
        <div class="legal-section-title">📁 4. User Content & Uploaded Files</div>
        <div class="legal-body">
          <p>When you upload documents to the App for analysis, you represent that you have the right to share this content. You retain ownership of your uploaded content, but grant SPACE a limited license to process it for the purpose of providing the service.</p>
          <ul>
            <li>Uploaded files are processed for text extraction and AI analysis</li>
            <li>Files are stored temporarily and linked to your account</li>
            <li>You may delete uploaded documents at any time</li>
            <li>Do not upload documents containing sensitive personal information of third parties</li>
          </ul>
        </div>
      </div>

      <div class="legal-card">
        <div class="legal-section-title">🔐 5. Account Security</div>
        <div class="legal-body">
          <p>You are responsible for maintaining the confidentiality of your account credentials. You agree to:</p>
          <ul>
            <li>Choose a strong, unique password for your SPACE account</li>
            <li>Not share your login credentials with others</li>
            <li>Notify us immediately if you suspect unauthorized access to your account</li>
            <li>Log out of your account when using shared devices</li>
          </ul>
          <p>SPACE shall not be liable for any loss or damage arising from your failure to comply with these security obligations.</p>
        </div>
      </div>

      <div class="legal-card">
        <div class="legal-section-title">⚠️ 6. Disclaimer of Warranties</div>
        <div class="legal-body">
          <p>The App is provided "as is" without warranties of any kind. SPACE does not guarantee that the App will be error-free, uninterrupted, or that AI-generated content will be accurate. Academic results are the sole responsibility of the user.</p>
        </div>
      </div>

      <div class="legal-card">
        <div class="legal-section-title">🔄 7. Changes to Terms</div>
        <div class="legal-body">
          <p>We reserve the right to modify these terms at any time. Continued use of the App after changes constitutes your acceptance of the new terms. We will notify users of significant changes via the App.</p>
        </div>
      </div>

      <div class="legal-card">
        <div class="legal-section-title">📩 8. Contact</div>
        <div class="legal-body">
          <p>If you have questions about these Terms and Conditions, please contact us through the App's support section or reach out to your institution's system administrator.</p>
        </div>
      </div>

      <p class="legal-updated">Last updated: <?= date('F j, Y') ?> · SPACE v2.0</p>

      <div style="text-align:center;padding-bottom:40px;">
        <a href="ai.php" class="btn btn-primary">← Back to Astro AI</a>
      </div>
    </div>
  </main>

  <nav class="mobile-bottom-nav">
    <a href="dashboard.php" class="mob-nav-btn">
      <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="20"><path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>
    </a>
    <a href="ai.php" class="mob-nav-fab">
      <svg viewBox="0 0 24 24" fill="none" stroke="#ec4899" stroke-width="2.2" stroke-linecap="round" width="26"><path d="M12 2a10 10 0 100 20"/><path d="M22 12A10 10 0 0012 2v10z"/></svg>
    </a>
    <a href="flashcards.php" class="mob-nav-btn">
      <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="20"><rect x="2" y="6" width="20" height="13" rx="2"/><path d="M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2"/></svg>
    </a>
  </nav>
</div>
<script src="assets/js/app.js"></script>
</body>
</html>
