<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
    xmlns:html="http://www.w3.org/TR/REC-html40"
    xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
    xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
  <xsl:template match="/">
    <html lang="tr">
      <head>
        <title>Vebende A.Ş. — XML Site Haritası (Sitemap)</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="icon" type="image/x-icon" href="/favicon.ico" />
        <style>
          :root {
            --vb-bg-main: #0a0f1d;
            --vb-bg-card: #111a2e;
            --vb-bg-alt: #16223b;
            --vb-border: #1e2c4f;
            --vb-text-primary: #ffffff;
            --vb-text-secondary: #94a3b8;
            --vb-text-muted: #64748b;
            --vb-accent: #00d2ff;
            --vb-primary: #3a7bd5;
            --vb-success: #10b981;
            --vb-warning: #f59e0b;
          }

          * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
          }

          body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background-color: var(--vb-bg-main);
            color: var(--vb-text-primary);
            line-height: 1.5;
            padding: 24px;
          }

          .container {
            max-width: 1200px;
            margin: 0 auto;
          }

          .header-box {
            background: linear-gradient(135deg, var(--vb-bg-card) 0%, var(--vb-bg-alt) 100%);
            border: 1px solid var(--vb-border);
            border-radius: 12px;
            padding: 28px 32px;
            margin-bottom: 24px;
            display: flex;
            flex-direction: column;
            gap: 16px;
          }

          @media (min-width: 768px) {
            .header-box {
              flex-direction: row;
              align-items: center;
              justify-content: space-between;
            }
          }

          .brand-col {
            display: flex;
            align-items: center;
            gap: 16px;
          }

          .brand-logo {
            height: 38px;
            width: auto;
          }

          .brand-info h1 {
            font-size: 20px;
            font-weight: 700;
            color: var(--vb-text-primary);
            letter-spacing: -0.3px;
          }

          .brand-info p {
            font-size: 13px;
            color: var(--vb-text-secondary);
            margin-top: 2px;
          }

          .stats-row {
            display: flex;
            gap: 20px;
            flex-wrap: wrap;
          }

          .stat-pill {
            background: rgba(0, 210, 255, 0.08);
            border: 1px solid rgba(0, 210, 255, 0.25);
            padding: 8px 14px;
            border-radius: 8px;
            font-size: 12px;
            color: var(--vb-accent);
          }

          .stat-pill strong {
            color: #ffffff;
            font-weight: 700;
            font-size: 14px;
            margin-right: 4px;
          }

          .search-bar {
            margin-bottom: 20px;
          }

          .search-input {
            width: 100%;
            background: var(--vb-bg-card);
            border: 1px solid var(--vb-border);
            border-radius: 8px;
            padding: 12px 16px;
            color: var(--vb-text-primary);
            font-size: 14px;
            outline: none;
            transition: border-color 0.2s;
          }

          .search-input:focus {
            border-color: var(--vb-accent);
          }

          .search-input::placeholder {
            color: var(--vb-text-muted);
          }

          .table-wrap {
            background: var(--vb-bg-card);
            border: 1px solid var(--vb-border);
            border-radius: 12px;
            overflow-x: auto;
          }

          table {
            width: 100%;
            border-collapse: collapse;
            font-size: 13px;
            text-align: left;
          }

          thead {
            background: var(--vb-bg-alt);
            border-bottom: 1px solid var(--vb-border);
          }

          th {
            padding: 14px 16px;
            font-size: 11px;
            font-weight: 700;
            color: var(--vb-text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.5px;
          }

          tbody tr {
            border-bottom: 1px solid rgba(30, 44, 79, 0.5);
            transition: background 0.15s ease;
          }

          tbody tr:hover {
            background: rgba(0, 210, 255, 0.04);
          }

          td {
            padding: 12px 16px;
            vertical-align: middle;
          }

          .col-num {
            color: var(--vb-text-muted);
            font-family: monospace;
            font-size: 12px;
            width: 50px;
          }

          .url-link {
            color: var(--vb-accent);
            text-decoration: none;
            word-break: break-all;
            transition: color 0.15s ease;
          }

          .url-link:hover {
            text-decoration: underline;
            color: #ffffff;
          }

          .badge {
            display: inline-block;
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 11px;
            font-weight: 600;
            text-align: center;
          }

          .badge-p1 {
            background: rgba(16, 185, 129, 0.15);
            color: #34d399;
            border: 1px solid rgba(16, 185, 129, 0.3);
          }

          .badge-p2 {
            background: rgba(0, 210, 255, 0.15);
            color: #38bdf8;
            border: 1px solid rgba(0, 210, 255, 0.3);
          }

          .badge-p3 {
            background: rgba(245, 158, 11, 0.15);
            color: #fbbf24;
            border: 1px solid rgba(245, 158, 11, 0.3);
          }

          .badge-p4 {
            background: rgba(148, 163, 184, 0.15);
            color: #94a3b8;
            border: 1px solid rgba(148, 163, 184, 0.3);
          }

          .changefreq-tag {
            color: var(--vb-text-secondary);
            font-size: 12px;
          }

          .lastmod-tag {
            color: var(--vb-text-muted);
            font-family: monospace;
            font-size: 12px;
          }

          .footer-note {
            margin-top: 20px;
            text-align: center;
            font-size: 12px;
            color: var(--vb-text-muted);
          }

          .footer-note a {
            color: var(--vb-accent);
            text-decoration: none;
          }
        </style>
      </head>
      <body>
        <div class="container">
          <div class="header-box">
            <div class="brand-col">
              <a href="https://www.vebende.com.tr/">
                <img src="/img/vebende-logo-footer.png" alt="Vebende A.Ş." class="brand-logo" />
              </a>
              <div class="brand-info">
                <h1>Vebende A.Ş. — XML Site Haritası</h1>
                <p>Googlebot, Bingbot, Yandex ve AI/LLM Arama Ajanları İçin Optimize Edilmiş İndeks</p>
              </div>
            </div>
            <div class="stats-row">
              <div class="stat-pill">
                <strong><xsl:value-of select="count(sitemap:urlset/sitemap:url)"/></strong> Toplam URL
              </div>
              <div class="stat-pill">
                Protokol: <strong>Sitemaps.org 0.9</strong>
              </div>
              <div class="stat-pill">
                <a href="/site-haritasi.html" style="color: var(--vb-accent); text-decoration: none; font-weight: 600;">HTML Site Haritası →</a>
              </div>
            </div>
          </div>

          <div class="search-bar">
            <input type="text" id="filterInput" class="search-input" placeholder="URL veya eğitim adı filtrele..." onkeyup="filterUrls()" />
          </div>

          <div class="table-wrap">
            <table id="sitemapTable">
              <thead>
                <tr>
                  <th class="col-num">#</th>
                  <th>Konum (URL)</th>
                  <th style="width: 100px; text-align: center;">Öncelik</th>
                  <th style="width: 130px;">Değişim Sıklığı</th>
                  <th style="width: 130px;">Son Güncelleme</th>
                </tr>
              </thead>
              <tbody>
                <xsl:for-each select="sitemap:urlset/sitemap:url">
                  <tr>
                    <td class="col-num"><xsl:value-of select="position()"/></td>
                    <td>
                      <a class="url-link" href="{sitemap:loc}" target="_blank">
                        <xsl:value-of select="sitemap:loc"/>
                      </a>
                    </td>
                    <td style="text-align: center;">
                      <xsl:variable name="p" select="sitemap:priority"/>
                      <xsl:choose>
                        <xsl:when test="$p &gt;= 0.95">
                          <span class="badge badge-p1"><xsl:value-of select="$p"/></span>
                        </xsl:when>
                        <xsl:when test="$p &gt;= 0.85">
                          <span class="badge badge-p2"><xsl:value-of select="$p"/></span>
                        </xsl:when>
                        <xsl:when test="$p &gt;= 0.70">
                          <span class="badge badge-p3"><xsl:value-of select="$p"/></span>
                        </xsl:when>
                        <xsl:otherwise>
                          <span class="badge badge-p4"><xsl:value-of select="$p"/></span>
                        </xsl:otherwise>
                      </xsl:choose>
                    </td>
                    <td class="changefreq-tag">
                      <xsl:value-of select="sitemap:changefreq"/>
                    </td>
                    <td class="lastmod-tag">
                      <xsl:value-of select="sitemap:lastmod"/>
                    </td>
                  </tr>
                </xsl:for-each>
              </tbody>
            </table>
          </div>

          <div class="footer-note">
            Bu site haritası Vebende A.Ş. 2027 altyapısı tarafından otomatik üretilmektedir. 
            Detaylı bilgi için: <a href="https://www.vebende.com.tr/hizmetlerimiz.html">Kurumsal Çözümler</a> | <a href="https://www.vebende.com.tr/hibe-destekler.html">Hibe &amp; Destekler</a> | <a href="https://www.vebende.com.tr/site-haritasi.html">HTML Site Haritası</a>
          </div>
        </div>

        <script type="text/javascript">
          function filterUrls() {
            var input = document.getElementById("filterInput");
            var filter = input.value.toLowerCase();
            var table = document.getElementById("sitemapTable");
            var tr = table.getElementsByTagName("tr");

            for (var i = 1; i &lt; tr.length; i++) {
              var td = tr[i].getElementsByTagName("td")[1];
              if (td) {
                var txtValue = td.textContent || td.innerText;
                if (txtValue.toLowerCase().indexOf(filter) &gt; -1) {
                  tr[i].style.display = "";
                } else {
                  tr[i].style.display = "none";
                }
              }
            }
          }
        </script>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>
