/* SolarResult Studio: shell-styling. De canvas van de blokpagina-editor
 * (fase 5) laadt de échte site-CSS uit de repo-clone; dit bestand stylet
 * alleen de studio zelf. */

:root {
  --oranje: #fc7909;
  --oranje-donker: #d96400;
  --inkt: #1a1a1a;
  --inkt-zacht: #555;
  --papier: #faf7f4;
  --kaart: #ffffff;
  --rand: #e8e4e0;
  --fout: #c0392b;
  --radius: 10px;
  --schaduw: 0 1px 3px rgba(0, 0, 0, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--papier);
  color: var(--inkt);
  line-height: 1.6;
}

.scherm {
  max-width: 26rem;
  margin: 10vh auto 0;
  padding: 2rem;
}

.scherm--breed { max-width: 60rem; margin-top: 0; }
.scherm--formulier { width: 100%; max-width: 104rem; margin-top: 0; }
.scherm--formulier input:not([type='color']):not([type='checkbox']),
.scherm--formulier textarea { width: 100%; box-sizing: border-box; }

.kaart {
  background: var(--kaart);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  box-shadow: var(--schaduw);
  padding: 1.5rem;
}

h1 { font-size: 1.4rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }
.sub { color: var(--inkt-zacht); margin: 0 0 1.25rem; font-size: 0.92rem; }

label { display: block; font-size: 0.85rem; font-weight: 600; margin: 0.9rem 0 0.25rem; }

input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font: inherit;
  border: 1px solid var(--rand);
  border-radius: 6px;
  background: #fff;
}

input:focus { outline: 2px solid var(--oranje); outline-offset: 0; border-color: transparent; }

button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  background: var(--oranje);
  color: #fff;
  cursor: pointer;
  margin-top: 1.25rem;
}

button:hover { background: var(--oranje-donker); }
button.stil { background: transparent; color: var(--inkt-zacht); }

.melding { color: var(--fout); font-size: 0.88rem; margin: 0.75rem 0 0; min-height: 1.2em; }

.qr { display: block; margin: 1rem auto; border: 1px solid var(--rand); border-radius: var(--radius); }
.secret { font-family: ui-monospace, monospace; font-size: 0.8rem; color: var(--inkt-zacht); text-align: center; word-break: break-all; }

/* --- Dashboard --- */

.topbalk {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  background: var(--kaart);
  border-bottom: 1px solid var(--rand);
}

.topbalk .logo { font-weight: 800; }
.topbalk .logo span { color: var(--oranje); }

.repo-status { font-size: 0.82rem; color: var(--inkt-zacht); }

.groep { margin: 2rem 0; }
.groep h2 { display: flex; align-items: center; gap: 0.5rem; }

.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0.75rem; list-style: none; padding: 0; margin: 0.75rem 0 0; }

.item {
  background: var(--kaart);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.item strong { font-size: 0.95rem; }
.item .pad { font-family: ui-monospace, monospace; font-size: 0.72rem; color: var(--inkt-zacht); word-break: break-all; }

.badge {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: #f0ece8;
  color: var(--inkt-zacht);
}

.badge--vrij { background: #e8f6ec; color: #1e7d36; }
.badge--vast { background: #fdf1e3; color: #b25e00; }

.item--klikbaar { cursor: pointer; }
.item--klikbaar:hover { border-color: var(--oranje); box-shadow: 0 2px 8px rgba(252, 121, 9, 0.15); }

/* --- Website-viewer --- */

.viewer-frame { flex: 1; width: 100%; border: 0; background: #fff; }
.viewer-route { font-family: ui-monospace, monospace; font-size: 0.78rem; color: var(--inkt-zacht); }

/* --- Editor --- */

.editor { display: flex; flex-direction: column; height: 100vh; }
.editor .topbalk { flex: 0 0 auto; }
.ed-status { font-size: 0.82rem; color: var(--inkt-zacht); }

.editor__kolommen {
  flex: 1;
  display: grid;
  grid-template-columns: 15rem 1fr 19rem;
  min-height: 0;
}

/* Documenteditor: velden links, grote preview rechts */
.editor__kolommen--document { grid-template-columns: 30rem 1fr; }
.editor__paneel--links { border-left: 0; border-right: 1px solid var(--rand); }

.editor__bib, .editor__paneel {
  overflow-y: auto;
  padding: 1rem;
  background: var(--kaart);
}

.editor__bib { border-right: 1px solid var(--rand); }
.editor__paneel { border-left: 1px solid var(--rand); }
.editor__bib h2, .editor__paneel h2 { margin-top: 0; font-size: 0.95rem; }
.editor__bib h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--inkt-zacht); margin: 1.25rem 0 0.4rem; }

.bib-blok {
  all: unset;
  display: block;
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
  border: 1px solid var(--rand);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  margin: 0.3rem 0;
  background: #fff;
}
.bib-blok:hover { border-color: var(--oranje); }
.bib-blok strong { display: block; font-size: 0.85rem; }
.bib-blok span { font-size: 0.72rem; color: var(--inkt-zacht); line-height: 1.3; display: block; }

/* Linker kolom: tabs (Pagina's / Nieuw blok) */
.ed-tabs { display: flex; gap: 0.25rem; margin: 0 0 0.85rem; }
.ed-tabs button {
  all: unset;
  flex: 1;
  box-sizing: border-box;
  text-align: center;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--inkt-zacht);
  padding: 0.45rem 0.5rem;
  border-radius: 7px;
}
.ed-tabs button:hover { background: rgba(252, 121, 9, 0.08); }
.ed-tabs button.actief { background: var(--oranje); color: #fff; }
.ed-tabvlak h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--inkt-zacht); margin: 1.25rem 0 0.4rem; }
.ed-tabvlak h3:first-child { margin-top: 0; }

/* Pagina-lijst en blok-outline: zelfde rij-stijl */
.ed-pagina, .ed-blok {
  all: unset;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0.4rem 0.55rem;
  border-radius: 7px;
  border: 1px solid transparent;
}
.ed-pagina { justify-content: space-between; }
.ed-pagina:hover, .ed-blok:hover { background: rgba(252, 121, 9, 0.08); }
.ed-pagina.actief, .ed-blok.actief { background: rgba(252, 121, 9, 0.12); border-color: var(--oranje); font-weight: 600; }
.ed-pagina__titel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-pagina__badge { flex: none; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--inkt-zacht); }
.ed-blok__nr { flex: none; min-width: 1.3em; text-align: right; color: var(--inkt-zacht); font-size: 0.72rem; }
.ed-blok__naam { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.editor__canvas { min-width: 0; background: #e9e5e1; padding: 1rem; overflow: hidden; }
.editor__canvas iframe {
  width: 100%;
  height: 100%;
  border: 1px solid var(--rand);
  border-radius: 8px;
  background: #fff;
}

.paneel-veld { margin-bottom: 0.9rem; }
.paneel-veld label { margin: 0 0 0.25rem; }
.paneel-veld textarea { width: 100%; font: inherit; font-size: 0.85rem; border: 1px solid var(--rand); border-radius: 6px; padding: 0.5rem; resize: vertical; }
.paneel-veld select { width: 100%; font: inherit; padding: 0.45rem; border: 1px solid var(--rand); border-radius: 6px; background: #fff; }
.toggle { display: flex; align-items: center; gap: 0.4rem; font-weight: 400; }
.toggle input { width: auto; }

.afbeelding-veld input { margin-bottom: 0.3rem; }
.afbeelding-knoppen { display: flex; gap: 0.5rem; }
.afbeelding-knoppen button { margin: 0; padding: 0.2rem 0.6rem; border: 1px solid var(--rand); border-radius: 6px; }

.lijst-item { border: 1px solid var(--rand); border-radius: 8px; padding: 0.6rem; margin: 0.4rem 0; }
.lijst-kop { display: flex; justify-content: space-between; align-items: center; }
.lijst-kop button { margin: 0; padding: 0; }

.kiezer { border: 1px solid var(--rand); border-radius: var(--radius); padding: 1.25rem; max-width: 44rem; }
.kiezer::backdrop { background: rgba(0, 0, 0, 0.35); }
.kiezer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.5rem; max-height: 50vh; overflow-y: auto; margin: 1rem 0; }
.kiezer-grid button { all: unset; cursor: pointer; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: #f4f1ee; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.kiezer-grid button:hover { border-color: var(--oranje); }
.kiezer-grid img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* --- Rijke tekstlaag in de document-editor (zie richtext.js) --- */
.dc-body-kop { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.35rem; }
.dc-body-kop label { margin: 0; }
.dc-tabs { display: flex; gap: 2px; background: #f0ece8; border-radius: 999px; padding: 2px; }
.dc-tabs button { all: unset; cursor: pointer; font-size: 0.78rem; font-weight: 600; color: var(--inkt-zacht); padding: 0.25rem 0.7rem; border-radius: 999px; }
.dc-tabs button.actief { background: var(--kaart); color: var(--inkt); box-shadow: var(--schaduw); }

.s-werkbalk--vast { position: relative; display: flex; gap: 2px; background: var(--inkt); border-radius: 8px 8px 0 0; padding: 3px; }
.s-werkbalk--vast button { all: unset; cursor: pointer; color: #fff; font: 600 13px/1 system-ui; padding: 6px 8px; border-radius: 5px; min-width: 1.1em; text-align: center; }
.s-werkbalk--vast button:hover { background: #fc790966; }
.s-werkbalk--vast button.s-aan { background: var(--oranje); }
.s-werkbalk--vast .s-bron-popup { display: none; position: absolute; top: 100%; left: 0; z-index: 20; margin-top: 2px; max-height: 16rem; max-width: 100%; overflow-y: auto; background: var(--inkt); border-radius: 0 0 8px 8px; padding: 4px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); }
.s-werkbalk--vast .s-bron-popup.s-open { display: flex; flex-direction: column; }
.s-werkbalk--vast .s-bron-popup button { text-align: left; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* De "Opmaak"-editor spiegelt typografie én ritme van .blog-post__body
   (src/styles/global.css), zodat de opmaak-stand niet verspringt t.o.v. de
   gerenderde preview. De studio is een aparte app zonder de site-CSS, dus de
   waarden zijn een kopie; houd ze gelijk aan de site. */
.dc-rijk-vlak .tiptap { background: var(--kaart); border: 1px solid var(--rand); border-top: 0; border-radius: 0 0 6px 6px; padding: 1rem 1.1rem; min-height: 20rem; outline: none; font-size: 1.25rem; line-height: 1.7; color: var(--inkt); }
.dc-rijk-vlak .tiptap > :first-child { margin-top: 0; }
.dc-rijk-vlak .tiptap p { margin: 0 0 1.25rem; }
.dc-rijk-vlak .tiptap h2 { font-size: 1.25rem; font-weight: 700; margin: 2rem 0 0.75rem; }
.dc-rijk-vlak .tiptap h3 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.dc-rijk-vlak .tiptap h4 { font-size: 1rem; font-weight: 600; margin: 2rem 0 0.75rem; }
.dc-rijk-vlak .tiptap ul, .dc-rijk-vlak .tiptap ol { padding-left: 1.5rem; margin: 0 0 1.25rem; }
.dc-rijk-vlak .tiptap li { margin-bottom: 0.375rem; }
.dc-rijk-vlak .tiptap a { color: var(--oranje-donker); }
.dc-rijk-vlak .tiptap sup a { color: var(--oranje-donker); text-decoration: none; font-weight: 600; }
/* Tabellen: zelfde lijnen en koptint als .blog-post__body table (de
   brand-tinten als hsl-literal, want studio.css kent het tintpalet niet). */
.dc-rijk-vlak .tiptap .tableWrapper { overflow-x: auto; margin: 0 0 1.25rem; }
.dc-rijk-vlak .tiptap table { width: 100%; border-collapse: collapse; margin: 0; }
.dc-rijk-vlak .tiptap th, .dc-rijk-vlak .tiptap td { padding: 0.75rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid hsl(28 98% 81%); border-right: 1px solid hsl(28 98% 81%); }
.dc-rijk-vlak .tiptap th:last-child, .dc-rijk-vlak .tiptap td:last-child { border-right: none; }
.dc-rijk-vlak .tiptap th { font-weight: 600; background: hsl(28 98% 95%); border-bottom: 2px solid hsl(28 98% 71%); }
.dc-rijk-vlak .tiptap th > :last-child, .dc-rijk-vlak .tiptap td > :last-child { margin-bottom: 0; }
.dc-rijk-vlak .tiptap .selectedCell { position: relative; }
.dc-rijk-vlak .tiptap .selectedCell::after { content: ''; position: absolute; inset: 0; background: rgba(252, 121, 9, 0.12); pointer-events: none; }

/* Kleine schermen: de drie-koloms-editor is niet gemaakt voor telefoon/tablet.
   In plaats van een kapotte layout stapelen we de kolommen en tonen we een
   nette tip. Inloggen en het dashboard blijven gewoon werken. */
@media (max-width: 60rem) {
  .editor__kolommen,
  .editor__kolommen--document { grid-template-columns: 1fr; }
  .editor__bib,
  .editor__paneel {
    border: 0;
    border-top: 1px solid var(--rand);
    max-height: none;
  }
  .editor__canvas iframe { min-height: 60vh; }
  .editor::before {
    content: 'Tip: de studio werkt het prettigst op een laptop of groter scherm.';
    display: block;
    background: hsl(28 98% 95%);
    color: #7a3d00;
    font: 500 0.85rem/1.4 system-ui;
    padding: 0.5rem 1rem;
    text-align: center;
  }
}
