---
import Base from '../layouts/Base.astro';
const main = `<div class="checkout-layout">
    <h1 class="checkout-heading">Kasse</h1>

    <!-- Form -->
    <div class="checkout-form-wrap">

      <!-- Progress steps -->
      <div class="checkout-steps" aria-label="Bestellschritte">
        <div class="step active"><span class="step-num">1</span>Lieferung</div>
        <div class="step"><span class="step-num">2</span>Zahlung</div>
        <div class="step"><span class="step-num">3</span>Bestätigung</div>
      </div>

      <form id="checkout-form" novalidate>
        <!-- Contact -->
        <div class="form-section">
          <h2 class="form-section-title">Kontakt</h2>
          <div class="form-grid full">
            <div class="form-field">
              <label class="form-label" for="email">E-Mail-Adresse *</label>
              <input class="form-input" type="email" id="email" name="email" placeholder="deine@email.de" required autocomplete="email">
            </div>
          </div>
        </div>

        <!-- Shipping address -->
        <div class="form-section">
          <h2 class="form-section-title">Lieferadresse</h2>
          <div class="form-grid">
            <div class="form-field">
              <label class="form-label" for="vorname">Vorname *</label>
              <input class="form-input" type="text" id="vorname" name="vorname" placeholder="Max" required autocomplete="given-name">
            </div>
            <div class="form-field">
              <label class="form-label" for="nachname">Nachname *</label>
              <input class="form-input" type="text" id="nachname" name="nachname" placeholder="Mustermann" required autocomplete="family-name">
            </div>
            <div class="form-field span-2">
              <label class="form-label" for="firma">Firma (optional)</label>
              <input class="form-input" type="text" id="firma" name="firma" placeholder="TGA Solutions GmbH" autocomplete="organization">
            </div>
            <div class="form-field span-2">
              <label class="form-label" for="strasse">Straße und Hausnummer *</label>
              <input class="form-input" type="text" id="strasse" name="strasse" placeholder="Kleine Kamp 1" required autocomplete="street-address">
            </div>
            <div class="form-field">
              <label class="form-label" for="plz">PLZ *</label>
              <input class="form-input" type="text" id="plz" name="plz" placeholder="21702" required autocomplete="postal-code" pattern="[0-9]{5}">
            </div>
            <div class="form-field">
              <label class="form-label" for="ort">Ort *</label>
              <input class="form-input" type="text" id="ort" name="ort" placeholder="Ahlerstedt" required autocomplete="address-level2">
            </div>
            <div class="form-field span-2">
              <label class="form-label" for="land">Land *</label>
              <select class="form-select" id="land" name="land" required autocomplete="country">
                <option value="DE" selected>Deutschland</option>
                <option value="AT">Österreich</option>
                <option value="CH">Schweiz</option>
              </select>
            </div>
          </div>
        </div>

        <!-- Payment -->
        <div class="form-section">
          <h2 class="form-section-title">Zahlungsmethode</h2>
          <div class="payment-options" role="group" aria-label="Zahlungsoptionen">
            <label class="payment-option">
              <input class="payment-radio" type="radio" name="payment" value="paypal" checked>
              <span class="payment-label">PayPal</span>
              <span class="payment-logo">PayPal</span>
            </label>
            <label class="payment-option">
              <input class="payment-radio" type="radio" name="payment" value="kreditkarte">
              <span class="payment-label">Kreditkarte (Visa / Mastercard)</span>
              <span class="payment-logo">VISA · MC</span>
            </label>
            <label class="payment-option">
              <input class="payment-radio" type="radio" name="payment" value="ueberweisung">
              <span class="payment-label">Banküberweisung (Vorkasse)</span>
              <span class="payment-logo">IBAN</span>
            </label>
          </div>
        </div>

        <!-- Submit -->
        <div class="checkout-submit-area">
          <button type="submit" class="checkout-submit-btn">
            Jetzt bestellen →
          </button>
          <p class="checkout-legal">
            Mit deiner Bestellung stimmst du unseren <a href="/impressum">AGB</a> zu
            und bestätigst, unsere <a href="/datenschutz">Datenschutzerklärung</a> gelesen zu haben.
            Du hast ein 14-tägiges Widerrufsrecht.
          </p>
        </div>
      </form>
    </div>

    <!-- Order Summary -->
    <aside class="order-summary" aria-label="Bestellübersicht">
      <div class="order-summary-title">Deine Bestellung</div>

      <div id="checkout-order-items" aria-label="Bestellte Artikel"></div>

      <div class="order-divider"></div>

      <div class="order-line">
        <span>Zwischensumme</span>
        <strong class="js-cart-subtotal">–</strong>
      </div>
      <div class="order-line">
        <span>Versand (DE)</span>
        <strong class="js-checkout-shipping">–</strong>
      </div>

      <div class="order-divider"></div>

      <div class="order-total">
        <span class="order-total-label">Gesamt</span>
        <span class="order-total-price js-checkout-total">–</span>
      </div>

      <div class="security-badge">
        SSL-verschlüsselt · sichere Datenübertragung · DSGVO-konform
      </div>
    </aside>

  </div>`;
---
<Base title={"Kasse — PMPNZNG"} page="checkout" active="">
  <Fragment set:html={main} />
</Base>

<style is:global>

.checkout-layout {
  max-width: 1100px; margin: 0 auto;
  padding: var(--sp-lg) var(--gutter) var(--sp-2xl);
  display: grid; grid-template-columns: 1fr 380px;
  gap: clamp(32px, 4vw, 64px); align-items: start;
}
.checkout-heading {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.5vw, 40px);
  font-weight: 900; text-transform: uppercase; line-height: 1;
  grid-column: 1 / -1;
  padding-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--c-border);
}
/* Steps */
.checkout-steps {
  display: flex; gap: 0; margin-bottom: var(--sp-md);
  border: 1px solid var(--c-border);
}
.step {
  flex: 1; padding: 12px 16px; text-align: center;
  font-size: 9px; font-weight: 900; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--c-text-dim);
  border-right: 1px solid var(--c-border);
  position: relative;
}
.step:last-child { border-right: none; }
.step.active { color: var(--c-text); background: var(--c-surface-1); }
.step.active::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0;
  height: 2px; background: var(--c-red);
}
.step-num {
  display: block; font-family: var(--font-display);
  font-size: 16px; font-weight: 900; margin-bottom: 2px;
}

/* Form */
.checkout-form-wrap { display: flex; flex-direction: column; gap: var(--sp-md); }
.form-section {
  background: var(--c-surface-1);
  border: 1px solid var(--c-border);
  padding: var(--sp-md);
}
.form-section-title {
  font-family: var(--font-display); font-size: 11px; font-weight: 900;
  letter-spacing: 0.22em; text-transform: uppercase;
  margin-bottom: var(--sp-sm);
  padding-bottom: 12px; border-bottom: 1px solid var(--c-border);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid.full { grid-template-columns: 1fr; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.span-2 { grid-column: 1 / -1; }
.form-label {
  font-size: 9px; letter-spacing: 0.18em; font-weight: 700;
  text-transform: uppercase; color: var(--c-text-muted);
}
.form-input {
  background: var(--c-surface-2); border: 1px solid var(--c-border-mid);
  color: var(--c-text); padding: 12px 14px; font-size: 14px;
  transition: border-color 0.15s;
  width: 100%;
}
.form-input:focus { outline: none; border-color: var(--c-red); }
.form-input::placeholder { color: var(--c-text-dim); font-size: 13px; }
.form-select {
  background: var(--c-surface-2); border: 1px solid var(--c-border-mid);
  color: var(--c-text); padding: 12px 14px; font-size: 14px;
  width: 100%; cursor: pointer;
  transition: border-color 0.15s;
}
.form-select:focus { outline: none; border-color: var(--c-red); }

/* Payment */
.payment-options { display: flex; flex-direction: column; gap: 8px; }
.payment-option {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--c-border-mid);
  padding: 14px 16px; cursor: pointer;
  transition: border-color 0.15s;
  background: var(--c-surface-2);
}
.payment-option:has(input:checked) { border-color: var(--c-red); }
.payment-radio { accent-color: var(--c-red); width: 16px; height: 16px; flex-shrink: 0; }
.payment-label { font-size: 13px; font-weight: 600; flex: 1; }
.payment-logo {
  font-size: 9px; letter-spacing: 0.16em; font-weight: 900;
  text-transform: uppercase; color: var(--c-text-muted);
  border: 1px solid var(--c-border-mid); padding: 3px 8px;
}

/* Submit */
.checkout-submit-area { display: flex; flex-direction: column; gap: 12px; }
.checkout-submit-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 20px; font-size: 12px; font-weight: 900;
  letter-spacing: 0.2em; text-transform: uppercase; font-family: var(--font-display);
  background: var(--c-red); color: #fff; border: none; cursor: pointer;
  transition: background var(--dur-fast);
}
.checkout-submit-btn:hover { background: var(--c-red-bright); }
.checkout-legal {
  font-size: 10px; color: var(--c-text-dim); line-height: 1.65;
  text-align: center;
}
.checkout-legal a { color: var(--c-text-muted); text-decoration: underline; }

/* Order Summary Sidebar */
.order-summary {
  background: var(--c-surface-1);
  border: 1px solid var(--c-border);
  padding: var(--sp-md);
  position: sticky; top: calc(var(--header-h) + 16px);
  display: flex; flex-direction: column; gap: 16px;
}
.order-summary-title {
  font-family: var(--font-display); font-size: 11px; font-weight: 900;
  letter-spacing: 0.22em; text-transform: uppercase;
  padding-bottom: 12px; border-bottom: 1px solid var(--c-border);
}
#checkout-order-items { display: flex; flex-direction: column; gap: 8px; }
.checkout-item {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--c-text-muted);
}
.checkout-item span:last-child { color: var(--c-text); font-weight: 600; white-space: nowrap; }
.order-divider { height: 1px; background: var(--c-border); }
.order-line { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--c-text-muted); }
.order-line strong { color: var(--c-text); }
.order-total { display: flex; justify-content: space-between; align-items: baseline; }
.order-total-label { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 900; }
.order-total-price { font-family: var(--font-display); font-size: 22px; font-weight: 900; }

.security-badge {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--c-border);
  padding: 10px 14px; font-size: 10px; color: var(--c-text-muted);
}
.security-badge::before { content: '🔒'; font-size: 14px; }

@media (max-width: 900px) {
  .checkout-layout { grid-template-columns: 1fr; }
  .order-summary { position: static; order: -1; }
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-field.span-2 { grid-column: 1; }
}

</style>