/*
 * Beheerpagina. Losstaand van het thema: de site is zwart en sober, het
 * beheer mag juist licht en duidelijk zijn.
 */

:root {
  --mg-bg: #f6f6f5;
  --mg-panel: #ffffff;
  --mg-line: #e2e2df;
  --mg-text: #1b1b1a;
  --mg-soft: #6b6b67;
  --mg-accent: #8b0000;
  --mg-ok: #1f6f3d;
  --mg-radius: 8px;
}

* {
  box-sizing: border-box;
}

.mg-body {
  margin: 0;
  background: var(--mg-bg);
  color: var(--mg-text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0 0 10px;
  line-height: 1.25;
}

h2 {
  font-size: 17px;
}

h3 {
  font-size: 15px;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--mg-accent);
  outline-offset: 2px;
}

.mg-vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --------------------------------------------------- Inloggen */
.mg-login {
  max-width: 380px;
  margin: 14vh auto 0;
  padding: 0 20px;
  text-align: center;
}

.mg-logo {
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mg-sub {
  color: var(--mg-soft);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mg-card {
  margin-top: 26px;
  padding: 24px;
  background: var(--mg-panel);
  border: 1px solid var(--mg-line);
  border-radius: var(--mg-radius);
  text-align: left;
}

.mg-card label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--mg-soft);
}

.mg-back {
  margin-top: 22px;
  font-size: 13px;
  color: var(--mg-soft);
}

/* --------------------------------------------------- Velden */
input[type="text"],
input[type="password"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--mg-line);
  border-radius: 6px;
}

textarea {
  resize: vertical;
  line-height: 1.7;
}

button {
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--mg-line);
  background: #fff;
  padding: 10px 16px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

button:hover {
  border-color: #c9c9c4;
  background: #fafaf9;
}

.mg-primary {
  background: var(--mg-text);
  border-color: var(--mg-text);
  color: #fff;
}

.mg-primary:hover {
  background: #000;
  border-color: #000;
}

.mg-primary[disabled] {
  opacity: 0.4;
  cursor: default;
}

.mg-danger {
  border-color: #d9b3b3;
  color: var(--mg-accent);
}

.mg-danger:hover {
  background: #fdf4f4;
  border-color: var(--mg-accent);
}

.mg-ghost {
  background: #fff;
}

.mg-link {
  border: 0;
  background: none;
  padding: 6px 0;
  text-decoration: underline;
}

.mg-card button {
  width: 100%;
  margin-top: 16px;
}

/* --------------------------------------------------- Meldingen */
.mg-notice {
  margin: 0 0 14px;
  padding: 11px 14px;
  border-radius: 6px;
  border: 1px solid var(--mg-line);
  background: #fff;
  font-size: 14px;
}

.mg-ok {
  border-color: #bcd9c6;
  background: #f2f9f4;
  color: var(--mg-ok);
}

.mg-fout {
  border-color: #e3c2c2;
  background: #fdf5f5;
  color: var(--mg-accent);
}

/* --------------------------------------------------- Kop */
.mg-top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--mg-panel);
  border-bottom: 1px solid var(--mg-line);
}

.mg-top strong {
  display: block;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 14px;
}

.mg-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  font-size: 14px;
}

.mg-tabs a {
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  color: var(--mg-soft);
}

.mg-tabs a:hover {
  color: var(--mg-text);
}

.mg-tabs a.is-on {
  color: var(--mg-text);
  border-bottom-color: var(--mg-accent);
}

.mg-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

/* --------------------------------------------------- Indeling */
.mg-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.mg-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 26px;
  align-items: start;
}

.mg-side,
.mg-content {
  background: var(--mg-panel);
  border: 1px solid var(--mg-line);
  border-radius: var(--mg-radius);
  padding: 18px;
}

.mg-cats {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.mg-cats a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  text-decoration: none;
}

.mg-cats a:hover {
  background: #f4f4f2;
}

.mg-cats a.is-on {
  background: var(--mg-text);
  color: #fff;
}

.mg-cats em {
  font-style: normal;
  color: var(--mg-soft);
  font-size: 13px;
}

.mg-cats a.is-on em {
  color: rgba(255, 255, 255, 0.7);
}

.mg-newcat {
  border-top: 1px solid var(--mg-line);
  padding-top: 16px;
}

.mg-newcat label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--mg-soft);
}

.mg-newcat button {
  width: 100%;
  margin-top: 8px;
}

.mg-headrow {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.mg-rename {
  display: flex;
  gap: 8px;
  flex: 1 1 300px;
}

.mg-headrow .mg-ghost {
  text-decoration: none;
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--mg-line);
  border-radius: 6px;
  font-size: 14px;
}

/* Knoppen in de kopregel niet over twee regels laten breken. */
.mg-headrow button,
.mg-headrow .mg-ghost {
  white-space: nowrap;
}

.mg-delcat {
  margin-left: auto;
}

/* --------------------------------------------------- Uploaden */
.mg-upload {
  margin-bottom: 22px;
}

.mg-drop {
  display: block;
  padding: 26px;
  text-align: center;
  border: 2px dashed #cfcfca;
  border-radius: var(--mg-radius);
  background: #fbfbfa;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.mg-drop:hover,
.mg-drop.is-over {
  border-color: var(--mg-accent);
  background: #fdf7f7;
}

.mg-drop strong {
  display: block;
  margin-bottom: 4px;
}

.mg-drop span {
  color: var(--mg-soft);
  font-size: 13px;
}

.mg-drop input[type="file"] {
  display: none;
}

.mg-chosen {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--mg-soft);
}

.mg-upload button {
  margin-top: 12px;
}

/* --------------------------------------------------- Raster */
.mg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--mg-line);
}

.mg-hint {
  margin: 0;
  color: var(--mg-soft);
  font-size: 13px;
}

.mg-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.mg-item {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #eee;
  cursor: grab;
  transition: border-color 0.15s ease, opacity 0.15s ease;
}

.mg-item:active {
  cursor: grabbing;
}

.mg-item.is-selected {
  border-color: var(--mg-accent);
}

.mg-item.is-dragging {
  opacity: 0.35;
}

.mg-item.is-target {
  border-color: var(--mg-text);
}

.mg-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.mg-num {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  min-width: 22px;
  padding: 2px 6px;
  text-align: center;
  font-size: 12px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
}

.mg-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  z-index: 2;
  padding: 2px 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 20px;
  background: var(--mg-accent);
  color: #fff;
}

/* --------------------------------------------------- Losse foto */
.mg-actions {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--mg-line);
}

.mg-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.mg-selected select {
  width: auto;
  min-width: 150px;
}

.mg-empty {
  padding: 30px;
  text-align: center;
  color: var(--mg-soft);
  border: 1px dashed var(--mg-line);
  border-radius: var(--mg-radius);
}

/* --------------------------------------------------- Titels */
.mg-titles {
  margin-top: 26px;
}

.mg-sticky {
  position: sticky;
  top: 0;
  z-index: 3;
  margin-top: 0;
  padding-bottom: 12px;
  background: var(--mg-panel);
}

.mg-sticky h3 {
  margin: 0;
}

.mg-titlehint {
  max-width: 640px;
  margin-bottom: 16px;
}

.mg-titlelist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 10px 20px;
}

.mg-titlelist li {
  display: grid;
  grid-template-columns: 24px 56px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.mg-titlenum {
  font-size: 12px;
  color: var(--mg-soft);
  text-align: right;
}

.mg-titlethumb {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  background: #eee;
}

/* --------------------------------------------------- Teksten */
.mg-textform {
  background: var(--mg-panel);
  border: 1px solid var(--mg-line);
  border-radius: var(--mg-radius);
  padding: 22px;
  max-width: 760px;
}

.mg-textform.mg-narrow {
  max-width: 440px;
}

.mg-textform h2 {
  margin-top: 22px;
}

.mg-textform h2:first-of-type {
  margin-top: 0;
}

.mg-textform label {
  display: block;
  margin: 14px 0 6px;
  font-size: 13px;
  color: var(--mg-soft);
}

.mg-textform button {
  margin-top: 18px;
}

/* --------------------------------------------------- Smal scherm */
@media (max-width: 820px) {
  .mg-layout {
    grid-template-columns: 1fr;
  }

  .mg-main {
    padding: 16px;
  }

  .mg-top {
    padding: 12px 16px;
  }
}

/* --------------------------------------------------- Vormgeving */
.mg-design {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  gap: 26px;
  align-items: start;
}

.mg-design-form {
  max-width: none;
}

.mg-colorrow {
  margin-bottom: 14px;
}

.mg-colorpair {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mg-colorpair input[type="color"] {
  width: 46px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--mg-line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.mg-colorpair input[type="text"] {
  width: 120px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-transform: lowercase;
}

.mg-default {
  font-size: 12px;
  color: var(--mg-soft);
}

.mg-colorrow .mg-hint {
  margin-top: 4px;
}

.mg-contrast {
  margin: 4px 0 10px;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid #e3c2c2;
  background: #fdf5f5;
  color: var(--mg-accent);
  font-size: 13px;
}

.mg-contrast[hidden],
.mg-contrast:empty {
  display: none;
}

.mg-textform select {
  margin-bottom: 4px;
}

.mg-design-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.mg-design-actions button {
  margin-top: 0;
}

.mg-preview-wrap {
  position: sticky;
  top: 20px;
}

.mg-preview-wrap .mg-hint {
  margin-bottom: 8px;
}

/* Het voorbeeld zelf: nabootsing van de kopregel en een stuk tekst. */
.mg-preview {
  --pv-bg: #000000;
  --pv-fg: #ffffff;
  --pv-accent: #8b0000;
  --pv-muted: rgba(255, 255, 255, 0.62);
  --pv-hairline: rgba(255, 255, 255, 0.14);
  --pv-name: "Oswald", sans-serif;
  --pv-title: "Oswald", sans-serif;
  --pv-tagline: "Jost", sans-serif;
  --pv-ui: "Inter", sans-serif;

  padding: 30px 22px 26px;
  border-radius: var(--mg-radius);
  border: 1px solid var(--mg-line);
  background: var(--pv-bg);
  color: var(--pv-fg);
  font-family: var(--pv-ui);
  text-align: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.mg-pv-title {
  font-family: var(--pv-name);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.mg-pv-tagline {
  margin-top: 8px;
  font-family: var(--pv-tagline);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 7px;
  text-indent: 7px;
  text-transform: uppercase;
  color: var(--pv-accent);
}

.mg-pv-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 18px;
  font-size: 14px;
}

.mg-pv-nav .is-on {
  color: var(--pv-accent);
}

.mg-pv-text {
  margin: 20px 0 0;
  font-size: 14px;
  line-height: 1.7;
  text-align: left;
}

.mg-pv-text a {
  color: var(--pv-fg);
  text-decoration: none;
  border-bottom: 1px solid var(--pv-accent);
}

.mg-pv-menu {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 16px;
  padding: 8px 18px;
  font-size: 13px;
  text-align: left;
  background: color-mix(in srgb, var(--pv-bg) 96%, var(--pv-fg));
  border: 1px solid var(--pv-hairline);
}

.mg-pv-shop {
  display: block;
  width: max-content;
  margin: 18px auto 0;
  padding: 10px 26px;
  font-family: var(--pv-tagline);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  border: 1px solid var(--pv-hairline);
}

@media (max-width: 900px) {
  .mg-design {
    grid-template-columns: minmax(0, 1fr);
  }

  .mg-preview-wrap {
    position: static;
    order: -1;
  }
}
