/* =====================
   Basis / Farben
   ===================== */
:root {
  --glass-bg:
    radial-gradient(40% 40% at 50% 52%, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0.55) 55%, rgba(255,255,255,0) 70%),
    radial-gradient(120% 120% at 30% 30%, #ffffff 0%, #eef7ff 40%, #dbeeff 70%, #cfe6ff 100%);
  --glass-border: 2px solid rgba(70,130,180,0.35);
  --glass-shadow:
    inset 0 2px 8px rgba(255,255,255,0.9),
    inset 0 -10px 20px rgba(70,130,180,0.18),
    0 10px 24px rgba(17,63,102,0.22);

  --text-color: #0f2542;
  --vzk-blue: #123a63;
  --vzk-blue-dark: #0f2542;
  --vzk-blue-line: rgba(18, 58, 99, 0.18);
  --vzk-blue-line-strong: rgba(18, 58, 99, 0.28);
  --vzk-green: #19a56f;
  --vzk-green-dark: #0f7f54;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-color);
  background: linear-gradient(to top, #87ceeb 0%, #b0e0e6 50%, #ffffff 100%);
}

/* =====================
   Header
   ===================== */
.site-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 21px 32px 0;
  backdrop-filter: blur(6px);
}

.logo {
  height: 150px;
  flex-shrink: 0;
}

.header-actions {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  padding-left: 230px;
}

.back-link {
  width: 150px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 10px;
  color: #0f2542;
  font-weight: bold;
  font-size: 22px;
  text-decoration: none;

  background: var(--glass-bg);
  border: var(--glass-border);
  box-shadow: var(--glass-shadow);
  text-shadow: 0 1px 0 rgba(255,255,255,0.7), 0 0 6px rgba(15,37,66,0.22);

  animation: float 6s ease-in-out infinite;
  transition: transform .15s ease, color .15s ease;
}

.back-link:hover {
  color: #ff4500;
  transform: translateY(-2px);
}

@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@media (max-width: 780px) {
  .site-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "logo back";
    padding: 12px 16px 0;
  }

  .logo {
    grid-area: logo;
    height: 70px;
  }

  .header-actions {
    grid-area: back;
    padding-left: 0;
    justify-content: end;
  }

  .back-link {
    width: auto;
    height: auto;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 16px;
    animation: none;
  }
}

/* =====================
   Inhalt
   ===================== */
.page-main {
  padding: 28px 20px 40px;
}

.content-box {
  max-width: 1000px;
  margin: 16px auto;
  padding: 28px;
  border-radius: 24px;
  background: var(--glass-bg);
  border: var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.content-box h1,
.content-box h2 {
  margin-top: 0;
  color: var(--vzk-blue-dark);
}

.content-box p {
  line-height: 1.45;
}

/* =====================
   VZK Formular Design
   ===================== */
.form-box-vzk {
  border-radius: 24px;
}

/* Titel */
.form-box-vzk h2 {
  margin: 0 0 .35rem 0;
  font-size: clamp(1.15rem, 1.2rem + .4vw, 1.45rem);
  line-height: 1.15;
}

.form-box-vzk h2::after {
  content: "";
  display: block;
  width: 88px;
  height: 4px;
  margin-top: .45rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--vzk-blue), var(--vzk-green));
}

.form-hinweis {
  margin: .45rem 0 1rem;
  color: rgba(15, 37, 66, 0.85);
}

/* Formular allgemein */
.vzk-form,
.vzk-form * {
  box-sizing: border-box;
}

/* Top Grid */
.vf-topgrid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  align-items: stretch; /* gleiche Höhe */
}

.vf-left {
  display: grid;
  gap: 12px;
}

.vf-right {
  display: flex;
  min-height: 100%;
}

/* Boxen */
.vf-box {
  border: 1.5px solid var(--vzk-blue-line);
  border-radius: 16px;
  padding: 12px;
  margin: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.88));
  box-shadow: 0 10px 24px rgba(9,25,45,.08);
}

.vf-box legend {
  padding: 0 6px;
  font-weight: 800;
  color: var(--vzk-blue-dark);
}

/* Reihen */
.vf-row {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.vf-row:last-child { margin-bottom: 0; }

.vf-row label {
  font-weight: 700;
  color: var(--vzk-blue-dark);
  margin: 0;
}

.vf-row-top {
  align-items: start;
}

.vf-row-top label {
  padding-top: 9px;
}

.vf-row input,
.vf-row textarea {
  width: 100%;
  border: 1.5px solid rgba(15, 37, 66, 0.22);
  border-radius: 10px;
  padding: 9px 11px;
  background: rgba(255,255,255,.94);
  color: #0b1d34;
  font: inherit;
}

.vf-row textarea {
  resize: vertical;
  min-height: 82px;
}

.vf-row input:focus,
.vf-row textarea:focus {
  outline: none;
  border-color: rgba(18, 58, 99, 0.55);
  box-shadow: 0 0 0 3px rgba(18, 58, 99, 0.14);
  background: #fff;
}

/* =====================
   Logo-Bereich (verlängert)
   ===================== */
.vf-logo-box {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.logo-dropzone {
  flex: 1;
  min-height: 300px; /* bewusst länger */
  border: 2px dashed rgba(18, 58, 99, 0.28);
  border-radius: 14px;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(247,250,253,.96));
}

.logo-placeholder {
  color: var(--vzk-blue-dark);
  font-weight: 800;
  text-align: center;
  padding: 1rem;
  opacity: .9;
}

#logoPreview {
  display: block;
  max-width: 100%;
  max-height: 250px;
  object-fit: contain;
}

.file-label {
  display: inline-block;
  font-weight: 700;
  color: var(--vzk-blue-dark);
  margin-bottom: 6px;
}

#logoDatei {
  width: 100%;
  font: inherit;
}

.file-help {
  display: block;
  margin-top: 4px;
  color: rgba(15, 37, 66, 0.7);
  font-size: .9rem;
}

/* =====================
   Tabelle Verfügbarkeit
   ===================== */
.vf-table-wrap {
  margin-top: 14px;
  overflow-x: hidden; /* Desktop: kein unnötiger Scroll */
  border-radius: 18px;
}

.vf-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;       /* wichtig: passt Spalten ins Feld */
  border-collapse: separate;
  border-spacing: 0;
  background: rgba(255,255,255,0.92);
  border: 1.5px solid var(--vzk-blue-line-strong); /* BLAUE Aussenlinie */
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(9,25,45,.08);
}

/* colgroup hilft bei stabilen Breiten */
.vf-table col.col-left { width: 112px; }
.vf-table col.col-day { width: calc((100% - 112px) / 5); }

.vf-table th,
.vf-table td {
  border-right: 1px solid var(--vzk-blue-line);
  border-bottom: 1px solid var(--vzk-blue-line);
  padding: 6px 4px;
  text-align: center;
  vertical-align: middle;
  overflow: hidden;
}

.vf-table tr:last-child th,
.vf-table tr:last-child td { border-bottom: 0; }

.vf-table tr th:last-child,
.vf-table tr td:last-child { border-right: 0; }

.vf-table thead th {
  background: linear-gradient(180deg, rgba(18,58,99,.14), rgba(18,58,99,.06));
  color: var(--vzk-blue-dark);
  font-weight: 900;
  font-size: clamp(0.82rem, 1vw, 0.98rem); /* Wochentage passen */
  line-height: 1.05;
  white-space: nowrap;
  padding: 6px 3px;
}

.vf-table .col-label,
.vf-table .row-label {
  background: linear-gradient(180deg, rgba(18,58,99,.10), rgba(18,58,99,.05));
  color: var(--vzk-blue-dark);
  font-weight: 900;
  text-align: left;
  width: 112px;
  min-width: 112px;
  font-size: 0.92rem;
  padding: 7px 6px;
}

/* =====================
   JA-Kachel (statt normale Checkbox)
   ===================== */
.ja-pill {
  display: inline-block;
  width: 100%;
  cursor: pointer;
  position: relative;
}

.ja-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ja-pill > span {
  width: 100%;
  min-height: 36px;
  border: 1.5px solid rgba(15, 37, 66, 0.22);
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 3px 4px;
  font-weight: 900;
  font-size: 0.86rem;
  letter-spacing: .02em;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(249,251,253,.96));
  color: #16314f;
  transition: .16s ease;
}

.ja-pill .check-icon {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(15, 37, 66, 0.38);
  border-radius: 5px;
  display: inline-grid;
  place-items: center;
  font-size: 0; /* versteckt bis checked */
  line-height: 1;
  background: #fff;
  color: #fff;
  flex: 0 0 18px;
}

.ja-pill:hover > span {
  border-color: rgba(18, 58, 99, 0.45);
  transform: translateY(-1px);
}

/* markiert = grün */
.ja-pill input:checked + span {
  background: linear-gradient(180deg, #1baa77, #159866);
  border-color: var(--vzk-green-dark);
  color: #fff;
}

.ja-pill input:checked + span .check-icon {
  border-color: rgba(255,255,255,.95);
  background: #fff;
  color: var(--vzk-green);
  font-size: 16px;
  font-weight: 900;
}

/* Fokus */
.ja-pill input:focus-visible + span {
  outline: 3px solid rgba(90, 150, 255, 0.6);
  outline-offset: 2px;
}

/* =====================
   Buttons
   ===================== */
.form-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.send-btn,
.print-btn {
  border-radius: 10px;
  padding: .78rem 1rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease;
}

.send-btn:hover,
.print-btn:hover {
  transform: translateY(-1px);
}

.send-btn {
  border: 0;
  color: #fff;
  background: linear-gradient(180deg, #1aaa76, #11885d);
  box-shadow: 0 8px 18px rgba(17,136,93,.22);
}

.print-btn {
  color: var(--vzk-blue-dark);
  border: 1.5px solid rgba(15,37,66,.18);
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(246,248,251,.95));
  box-shadow: 0 6px 16px rgba(12,28,50,.08);
}

/* =====================
   Responsive
   ===================== */
@media (max-width: 900px) {
  .vf-topgrid {
    grid-template-columns: 1fr;
  }

  .vf-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .vf-row-top label {
    padding-top: 0;
  }

  .logo-dropzone {
    min-height: 210px;
  }

  /* Auf kleinen Geräten lieber scroll als kaputt */
  .vf-table-wrap {
    overflow-x: auto;
  }

  .vf-table {
    min-width: 620px;
  }
}

/* =====================
   DRUCK: nur Formular
   ===================== */
@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  body {
    background: #fff !important;
  }

  /* Alles ausblenden */
  body * {
    visibility: hidden !important;
  }

  /* Nur Formular sichtbar */
  .form-box-vzk,
  .form-box-vzk * {
    visibility: visible !important;
  }

  .form-box-vzk {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  /* Nicht drucken */
  .form-hinweis,
  .form-actions,
  .file-label,
  .file-help,
  #logoDatei {
    display: none !important;
  }

  /* Farbige Checkboxen druckbar (wenn Browser es unterstützt) */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .vf-box,
  .vf-table {
    box-shadow: none !important;
    background: #fff !important;
  }

  .logo-dropzone {
    min-height: 230px !important;
    background: #fff !important;
  }

  /* Unmarkierte Felder weiss */
  .ja-pill input:not(:checked) + span {
    background: #fff !important;
    color: #111 !important;
    border-color: #888 !important;
  }

  .ja-pill input:not(:checked) + span .check-icon {
    background: #fff !important;
    border-color: #777 !important;
    color: transparent !important;
    font-size: 0 !important;
  }

  /* Markierte Felder grün */
  .ja-pill input:checked + span {
    background: var(--vzk-green) !important;
    color: #fff !important;
    border-color: var(--vzk-green-dark) !important;
  }

  .ja-pill input:checked + span .check-icon {
    background: #fff !important;
    border-color: #fff !important;
    color: var(--vzk-green) !important;
    font-size: 16px !important;
  }
}