<?php
session_start();

// Sprache ermitteln (URL-Parameter hat immer Vorrang)
$supported_langs = ['de', 'en', 'fr', 'es'];
if (isset($_GET['lang']) && in_array($_GET['lang'], $supported_langs)) {
    $lang = $_GET['lang'];
} elseif (isset($_SESSION['lang']) && in_array($_SESSION['lang'], $supported_langs)) {
    $lang = $_SESSION['lang'];
} else {
    $lang = 'de';
}
$_SESSION['lang'] = $lang;

// Übersetzungen
$translations = [
    'de' => [
        'page_title' => 'PDF-Markierungstool – Yoshi Tools',
        'title' => 'PDF-Markierungstool',
        'subtitle' => 'Markieren, hervorheben und kommentieren von PDF-Dokumenten',
        'description' => 'Unser PDF-Markierungstool ermöglicht es Ihnen, PDF-Dokumente schnell und einfach zu bearbeiten.',
        'features_title' => 'Funktionen',
        'features' => [
            'Textstellen farbig hervorheben',
            'Anmerkungen und Kommentare hinzufügen',
            'Freihand-Zeichnungen erstellen',
            'Textfelder einfügen',
            'Stempel und Symbole platzieren',
            'Markierungen speichern und exportieren'
        ],
        'coming_soon' => 'Dieses Tool wird bald verfügbar sein!',
        'back' => '← Zurück zur Startseite'
    ],
    'en' => [
        'page_title' => 'PDF Marking Tool – Yoshi Tools',
        'title' => 'PDF Marking Tool',
        'subtitle' => 'Highlight, mark and add notes to PDF documents',
        'description' => 'Our PDF marking tool allows you to quickly and easily edit PDF documents.',
        'features_title' => 'Features',
        'features' => [
            'Highlight text in color',
            'Add annotations and comments',
            'Create freehand drawings',
            'Insert text fields',
            'Place stamps and symbols',
            'Save and export markings'
        ],
        'coming_soon' => 'This tool will be available soon!',
        'back' => '← Back to homepage'
    ],
    'fr' => [
        'page_title' => 'Outil de marquage PDF – Yoshi Tools',
        'title' => 'Outil de marquage PDF',
        'subtitle' => 'Surligner, marquer et annoter des documents PDF',
        'description' => 'Notre outil de marquage PDF vous permet de modifier rapidement et facilement des documents PDF.',
        'features_title' => 'Fonctionnalités',
        'features' => [
            'Surligner le texte en couleur',
            'Ajouter des annotations et commentaires',
            'Créer des dessins à main levée',
            'Insérer des zones de texte',
            'Placer des tampons et symboles',
            'Enregistrer et exporter les marquages'
        ],
        'coming_soon' => 'Cet outil sera bientôt disponible !',
        'back' => '← Retour à la page d\'accueil'
    ],
    'es' => [
        'page_title' => 'Herramienta de marcado PDF – Yoshi Tools',
        'title' => 'Herramienta de marcado PDF',
        'subtitle' => 'Resalta, marca y añade notas a documentos PDF',
        'description' => 'Nuestra herramienta de marcado PDF te permite editar documentos PDF de forma rápida y sencilla.',
        'features_title' => 'Características',
        'features' => [
            'Resaltar texto en color',
            'Añadir anotaciones y comentarios',
            'Crear dibujos a mano alzada',
            'Insertar campos de texto',
            'Colocar sellos y símbolos',
            'Guardar y exportar marcas'
        ],
        'coming_soon' => '¡Esta herramienta estará disponible pronto!',
        'back' => '← Volver a la página principal'
    ]
];

$t = $translations[$lang];
?>
<!doctype html>
<html lang="<?php echo $lang; ?>">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo $t['page_title']; ?></title>
<style>
html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: url('assets/backgrounds/background1.png') center/cover no-repeat fixed;
  min-height: 100vh;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 24px;
}

.card {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

h1 {
  margin: 0 0 8px;
  font-size: 26px;
  color: #222;
}

.subtitle {
  color: #666;
  font-size: 15px;
  margin-bottom: 20px;
}

.description {
  color: #444;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.features-title {
  font-size: 18px;
  font-weight: 700;
  color: #333;
  margin-bottom: 12px;
}

.features-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px 0;
}

.features-list li {
  padding: 8px 0 8px 28px;
  position: relative;
  color: #444;
  font-size: 14px;
}

.features-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #56ab2f;
  font-weight: 700;
}

.coming-soon-badge {
  background: linear-gradient(135deg, #a8e063 0%, #56ab2f 100%);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 20px;
}

/* Language Switcher */
.lang-switcher {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  gap: 8px;
}

.lang-btn {
  width: 36px;
  height: 26px;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  padding: 0;
  background: #fff;
  text-decoration: none;
  display: block;
}

.lang-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.lang-btn.active {
  border-color: #FFD700;
  box-shadow: 0 0 12px 3px rgba(255,215,0,0.6), 0 4px 12px rgba(0,0,0,0.3);
  transform: scale(1.15);
}

.lang-btn svg {
  width: 100%;
  height: 100%;
  display: block;
}

.back-link {
  display: inline-block;
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.back-link:hover {
  text-decoration: underline;
}
</style>
</head>
<body>

<!-- Language Switcher -->
<div class="lang-switcher">
  <a href="produkt-pdf.php?lang=de" class="lang-btn <?php echo $lang === 'de' ? 'active' : ''; ?>" title="Deutsch">
    <svg viewBox="0 0 5 3"><rect width="5" height="1" y="0" fill="#000"/><rect width="5" height="1" y="1" fill="#D00"/><rect width="5" height="1" y="2" fill="#FFCE00"/></svg>
  </a>
  <a href="produkt-pdf.php?lang=en" class="lang-btn <?php echo $lang === 'en' ? 'active' : ''; ?>" title="English">
    <svg viewBox="0 0 60 30"><clipPath id="s"><path d="M0,0 v30 h60 v-30 z"/></clipPath><clipPath id="t"><path d="M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z"/></clipPath><g clip-path="url(#s)"><path d="M0,0 v30 h60 v-30 z" fill="#012169"/><path d="M0,0 L60,30 M60,0 L0,30" stroke="#fff" stroke-width="6"/><path d="M0,0 L60,30 M60,0 L0,30" clip-path="url(#t)" stroke="#C8102E" stroke-width="4"/><path d="M30,0 v30 M0,15 h60" stroke="#fff" stroke-width="10"/><path d="M30,0 v30 M0,15 h60" stroke="#C8102E" stroke-width="6"/></g></svg>
  </a>
  <a href="produkt-pdf.php?lang=fr" class="lang-btn <?php echo $lang === 'fr' ? 'active' : ''; ?>" title="Français">
    <svg viewBox="0 0 3 2"><rect width="1" height="2" x="0" fill="#002395"/><rect width="1" height="2" x="1" fill="#fff"/><rect width="1" height="2" x="2" fill="#ED2939"/></svg>
  </a>
  <a href="produkt-pdf.php?lang=es" class="lang-btn <?php echo $lang === 'es' ? 'active' : ''; ?>" title="Español">
    <svg viewBox="0 0 3 2"><rect width="3" height="2" fill="#AA151B"/><rect width="3" height="1" y="0.5" fill="#F1BF00"/></svg>
  </a>
</div>

<div class="container">
  <div class="card">
    <h1><?php echo $t['title']; ?></h1>
    <p class="subtitle"><?php echo $t['subtitle']; ?></p>

    <p class="description"><?php echo $t['description']; ?></p>

    <h2 class="features-title"><?php echo $t['features_title']; ?></h2>
    <ul class="features-list">
      <?php foreach ($t['features'] as $feature): ?>
        <li><?php echo $feature; ?></li>
      <?php endforeach; ?>
    </ul>

    <div class="coming-soon-badge">
      <?php echo $t['coming_soon']; ?>
    </div>

    <a href="index.html" class="back-link"><?php echo $t['back']; ?></a>
  </div>
</div>

</body>
</html>
