/* DJK Ingolstadt – Online-Mitgliedsantrag
   All rules are scoped to .membership-registration (form) and .mr-print-root (print sheets)
   so the component can live inside a TYPO3 page without leaking styles. */

/* ---------- Form (screen) ---------- */
.membership-registration {
  --blue: #006b99;
  --light: #e9f4f8;
  --ink: #1f2933;
  --line: #c3d3dd;

  font-family: Arial, Helvetica, sans-serif;
  background: #f1f5f8;
  color: var(--ink);
  line-height: 1.4;

  @media only screen and (min-width: 767px) {
    margin-left: 270px;
    margin-top: 30px;
  }

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

  & [hidden] {
    display: none !important;
  }

  & .mr-header {
    background: var(--blue);
    color: #fff;
    padding: 20px 18px;

    & h2 {
      margin: 0;
      font-size: 26px;
      color: inherit;
    }

    & p {
      margin: 5px 0 0;
    }
  }

  & .mr-brand-head {
    display: flex;
    align-items: center;
    gap: 20px;

    & img {
      width: 102px;
      max-width: 100%;
      height: auto;
      background: #fff;
      padding: 5px;
      border-radius: 6px;
      flex-shrink: 0;
    }
  }

  & .mr-main {
    max-width: 1050px;
    margin: 20px auto;
    padding: 0 16px 35px;
  }

  & .mr-notice {
    background: #fff;
    border-left: 4px solid var(--blue);
    padding: 14px 17px;
    margin-bottom: 18px;
  }

  & form {
    margin: 0;
    border: 0;
    background: #fff;
    border-radius: 10px;
    padding: 22px;
    box-shadow: 0 4px 24px #163b5312;
  }

  & fieldset {
    background: none;
    min-width: 0;
    border: 1px solid #d7e1e8;
    border-radius: 8px;
    margin: 0 0 20px;
    padding: 16px;
  }

  & legend {
    font-weight: 700;
    color: #005679;
    padding: 0 8px;
    font-size: 17px;
  }

  & .mr-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  & .mr-wide {
    grid-column: span 2;
  }

  & .mr-full {
    grid-column: 1 / -1;
  }

  & label.mr-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    font-weight: 700;
  }

  & input:not([type=checkbox]):not([type=radio]),
  & select {
    border: 1px solid #a9bbc7;
    border-radius: 5px;
    padding: 10px 11px;
    font: inherit;
    min-height: 42px;
    background: #fff;
    width: 100%;
  }

  & input:focus,
  & select:focus {
    outline: 2px solid #75c7e8;
    outline-offset: 1px;
  }

  & input:user-invalid,
  & select:user-invalid {
    border-color: #ba2828;
  }

  & .mr-frueher {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    align-content: center;
    align-items: center;
  }

  & .mr-choice {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin: 7px 16px 4px 0;
    font-size: 14px;
  }

  & input[type=checkbox],
  & input[type=radio] {
    width: 17px;
    height: 17px;
    accent-color: var(--blue);
  }

  & .mr-depts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 20px;
  }

  & .mr-dept {
    border: 1px solid #dce6eb;
    border-radius: 6px;
    padding: 9px;

    & strong {
      display: block;
      margin-bottom: 4px;
    }

    & label {
      display: flex;
      align-items: center;
      gap: 7px;
      font-size: 13px;
      margin: 4px 0;
    }

    & small {
      color: #52616f;
    }
  }

  & .mr-hint {
    font-size: 12px;
    color: #4e606d;
    margin: 8px 0 0;
  }

  & .mr-checks {
    display: flex;
    flex-direction: column;
    gap: 11px;

    & label {
      display: flex;
      gap: 9px;
      align-items: flex-start;
    }

    & input {
      flex: none;
      margin-top: 3px;
    }
  }

  & .mr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 15px;
  }

  & button {
    background: var(--blue);
    color: #fff;
    border: 0;
    border-radius: 7px;
    font-weight: 700;
    padding: 13px 17px;
    cursor: pointer;
    font-size: 14px;

    &.mr-secondary {
      background: #e0edf4;
      color: #084967;
    }

    &:hover {
      filter: brightness(.95);
    }
  }

  & .mr-status {
    font-size: 13px;
    color: #42556a;
  }

  & .mr-config-error {
    background: #fdecec;
    border-left: 4px solid #ba2828;
    color: #7a1414;
    padding: 14px 17px;
    margin-bottom: 18px;
  }

  @media (max-width: 700px) {
    & .mr-fields,
    & .mr-depts {
      grid-template-columns: 1fr;
    }

    & .mr-wide {
      grid-column: span 1;
    }

    & form {
      padding: 12px;
    }

    & .mr-header h2 {
      font-size: 21px;
    }

    & .mr-brand-head {
      flex-direction: column;
      align-items: flex-start;
    }
  }
}

/* ---------- Print sheets (2 × A4) ---------- */
.mr-print-root {
  position: absolute;
  left: -99999px;
  top: 0;
  width: 210mm;
  background: #fff;

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

  & .mr-sheet {
    width: 210mm;
    height: 297mm;
    padding: 12mm 13mm;
    position: relative;
    background: #fff;
    overflow: hidden;
    font: 9.5pt Arial, Helvetica, sans-serif;
    color: #182630;
    page-break-after: always;

    &:last-child {
      page-break-after: auto;
    }

    & h2 {
      font-size: 16pt;
      margin: 0;
      color: #006b99;
    }

    & p {
      margin: 5px 0;
      font-size: 8.2pt;
      line-height: 1.37;
    }
  }

  & .mr-subtitle {
    font-size: 8pt;
    color: #5b6b77;
  }

  & .mr-titleline {
    border-bottom: 2px solid #007eac;
    padding: 0 0 8px;
    margin: 0 0 11px;
    display: flex;
    align-items: center;
  }

  & .mr-pdf-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
  }

  & .mr-pdf-logo {
    width: 24mm;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
  }

  & .mr-pdf-brandinfo {
    min-width: 0;
    flex: 1;
  }

  & .mr-blocktitle {
    font-weight: bold;
    background: #e6f2f7;
    border-left: 3px solid #007ba8;
    padding: 5px 8px;
    margin: 10px 0 6px;
    font-size: 10pt;
  }

  & .mr-pdfgrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
    row-gap: 7px;
  }

  & .mr-pdfitem {
    min-height: 28px;
    border-bottom: 1px solid #a7b9c2;
    padding: 2px 0 4px;
    overflow-wrap: anywhere;

    & small {
      display: block;
      color: #586975;
      font-size: 7pt;
    }

    & b {
      font-size: 10pt;
      font-weight: 600;
    }

    &.mr-full {
      grid-column: 1 / -1;
    }
  }

  & .mr-signature {
    display: flex;
    gap: 14px;
    margin-top: 7px;

    & .mr-signline {
      margin-top: 20mm;
    }

    &.mr-spaced {
      margin-top: 18px;
    }
  }

  & .mr-signline {
    width: 50%;
    border-top: 1px solid #4e555c;
    padding-top: 3px;
    font-size: 7pt;
  }

  & .mr-sheet .mr-legal {
    font-size: 8pt;
    line-height: 1.35;
  }

  & .mr-sheet .mr-tiny {
    font-size: 7pt;
  }

  & .mr-twocol {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;

    &.mr-page2-cols {
      grid-template-columns: .95fr 1.05fr;
      gap: 16px;
    }

    &.mr-tight {
      gap: 8px;
    }
  }

  & .mr-pricerow {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dotted #ccd8dd;
    font-size: 8.7pt;
    padding: 3px 0;

    &.mr-small {
      font-size: 7.5pt;
    }
  }

  & .mr-selectrow {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    border-bottom: 1px solid #edf1f2;
    padding: 3px 0;
    font-size: 8.5pt;
  }

  & .mr-boxmark {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1px solid #566977;
    text-align: center;
    line-height: 10px;
    margin-right: 6px;
  }

  & .mr-footer {
    position: absolute;
    bottom: 9mm;
    left: 13mm;
    right: 13mm;
    border-top: 1px solid #c6d6df;
    padding-top: 4px;
    font-size: 7pt;
    color: #64717c;
    display: flex;
    justify-content: space-between;
  }
}

/* ---------- Printing ----------
   This stylesheet is only loaded on the membership page, so printing that page always
   prints just the two A4 sheets (like the original standalone form) and hides the rest
   of the TYPO3 page. */
@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  body > :not(.mr-print-root) {
    display: none !important;
  }

  .mr-print-root {
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: 210mm !important;

    & .mr-sheet {
      break-after: page;
      page-break-after: always;

      &:last-child {
        break-after: auto;
        page-break-after: auto;
      }
    }

    & * {
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
  }
}
