import { h } from "./jsx";
import { Sidebar } from "./components/Sidebar";
import { PaliadinWidget } from "./components/PaliadinWidget";
import { BottomNav } from "./components/BottomNav";
import { Footer } from "./components/Footer";
import { PWAHead } from "./components/PWAHead";

export function renderCourts(): string {
  return "<!DOCTYPE html>" + (
    <html lang="de">
      <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
        <meta name="theme-color" content="#BFF355" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="default" />
        <PWAHead />
        <title data-i18n="gerichte.title">Gerichtsverzeichnis &mdash; Paliad</title>
        <link rel="stylesheet" href="/assets/global.css" />
      </head>
      <body className="has-sidebar">
        <Sidebar currentPath="/courts" />
        <BottomNav currentPath="/courts" />

        <main>
          <section className="tool-page">
            <div className="container">
              <div className="tool-header">
                <div className="gerichte-header-row">
                  <div>
                    <h1 data-i18n="gerichte.heading">Gerichtsverzeichnis</h1>
                    <p className="tool-subtitle" data-i18n="gerichte.subtitle">
                      Kontaktdaten, Adressen und Einreichungshinweise f&uuml;r Gerichte, Kammern und &Auml;mter im Patentbereich.
                    </p>
                  </div>
                  <button className="btn-suggest" id="btn-feedback" type="button">
                    <span data-i18n="gerichte.feedback.btn">Korrektur vorschlagen</span>
                  </button>
                </div>
              </div>

              <div className="gerichte-controls">
                <div className="glossar-search-wrap">
                  <svg className="glossar-search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                    <circle cx="11" cy="11" r="8" />
                    <line x1="21" y1="21" x2="16.65" y2="16.65" />
                  </svg>
                  <input
                    type="text"
                    id="gerichte-search"
                    className="glossar-search"
                    placeholder="Suchen / Search..."
                    data-i18n-placeholder="gerichte.search.placeholder"
                    autocomplete="off"
                  />
                  <span className="glossar-count" id="gerichte-count" />
                </div>

                <div className="gerichte-filter-row">
                  <span className="gerichte-filter-label" data-i18n="gerichte.filter.type">Typ:</span>
                  <div className="glossar-filters" id="gerichte-group-filters">
                    <button className="filter-pill active" data-group="all" type="button" data-i18n="gerichte.filter.all">Alle</button>
                    <button className="filter-pill" data-group="UPC" type="button">UPC</button>
                    <button className="filter-pill" data-group="DE" type="button" data-i18n="gerichte.filter.de">Deutschland</button>
                    <button className="filter-pill" data-group="EPA" type="button" data-i18n="gerichte.filter.epa">EPA</button>
                    <button className="filter-pill" data-group="National" type="button" data-i18n="gerichte.filter.national">National</button>
                  </div>
                </div>

                <div className="gerichte-filter-row">
                  <span className="gerichte-filter-label" data-i18n="gerichte.filter.country">Land:</span>
                  <div className="glossar-filters" id="gerichte-country-filters">
                    <button className="filter-pill active" data-country="all" type="button" data-i18n="gerichte.filter.all">Alle</button>
                  </div>
                </div>
              </div>

              <div className="gerichte-list" id="gerichte-list" />

              <div className="glossar-empty" id="gerichte-empty" style="display:none">
                <p data-i18n="gerichte.empty">Keine Treffer.</p>
              </div>

              {/* Feedback modal */}
              <div className="modal-overlay" id="feedback-modal" style="display:none">
                <div className="modal-card">
                  <div className="modal-header">
                    <h2 data-i18n="gerichte.feedback.title">Korrektur vorschlagen</h2>
                    <button className="modal-close" id="feedback-close" type="button">&times;</button>
                  </div>
                  <form id="feedback-form">
                    <input type="hidden" id="feedback-court-id" value="" />
                    <div className="form-field">
                      <label htmlFor="feedback-court-label" data-i18n="gerichte.feedback.court">Gericht</label>
                      <input type="text" id="feedback-court-label" readonly />
                    </div>
                    <div className="form-field">
                      <label htmlFor="feedback-type" data-i18n="gerichte.feedback.type">Art</label>
                      <select id="feedback-type" required>
                        <option value="address" data-i18n="gerichte.feedback.type.address">Adresse / Kontaktdaten</option>
                        <option value="filing" data-i18n="gerichte.feedback.type.filing">Einreichungshinweise</option>
                        <option value="notes" data-i18n="gerichte.feedback.type.notes">Praktische Hinweise</option>
                        <option value="missing" data-i18n="gerichte.feedback.type.missing">Fehlendes Gericht</option>
                        <option value="other" data-i18n="gerichte.feedback.type.other">Sonstiges</option>
                      </select>
                    </div>
                    <div className="form-field">
                      <label htmlFor="feedback-message" data-i18n="gerichte.feedback.message">Nachricht</label>
                      <textarea id="feedback-message" rows={4} required />
                    </div>
                    <div className="form-actions">
                      <button type="button" className="btn-cancel" id="feedback-cancel" data-i18n="gerichte.feedback.cancel">Abbrechen</button>
                      <button type="submit" className="btn-submit" data-i18n="gerichte.feedback.submit">Absenden</button>
                    </div>
                    <p className="form-msg" id="feedback-msg" />
                  </form>
                </div>
              </div>
            </div>
          </section>
        </main>

        <Footer />
        <PaliadinWidget />
        <script src="/assets/courts.js"></script>
      </body>
    </html>
  );
}
