/* Base */
* {
  box-sizing: border-box;
}

:root {
  --wrap: 980px;
  --gutter: 16px;

  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: rgba(15, 23, 42, 0.12);
  --btn: #1f6feb;
  --btnHover: #2b7fff;
  --danger: #b42318;
  --radius: 14px;

  --shadow: 0 10px 30px rgba(2, 6, 23, 0.08);
  --panelGlass: rgba(255, 255, 255, 0.85);
  --snackBg: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] {
  --bg: #0b0c0f;
  --panel: #121521;
  --text: #e9eef7;
  --muted: #b7c0cf;
  --border: rgba(255, 255, 255, 0.12);
  --danger: #ff6b6b;

  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  --panelGlass: rgba(18, 21, 33, 0.75);
  --snackBg: rgba(18, 21, 33, 0.92);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Helvetica,
    Arial,
    "Apple Color Emoji",
    "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: inherit;
}

.skiplink {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skiplink:focus {
  left: 12px;
  top: 12px;
  width: auto;
  height: auto;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  z-index: 10;
}

/* Container */
.container {
  max-width: var(--wrap);
  margin: 18px auto 40px auto;
  padding: 0 var(--gutter);
}

/* Header */
.header {
  border-bottom: 1px solid var(--border);
  background: var(--panelGlass);
  backdrop-filter: blur(10px);
}

.header__inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.header__left,
.header__center,
.header__right {
  display: flex;
  align-items: center;
}

.header__left {
  justify-content: flex-start;
}

.header__center {
  justify-content: center;
}

.header__right {
  justify-content: flex-end;
}

.header__logo {
  width: 120px;
  height: auto;
  display: block;
}

.header__title {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0.2px;
  text-align: center;
  font-weight: 750;
}

/* Theme toggle */
.icon-btn {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition:
    transform 120ms ease,
    background 120ms ease;
}

.icon-btn:hover {
  background: rgba(127, 127, 127, 0.10);
}

.icon-btn:active {
  transform: translateY(1px);
}

.icon-btn__text {
  font-weight: 650;
  font-size: 14px;
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 14px;
  box-shadow: var(--shadow);
}

.panel--center {
  text-align: center;
}

/* Intro */
.intro {
  margin-top: 14px;
  padding: 12px 16px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.intro__text {
  margin: 0 auto;
  max-width: 76ch;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.intro__text p {
  margin: 0;
}

.intro__text p + p {
  margin-top: 6px;
}

/* Verwerkingstips */
.processing-tips {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 14px 0 0 0;
  padding: 16px 18px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.processing-tips[hidden] {
  display: none;
}

.processing-tips__close {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.processing-tips__close:hover {
  color: var(--text);
  background: rgba(127, 127, 127, 0.10);
}

.processing-tips__close:focus-visible {
  outline: 3px solid rgba(31, 111, 235, 0.35);
  outline-offset: 2px;
}

.processing-tips__title {
  margin: 0 0 8px 34px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.3;
  font-weight: 750;
}

.processing-tips p {
  margin: 0;
}

.processing-tips p + p,
.processing-tips__list + .processing-tips__label {
  margin-top: 10px;
}

.processing-tips__label {
  color: var(--text);
  font-weight: 750;
}

.processing-tips__list {
  margin: 6px 0 0 20px;
  padding: 0;
}

.processing-tips__list li + li {
  margin-top: 3px;
}

@media (min-width: 1440px) {
  .processing-tips {
    position: fixed;
    top: 146px;
    left: max(16px, calc((100vw - var(--wrap)) / 2 - 318px));
    width: 286px;
    margin: 0;
    max-height: calc(100vh - 178px);
    overflow: auto;
    z-index: 2;
  }
}

/* Titles and labels */
.label {
  display: block;
  font-weight: 650;
  margin-bottom: 8px;
}

/*
  Koppen boven cards.
  Deze stijl sluit aan op SIGNALEN.
*/
.panel__title,
.signals__title,
.panel--center > .label {
  margin: 0 0 10px 0;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-align: center;
  color: var(--text);
}

/*
  Voorkomt dubbele zichtbare labels wanneer er al een h2.panel__title staat.
  Het label blijft technisch aanwezig voor het formulier.
*/
.panel__title + .label,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.panel--center .help,
.panel--center .error {
  text-align: center;
}

/* Forms */
.input {
  display: block;
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
  outline: none;
}

html[data-theme="dark"] .input {
  background: rgba(0, 0, 0, 0.25);
}

.input:focus {
  border-color: rgba(43, 127, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.15);
}

.input--narrow {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.help {
  margin: 8px 0 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.error {
  color: var(--danger);
  font-size: 14px;
  line-height: 1.4;
}

/*
  Belangrijk voor rustige verticale uitlijning:
  lege foutvelden nemen geen ruimte meer in.
*/
.error:empty {
  display: none;
}

.error:not(:empty) {
  margin: 8px 0 0 0;
}

/* Actions */
.actions {
  display: grid;
  grid-template-columns: 190px 190px 190px;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.actions--center {
  justify-content: center;
}

.process-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 190px;
}

.actions > .btn,
.process-actions .btn {
  width: 190px;
}

.btn {
  appearance: none;
  border: 1px solid rgba(127, 127, 127, 0.25);
  background: var(--btn);
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 650;
  cursor: pointer;
  min-height: 38px;
  white-space: nowrap;
  text-align: center;
  transition:
    transform 120ms ease,
    background 120ms ease,
    opacity 120ms ease;
}

.btn:hover {
  background: var(--btnHover);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.meta:empty {
  display: none;
}

.meta--center {
  text-align: center;
}

/* Paste text panel */
.paste-panel .help,
.paste-actions {
  text-align: center;
}

.paste-textarea,
#pasteText {
  display: block;
  width: 100%;
  min-height: 200px;
  resize: vertical;
  line-height: 1.5;
  text-align: left;
}

.paste-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}


.btn--secondary {
  background: transparent;
  color: var(--text);
}

.btn--secondary:hover {
  background: rgba(127, 127, 127, 0.10);
}

/* URL panel */
.url-panel .help,
.url-actions,
.url-preview__actions {
  text-align: center;
}

.url-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.url-preview {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(127, 127, 127, 0.06);
}

.url-preview__title {
  margin: 0 0 6px 0;
  font-size: 16px;
  line-height: 1.3;
}

.url-preview__help {
  margin: 0 auto 10px auto;
  max-width: 76ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.url-preview__textarea {
  min-height: 300px;
  resize: vertical;
  line-height: 1.5;
  text-align: left;
  white-space: pre-wrap;
}

.url-preview__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}


/* S-preflight warning */
.preflight-warning {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(180, 35, 24, 0.30);
  border-radius: var(--radius);
  background: rgba(180, 35, 24, 0.08);
  text-align: left;
}

.preflight-warning[hidden] {
  display: none;
}

.preflight-warning__title {
  margin: 0 0 8px 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.3;
  font-weight: 750;
  text-align: center;
}

.preflight-warning__text {
  margin: 0 auto 10px auto;
  max-width: 76ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.preflight-warning__list {
  margin: 0 auto;
  max-width: 76ch;
  padding-left: 20px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.preflight-warning__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}


/* Prestatiemeting */
.performance-panel[hidden] {
  display: none;
}

.performance-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

/* Signals */
.signals--center {
  text-align: center;
}

.signals__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: inline-block;
  text-align: left;
  max-width: 80ch;
}

.signals__list li {
  padding: 6px 0;
  border-bottom: 1px dashed rgba(127, 127, 127, 0.28);
}

.signals__list li:last-child {
  border-bottom: none;
}

.signals__tech {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(127, 127, 127, 0.25);
  color: var(--muted);
  display: inline-block;
  max-width: 80ch;
}

/* Snackbar */
.snackbar {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: var(--snackBg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--text);
  box-shadow: var(--shadow);
}

.snackbar--progress {
  background: #f59e0b;
  border-color: rgba(245, 158, 11, 0.55);
  color: #111827;
}

.snackbar--success {
  background: #22c55e;
  border-color: rgba(34, 197, 94, 0.55);
  color: #052e16;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 18px 16px 28px 16px;
  color: var(--muted);
  background: rgba(127, 127, 127, 0.06);
}

html[data-theme="dark"] .footer {
  background: rgba(18, 21, 33, 0.55);
}

.footer--center {
  text-align: center;
}

.footer__inner {
  margin: 0 auto;
  max-width: 95ch;
}

/* Small screens */
@media (max-width: 720px) {
  .actions {
    grid-template-columns: 1fr;
    max-width: 320px;
  }

  .process-actions,
  .actions > .btn,
  .process-actions .btn {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .header__inner {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 12px var(--gutter);
  }

  .header__left,
  .header__right {
    justify-content: center;
  }

  .header__title {
    font-size: 26px;
  }

  .paste-textarea,
  #pasteText {
    min-height: 180px;
  }
}


/* Inklapbare panelen */
.collapsible-panel {
  padding: 0;
  overflow: hidden;
}

.collapsible-panel__summary {
  min-height: 48px;
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.collapsible-panel__summary::-webkit-details-marker {
  display: none;
}

.collapsible-panel__summary:focus-visible {
  outline: 3px solid rgba(31, 111, 235, 0.28);
  outline-offset: -3px;
}

.collapsible-panel__summary:hover {
  background: rgba(127, 127, 127, 0.08);
}

.collapsible-panel__heading {
  font-size: 15px;
  line-height: 1.25;
  font-weight: 750;
  letter-spacing: 0.4px;
  text-align: left;
  color: var(--text);
  text-transform: uppercase;
}

.collapsible-panel__right {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.collapsible-panel__status {
  max-width: 180px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collapsible-panel__status[data-tone="ok"] {
  color: #15803d;
}

html[data-theme="dark"] .collapsible-panel__status[data-tone="ok"] {
  color: #86efac;
}

.collapsible-panel__status[data-tone="warning"] {
  color: #92400e;
}

html[data-theme="dark"] .collapsible-panel__status[data-tone="warning"] {
  color: #fcd34d;
}

.collapsible-panel__status[data-tone="error"] {
  color: var(--danger);
}

.collapsible-panel__chevron {
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 120ms ease;
  flex: 0 0 auto;
}

.collapsible-panel[open] .collapsible-panel__chevron {
  transform: rotate(45deg);
}

.collapsible-panel__content {
  padding: 4px 18px 18px 18px;
  border-top: 1px solid var(--border);
}

.upload-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.action-panel__source {
  margin-bottom: 14px;
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 190px));
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.action-buttons .btn {
  width: 100%;
}

.signals__list:empty::before {
  content: "Geen signalen.";
  display: block;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .action-buttons {
    grid-template-columns: 1fr;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }

  .collapsible-panel__summary {
    align-items: flex-start;
  }

  .collapsible-panel__right {
    max-width: 52%;
  }
}

@media (max-width: 420px) {
  .collapsible-panel__summary {
    padding: 12px 14px;
  }

  .collapsible-panel__heading {
    font-size: 14px;
  }

  .collapsible-panel__status {
    max-width: 130px;
  }
}
