/*
 * Site-wide fixes for the static site (loaded after custom.css).
 *
 * 1) Header/logo fixes for the static site (loaded after custom.css).
 * - The binso template pulls the logo up by 51px (meant for a top bar that
 *   this site doesn't have), so the logo was cut off at the top.
 * - Normal and sticky header used different container widths, paddings and
 *   a slide-in animation, so the logo jumped and the menu wrapped to two lines.
 * The header now has the same layout and height in both states; only the
 * background changes when it becomes sticky.
 */
:root { --gd-header-h: 80px; }

#sp-header,
#sp-header.header-sticky {
  height: var(--gd-header-h);
  padding: 0;
  animation: none;
  -webkit-animation: none;
  transition: background-color .3s ease, box-shadow .3s ease;
}
#sp-header.header-sticky {
  background-color: #111;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .45);
}

/* Same full-width container in both states, logo flush to the left corner */
#sp-header > .container,
#sp-header:not(.header-sticky) > .container {
  max-width: 100%;
  padding: 0 24px 0 0;
}
#sp-header .container-inner,
#sp-header .container-inner > .row { height: 100%; }
#sp-header .container-inner > .row { flex-wrap: nowrap; align-items: center; }

#sp-header #sp-logo { flex: 0 0 auto; width: auto; height: 100%; }
#sp-header #sp-logo > .sp-column { height: 100%; }
#sp-header #sp-menu { flex: 1 1 auto; width: auto; }
#sp-header #sp-menu .sp-megamenu-wrapper { margin-left: auto; }

/* Logo: fills the header height, arc on the right like the original design */
#sp-header .logo,
#sp-header:not(.header-sticky) .logo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--gd-header-h);
  min-width: 0;
  margin: 0;
  padding: 0 34px 0 24px;
}
#sp-header .logo::before,
#sp-header:not(.header-sticky) .logo::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  content: "";
  border-right: 3px solid var(--sppb-maincolor, #4c9845);
  border-top-right-radius: 60px;
  border-bottom-right-radius: 60px;
  pointer-events: none;
}
#sp-header .logo a { display: flex; align-items: center; height: 100%; }
#sp-header .logo img.logo-image,
#sp-header.header-sticky .logo img.logo-image,
#sp-header:not(.header-sticky) .logo img.logo-image {
  /* image is 178x52 with transparent sides; show only the 52px emblem, sharp */
  height: 52px;
  width: 52px;
  max-height: none;
  object-fit: cover;
  object-position: center;
  filter: none;
  transition: none;
}

/* Menu: one line, vertically centred, same in both states */
#sp-header .sp-megamenu-parent > li > a,
#sp-header .sp-megamenu-parent > li > span,
#sp-header.header-sticky .sp-megamenu-parent > li > a,
#sp-header.header-sticky .sp-megamenu-parent > li:last-child > a {
  padding: 28px 0;
  color: #fff;
}
#sp-header .sp-megamenu-parent > li.active > a { color: #fff; }

@media (max-width: 991.98px) {
  :root { --gd-header-h: 64px; }
  #sp-header > .container,
  #sp-header:not(.header-sticky) > .container { padding-right: 16px; }
  #sp-header .logo,
  #sp-header:not(.header-sticky) .logo { padding: 0 24px 0 16px; }
  #sp-header .logo img.logo-image,
  #sp-header.header-sticky .logo img.logo-image,
  #sp-header:not(.header-sticky) .logo img.logo-image { height: 44px; width: 44px; }
  #sp-header .logo::before,
  #sp-header:not(.header-sticky) .logo::before {
    border-top-right-radius: 44px;
    border-bottom-right-radius: 44px;
  }
  #sp-header #sp-menu { display: flex; justify-content: flex-end; }
  /* burger icon was dark-on-dark in the sticky header */
  #sp-header .burger-icon > span,
  #sp-header.header-sticky .burger-icon > span { background-color: #fff; }
}

/*
 * 2) Form checkboxes (contact form, Personalbogen): SP Page Builder draws the
 *    box with label::before in a fixed blue (#0345bf); use the site green.
 */
.form-builder-checkbox-item label::before,
.form-builder-radio-item label::before,
.sppb-addon-form-builder .sppb-form-check-label::before {
  border-color: var(--sppb-maincolor, #4c9845);
}
.form-builder-checkbox-item input:checked + label::before,
.form-builder-radio-item input:checked + label::before,
.sppb-addon-form-builder .sppb-form-check-input:checked + label::before {
  background: var(--sppb-maincolor, #4c9845);
}
.form-builder-checkbox-item input:focus-visible + label::before,
.sppb-addon-form-builder .sppb-form-check-input:focus-visible + label::before {
  outline: 2px solid var(--sppb-maincolor, #4c9845);
  outline-offset: 2px;
}

/*
 * 3) Dropdown menus: the menu is right-aligned (see 1), so dropdowns are
 *    anchored to the right edge of their item and sub-menus open to the LEFT.
 *    Otherwise "Taktischer Bereich"/"Ausbildungsbereich" opened off-screen.
 */
@media (min-width: 992px) {
  body.ltr #sp-header .sp-megamenu-parent .sp-dropdown.sp-dropdown-main,
  body.ltr #sp-header .sp-megamenu-parent .sp-dropdown.sp-dropdown-main.sp-menu-right {
    left: auto;
    right: 0;
  }
  body.ltr #sp-header .sp-megamenu-parent .sp-dropdown.sp-dropdown-sub {
    left: auto;
    right: 100%;
  }
  /* arrow of items with a sub-menu points left, matching the open direction */
  body.ltr #sp-header .sp-dropdown .sp-has-child > a::after {
    display: inline-block;
    transform: rotate(180deg);
  }
}

/* 4) Utilities, homepage slider on mobile ------------------------------- */
.gd-sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
/* The slider image contains the "WILLKOMMEN ..." lettering; on phones the fixed
   550px height cropped it. Use the image's own aspect ratio (1920x1100). */
@media (max-width: 767.98px) {
  .sppb-addon-sp-slider.sp-slider,
  .sppb-addon-sp-slider .sp-slider-outer-stage,
  .sppb-addon-sp-slider .sp-item { height: 57.3vw !important; min-height: 0 !important; }
}

/* 5) Tables (Panzerliste, Rangsystem) in the dark site design ------------ */
.sppb-addon-table-main { border-collapse: separate; border-spacing: 0; border-radius: 6px; overflow: hidden; }
.sppb-addon-table-main th { padding: 12px 16px; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
.sppb-addon-table-main th p { margin: 0; }
.sppb-addon-table-main tbody tr { background: #1a1a1a; }
.sppb-addon-table-main tbody tr:nth-child(even) { background: #212121; }
.sppb-addon-table-main tbody tr:hover { background: #2a2a2a; }
.sppb-addon-table-main td {
  padding: 10px 16px; font-size: 15px; color: #d6d6d6;
  border-bottom: 1px solid #2c2c2c; vertical-align: middle;
}
.sppb-addon-table-main td p,
.sppb-addon-table-main td h6 { margin: 0; color: inherit; }
.sppb-addon-table-main td h6 { font-size: 16px; }
.sppb-addon-table-main td strong { color: #fff; }
.sppb-addon-table-main td img { image-rendering: auto; }
/* Panzerliste: compact real table on phones instead of one card per row */
@media (max-width: 575.98px) {
  .sppb-addon-table-main[data-responsive="false"] th,
  .sppb-addon-table-main[data-responsive="false"] td { padding: 8px 6px; font-size: 13px; }
  .sppb-addon-table-main[data-responsive="false"] th { font-size: 11px; letter-spacing: 0; }
}
/* filter bar (gd-tables.js) */
.gd-table-filter {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 0 0 28px; padding: 14px; border-radius: 6px; background: #1a1a1a; border: 1px solid #2c2c2c;
}
.gd-table-filter label { margin: 0; }
.gd-table-filter .gd-tf-search { flex: 1 1 220px; }
.gd-table-filter input[type="search"],
.gd-table-filter select {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 4px; box-shadow: none !important;
  border: 1px solid #3a3a3a !important; background: #111 !important; color: #fff !important; font-size: 15px;
}
.gd-table-filter input[type="search"]::placeholder { color: #8a8a8a; }
.gd-table-filter select { width: auto; min-width: 150px; cursor: pointer; }
.gd-table-filter input[type="search"]:focus,
.gd-table-filter select:focus { outline: none; border-color: var(--sppb-maincolor, #4c9845) !important; }
.gd-table-filter .gd-tf-count { margin-left: auto; color: #9a9a9a; font-size: 14px; white-space: nowrap; }
@media (max-width: 575.98px) {
  .gd-table-filter select { flex: 1 1 45%; min-width: 0; }
  .gd-table-filter .gd-tf-count { width: 100%; margin: 0; }
}

/* 6) Generalstab: centred card grid, name and rank below the shoulder board */
.sppb-dynamic-content-collection {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
}
.sppb-dynamic-content-collection > .sppb-dynamic-content-collection__item {
  width: auto !important; max-width: none !important; margin: 0 !important;
  padding: 22px 16px 18px; border-radius: 8px;
  background: #181818; border: 1px solid #262626; text-align: center;
  transition: border-color .2s ease, transform .2s ease;
}
.sppb-dynamic-content-collection > .sppb-dynamic-content-collection__item:hover {
  border-color: var(--sppb-maincolor, #4c9845); transform: translateY(-2px);
}
.sppb-dynamic-content-collection .image-box::before { display: none !important; }
.sppb-dynamic-content-collection .sppb-dynamic-content-image-wrapper {
  width: 100% !important; height: 180px !important; border-radius: 0 !important;
}
.sppb-dynamic-content-collection .sppb-dynamic-content-image { object-fit: contain !important; }
.sppb-dynamic-content-collection .info-box {
  position: static !important; width: auto !important; padding: 16px 0 0 !important;
}
.sppb-dynamic-content-collection .sppb-dynamic-content-text {
  display: block !important; text-align: center; justify-content: center !important;
}
.sppb-dynamic-content-collection h6.sppb-dynamic-content-text { font-size: 16px; margin-bottom: 4px !important; }
.sppb-dynamic-content-collection div.sppb-dynamic-content-text { font-size: 13px; line-height: 1.45; color: #bdbdbd !important; }

/* 7) Footer: consistent columns, bottom bar, always at the bottom ---------- */
#sp-main { display: flex; flex-direction: column; min-height: 100vh; }
#sp-main > #sp-main-body { flex: 1 0 auto; }
#sp-footer .sppb-link-list-wrap { text-align: left; }
#sp-footer .sppb-link-list-wrap nav::before {
  content: "Seiten"; display: block; margin-bottom: 15px;
  font: 600 18px/1.2 Poppins, sans-serif; color: #fff;
}
#sp-footer .sppb-link-list-wrap ul { display: flex; flex-direction: column; gap: 6px; padding: 0; margin: 0; }
#sp-footer .sppb-link-list-wrap ul li { display: block; margin: 0; padding: 0; }
#sp-footer .sppb-link-list-wrap ul li a { display: inline-block; margin: 0; padding: 0; font-size: 15px; font-weight: 600; }
#sp-footer .sppb-link-list-wrap ul li a:hover { color: var(--sppb-maincolor, #4c9845); }
.gd-footer-bottom {
  padding: 14px 16px; text-align: center; font-size: 13px; color: #a8a8a8;
  background: rgba(0, 0, 0, .6); border-top: 1px solid rgba(255, 255, 255, .1);
}
.gd-footer-bottom a { color: #d0d0d0; }
.gd-footer-bottom a:hover { color: var(--sppb-maincolor, #4c9845); }

/* 8) Personalbogen: form centred, fields as wide as the consent text ---- */
form[data-gd-endpoint="/api/personalbogen"] { max-width: 720px; margin: 0 auto; }
form[data-gd-endpoint="/api/personalbogen"] .sppb-form-group { flex: 0 0 100% !important; width: 100% !important; max-width: none !important; }
form[data-gd-endpoint="/api/personalbogen"] .sppb-form-control:not([type="checkbox"]) { width: 100%; }
form[data-gd-endpoint] textarea.sppb-form-control { min-height: 120px; resize: vertical; }

/* 9) Kontakt (homepage): decorative stripes overlapped the heading -------- */
img[src$="icons/icon-box2.png"] { display: none; }
form[data-gd-endpoint="/api/personalbogen"] label,
form[data-gd-endpoint="/api/personalbogen"] .form-builder-checkbox-label,
form[data-gd-endpoint="/api/personalbogen"] .sppb-form-check-label { color: #cfcfcf; }
