.main-box {
  display: flex;
  justify-content: center;
}

/* max width gør at den tilpasse sig skærmbredden på små skærme op */
.holder {
  max-width: 1039px;
  margin-bottom: 6rem;
}

/* den her gør at holderen ikke bliver mindre end 1039 på en større skærm */
@media (min-width: 1100px) {
  .holder {
    width: 1039px;
  }
}

.introText {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 5rem;
}

.introTextHold {
  max-width: 500px;
  margin-bottom: 3rem;
  margin-top: 1.5rem;
  border: solid 1px #ddd;
  text-align: justify;
  hyphens: auto;
  padding: 1.3rem 1.3rem 1.6rem 1.3rem;
  border-radius: 16px;
  border-left: 1px solid #7224d8;
}

/* hero section */
.heading-centered {
  text-align: center;
  max-width: 38rem;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.3rem;
  margin-top: 0.3rem;
  font-weight: 500;
  font-size: 1.4rem;
  line-height: 1.4;
}

.h1Tekst {
  margin-bottom: 1.3rem;
  font-size: 1.1rem;
  line-height: 1.5;
  font-weight: 350;
  text-align: left;
  max-width: 38ch;
  margin: 0.75rem auto;
}

.udviklet {
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
  text-align: center;
  max-width: 30rem;
  margin: 0.75rem auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* selve pointtælleren */

/* ==============================
   CONTROLS
   ============================== */

.top-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

button {
  padding: 0.5rem 1rem;
  width: 220px;
  cursor: pointer;
}

input[type="text"] {
  padding: 0.5rem;
  width: 220px;
}

/* ==============================
   STICKY BAR
   ============================== */

.sticky-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #222;
  color: #fff;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

/* ==============================
   TABLE (DESKTOP)
   ============================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

th,
td {
  border: 1px solid #ccc;
  padding: 0.5rem;
  vertical-align: top;
}

th {
  background: #eee;
}

.point-cell {
  font-weight: bold;
  text-align: center;
  background: transparent;
  border: none;
}

/* Dropdowns skal ikke ligne inputs */
select {
  border: none;
  background: transparent;
  font: inherit;
  width: 100%;
}

/* ==============================
   DISKRET ANTAL DELSVAR
   ============================== */

.parts-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1;
}

.parts-value {
  line-height: 1;
}

.parts-input {
  display: none;
  width: 3rem;
  border: none;
  background: transparent;
  font: inherit;
  text-align: right;
}

.parts-input.is-editing {
  display: inline-block;
}

.parts-edit-btn {
  line-height: 1;
  padding: 0; /* remove extra box height */
  margin: 0;
  font-size: 1.2rem;
}

.parts-edit-btn:hover {
  opacity: 0.6;
  cursor: pointer;
}

/* ==============================
   ACTIONS / RESULT
   ============================== */

.actions {
  margin-bottom: 1rem;
}

#gradeResult {
  padding: 1rem;
  border: 1px solid #ccc;
  background: #fff;
}

.disclaimer {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #555;
}

/* ==============================
   KARAKTER-OVERSIGT
   ============================== */

.grade-overview {
  margin-top: 1.5rem; /* afstand til karakterboksen */
  padding: 1rem;
  border: 1px solid #ccc;
  background: #fff;
  display: flex;
  gap: 1rem;
}

/* Hver kolonne */
.grade-overview-item {
  flex: 1;
  border: 1px solid #ddd;
  padding: 0.75rem;
  text-align: center;
  font-size: 0.95rem;
}

/* Overskrifter */
.grade-overview-item strong {
  display: block;
  margin-bottom: 0.25rem;
}

/* Mobil: kolonner → rækker */
@media (max-width: 900px) {
  .grade-overview {
    flex-direction: column;
  }
}

/* ==============================
   RESPONSIVE: TABLE → CARDS
   ============================== */

@media (max-width: 900px) {
  table,
  thead,
  tbody,
  th,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 1rem;
    padding: 0.75rem;
  }

  td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border: none;
    padding: 0.4rem 0;
  }

  td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #555;
    flex: 0 0 45%;
  }

  td > * {
    text-align: right;
  }

  .sticky-bar {
    flex-direction: column;
    gap: 0.25rem;
  }

  .point-cell {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
    padding-right: 1.5rem;
  }

  td[data-label="Opgavetype"],
  td[data-label="Testområde"] {
    display: none;
  }
  td[data-label="Opgave nr."] {
    background: #f1f1f1;
    padding: 0.75rem;
    margin: -0.75rem -0.75rem 0.75rem -0.75rem;
    border-radius: 6px 6px 0 0;
    font-weight: 600;
    font-size: 1.1rem;
  }

  td[data-label="Opgave nr."]::before {
    content: "Opgave";
    font-weight: 600;
  }

  td select {
    width: auto;
    min-width: 4rem;
    max-width: 100%;
  }

  td[data-label="Antal korrekte delsvar"] {
    align-items: center;
  }
}

/* div med links til mere materiale */
.merMatHold {
  border-top: solid #ddd 1px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 3rem;
}

.merMatrTxt {
  text-align: center;
  font-size: 1.3rem;
  margin-top: 2rem;
}

.linkBut {
  display: block;
  text-decoration: none;
  border: solid 1px #7224d8;
  padding: 1rem;
  border-radius: 8px;
  color: #7224d8;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.linkBut:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.merMatrTxt2 {
  border-top: solid #ddd 1px;
  width: 100%;
  text-align: center;
  font-size: 1.3rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
}

.contxtHol {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.holAprBil {
  display: block;
  border-bottom: solid 3px #7224d8;
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  overflow: hidden;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  cursor: pointer;
}

.holAprBil:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.AprBil {
  width: 100%;
  height: auto;
}

.textoAprBil {
  width: 8rem;
  text-align: center;
}

.hidden {
  display: none;
}

/* ==============================
   PRINT / SAVE AS PDF
   (PLACE AT VERY BOTTOM)
   ============================== */

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  /* Reset centering containers */
  .main-box,
  .holder {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Give a small safe gutter INSIDE the printable area */
  html,
  body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 6mm !important; /* <- IMPORTANT: do NOT override later */
    font-size: 11pt !important;
    box-sizing: border-box !important;
  }

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

  /* Hide non-essential elements */
  .headerMatr,
  .footer,
  .introText,
  .top-controls,
  .actions,
  button,
  #pdfBtn,
  .parts-edit-btn,
  .merMatHold {
    display: none !important;
  }

  /* Sticky bar -> normal header box */
  .sticky-bar {
    position: static !important;
    display: block !important;
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000 !important;
    margin: 0 0 8mm 0 !important;
    padding: 5mm !important;
  }

  /* Force REAL table layout (no mobile cards) */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    display: table !important;
    margin: 0 auto !important;
  }

  thead {
    display: table-header-group !important;
  }
  tbody {
    display: table-row-group !important;
  }
  tr {
    display: table-row !important;
    page-break-inside: avoid !important;
  }

  th,
  td {
    display: table-cell !important;
    border: 1px solid #000 !important;
    padding: 3mm 2.5mm !important;
    vertical-align: top !important;
  }

  th {
    background: #eee !important;
    color: #000 !important;
    text-align: left !important;
  }

  /* Turn off mobile card labels */
  td::before {
    content: none !important;
    display: none !important;
  }

  /* Hide specific columns:
     2: Opgavetype
     5: Antal delsvar
     6: Antal korrekte delsvar */
  th:nth-child(2),
  td:nth-child(2),
  th:nth-child(5),
  td:nth-child(5),
  th:nth-child(6),
  td:nth-child(6) {
    display: none !important;
  }

  /* Selects print cleanly */
  select {
    appearance: none !important;
    -webkit-appearance: none !important;
    border: 0 !important;
    background: transparent !important;
    padding: 0 !important;
  }

  /* Grade boxes */
  #gradeResult,
  #gradeOverview {
    border: 1px solid #000 !important;
    background: #fff !important;
    page-break-inside: avoid !important;
  }
}

.pdf {
  margin-bottom: 2rem;
}

/* ==============================
   CONTEXTO CONFIRM MODAL
   ============================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-box {
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.modal-box h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
  font-weight: 500;
}

.modal-box p {
  margin-bottom: 1.25rem;
  line-height: 1.4;
}

.modal-box small {
  color: #666;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Buttons */
.btn-primary {
  background: #7224d8; /* Contexto purple */
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}

.btn-secondary {
  background: transparent;
  border: 1px solid #ccc;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}

.hidden {
  display: none !important;
}
