/**
 * Tegeluk Fototegel - opmaak van het ontwerpvenster.
 * Alle klassen beginnen met "tgl-" zodat ze niet botsen met je thema.
 */

.tgl-overlay {
  --tgl-blue: #1c3d8f;
  --tgl-blue-deep: #142c68;
  --tgl-ink: #16233f;
  --tgl-muted: #5a6788;
  --tgl-glaze: #fbfcff;
  --tgl-mist: #eaf0fb;
  --tgl-line: #c9d5ec;
  --tgl-ok: #1f6f48;
  --tgl-err: #a8321f;
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(14, 26, 54, 0.62);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--tgl-ink);
}
.tgl-overlay.is-open { display: flex; }
.tgl-overlay *, .tgl-overlay *::before, .tgl-overlay *::after { box-sizing: border-box; }
.tgl-locked { overflow: hidden; }
.tgl-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.tgl-dialog {
  display: flex;
  flex-direction: column;
  width: min(1060px, 100%);
  max-height: min(94vh, 880px);
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(8, 16, 40, 0.45);
}

/* ---- kop ---- */
.tgl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--tgl-line);
}
.tgl-title {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--tgl-blue-deep);
  letter-spacing: 0;
}
.tgl-close {
  appearance: none;
  border: 1px solid var(--tgl-line);
  background: #fff;
  color: var(--tgl-ink);
  border-radius: 6px;
  padding: 7px 14px;
  font: inherit;
  cursor: pointer;
}
.tgl-close:hover { background: var(--tgl-mist); }

/* ---- indeling ---- */
.tgl-body {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  flex: 1 1 auto;
  min-height: 0;
}
.tgl-stage {
  padding: 22px;
  overflow: auto;
  background: var(--tgl-mist);
}
.tgl-panel {
  overflow: auto;
  padding: 4px 22px 18px;
}

/* ---- de tegel zelf ---- */
.tgl-tile {
  position: relative;
  width: min(100%, 560px);
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  background: var(--tgl-glaze);
  border-radius: 3px;
  border: 1px solid #b9c7e4;
  box-shadow:
    inset 0 0 0 5px #fff,
    inset 0 0 0 6px #e3eaf7,
    0 1px 0 #fff,
    0 14px 26px rgba(28, 61, 143, 0.18),
    0 3px 6px rgba(28, 61, 143, 0.12);
}
.tgl-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 2px;
  touch-action: none;
  cursor: grab;
  opacity: 0;
}
.tgl-tile.has-photo .tgl-canvas { opacity: 1; }
.tgl-overlay.is-erasing .tgl-canvas { cursor: crosshair; }
.tgl-canvas:focus-visible { outline: 3px solid var(--tgl-blue); outline-offset: 3px; }

.tgl-drop {
  appearance: none;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  margin: 0;
  border: 2px dashed #9db2dc;
  border-radius: 3px;
  background: transparent;
  color: var(--tgl-blue);
  font: inherit;
  text-align: center;
  cursor: pointer;
}
.tgl-drop strong {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 22px;
  font-weight: 600;
}
.tgl-drop span { color: var(--tgl-muted); font-size: 14px; max-width: 24ch; }
.tgl-drop-icon { width: 54px; height: 54px; margin-bottom: 4px; }
.tgl-drop:hover, .tgl-tile.is-over .tgl-drop { background: rgba(28, 61, 143, 0.06); border-color: var(--tgl-blue); }
.tgl-drop:focus-visible { outline: 3px solid var(--tgl-blue); outline-offset: 2px; }
.tgl-tile.has-photo .tgl-drop { display: none; }

/* ---- knoppen: expres stevig opgemaakt zodat thema-opmaak ze niet onzichtbaar maakt ---- */
.tgl-overlay button { text-transform: none; letter-spacing: normal; min-height: 0; box-shadow: none; text-shadow: none; }
.tgl-overlay .tgl-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 16px;
  border: 1px solid #7f98cf;
  border-radius: 6px;
  background: #ffffff !important;
  color: #142c68 !important;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}
.tgl-overlay .tgl-btn:hover { background: #eaf0fb !important; border-color: var(--tgl-blue); }
.tgl-overlay .tgl-btn:focus-visible { outline: 3px solid var(--tgl-blue); outline-offset: 2px; }
.tgl-overlay .tgl-btn svg { flex: 0 0 auto; }
.tgl-overlay .tgl-link { color: #1c3d8f !important; background: none !important; }
.tgl-actions { display: flex; flex-wrap: wrap; gap: 10px; width: min(100%, 560px); margin: 14px auto 0; }

/* ---- gereedschap onder de tegel ---- */
.tgl-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, 560px);
  margin: 18px auto 0;
}
.tgl-tools { display: inline-flex; border: 1px solid #9db2dc; border-radius: 6px; overflow: hidden; background: #fff; }
.tgl-tool {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 8px 16px;
  font: inherit;
  color: var(--tgl-ink);
  cursor: pointer;
}
.tgl-tool + .tgl-tool { border-left: 1px solid #9db2dc; }
.tgl-tool.is-on { background: var(--tgl-blue); color: #fff; }
.tgl-tool:focus-visible, .tgl-link:focus-visible { outline: 3px solid var(--tgl-blue); outline-offset: 2px; }
.tgl-tip, .tgl-warning {
  width: min(100%, 560px);
  margin: 12px auto 0;
  font-size: 14px;
  color: var(--tgl-muted);
}
.tgl-warning { color: #8a4b00; }
.tgl-warning:empty { display: none; }

.tgl-link {
  appearance: none;
  border: 0;
  background: none;
  padding: 4px 0;
  font: inherit;
  color: var(--tgl-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.tgl-mini { font-size: 13px; }

/* ---- keuzes ---- */
.tgl-section { padding: 18px 0; border-bottom: 1px solid var(--tgl-line); }
.tgl-section:last-child { border-bottom: 0; }
.tgl-section-title {
  margin: 0 0 12px;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--tgl-blue-deep);
  letter-spacing: 0;
  text-transform: none;
}

.tgl-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.tgl-style, .tgl-border {
  appearance: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  margin: 0;
  border: 1px solid var(--tgl-line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  color: var(--tgl-ink);
  text-align: left;
  cursor: pointer;
}
.tgl-style:hover, .tgl-border:hover { border-color: #8aa2d6; }
.tgl-style.is-on, .tgl-border.is-on { border-color: var(--tgl-blue); box-shadow: 0 0 0 2px var(--tgl-blue); }
.tgl-style:focus-visible, .tgl-border:focus-visible { outline: 3px solid var(--tgl-blue); outline-offset: 2px; }
.tgl-style-thumb, .tgl-border-thumb { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; background: #f2f5fc; border-radius: 3px; }
.tgl-style-name, .tgl-border-name { font-size: 13px; line-height: 1.25; overflow-wrap: break-word; }

.tgl-borders { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px; }
.tgl-border.is-none .tgl-border-thumb { background: repeating-linear-gradient(45deg, #f2f5fc, #f2f5fc 6px, #e3eaf7 6px, #e3eaf7 7px); }

.tgl-row { position: relative; margin: 0 0 18px; }
.tgl-row label { display: block; margin-bottom: 2px; font-size: 14px; font-weight: 600; color: var(--tgl-ink); }
.tgl-row .tgl-mini { position: absolute; right: 0; top: 0; }
.tgl-sep { height: 1px; background: var(--tgl-line); margin: 6px 0 14px; }

/* schuifbalken: duidelijke blauwe lijn met een bolletje, links van het bolletje gevuld */
.tgl-range {
  --tgl-fill: 50%;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 30px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.tgl-range:focus { outline: none; }
.tgl-range::-webkit-slider-runnable-track {
  height: 8px;
  border: 1px solid #8fa7d6;
  border-radius: 5px;
  background: linear-gradient(to right, var(--tgl-blue) 0, var(--tgl-blue) var(--tgl-fill), #dfe7f6 var(--tgl-fill), #dfe7f6 100%);
}
.tgl-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: 26px;
  height: 26px;
  margin-top: -9px;
  border: 4px solid var(--tgl-blue);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(14, 26, 54, 0.35);
}
.tgl-range::-moz-range-track { height: 8px; border: 1px solid #8fa7d6; border-radius: 5px; background: #dfe7f6; }
.tgl-range::-moz-range-progress { height: 8px; border-radius: 5px; background: var(--tgl-blue); }
.tgl-range::-moz-range-thumb {
  box-sizing: border-box;
  width: 26px;
  height: 26px;
  border: 4px solid var(--tgl-blue);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(14, 26, 54, 0.35);
}
.tgl-range:focus-visible::-webkit-slider-thumb { outline: 3px solid rgba(28, 61, 143, 0.4); outline-offset: 2px; }
.tgl-range:focus-visible::-moz-range-thumb { outline: 3px solid rgba(28, 61, 143, 0.4); outline-offset: 2px; }
.tgl-ends { display: flex; justify-content: space-between; margin-top: 1px; font-size: 12px; color: var(--tgl-muted); }
.tgl-reset { margin: 0 0 4px; font-size: 14px; }
.tgl-erase-row { display: none; }
.tgl-overlay.is-erasing .tgl-erase-row { display: block; }

.tgl-advanced { margin: 4px 0 12px; }
.tgl-advanced summary { cursor: pointer; font-size: 14px; color: var(--tgl-blue); padding: 4px 0; }
.tgl-advanced-body { padding-top: 10px; }

.tgl-text {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #9db2dc;
  border-radius: 6px;
  background: #fff;
  font: italic 17px Georgia, "Times New Roman", serif;
  color: var(--tgl-blue-deep);
}
.tgl-text:focus { outline: 3px solid rgba(28, 61, 143, 0.35); border-color: var(--tgl-blue); }

/* ---- onderkant ---- */
.tgl-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-top: 1px solid var(--tgl-line);
  background: #fff;
}
.tgl-message { margin: 0; flex: 1 1 auto; font-size: 14px; color: var(--tgl-muted); }
.tgl-message.is-error { color: var(--tgl-err); }
.tgl-message.is-ok { color: var(--tgl-ok); }
.tgl-done {
  appearance: none;
  flex: 0 0 auto;
  border: 0;
  border-radius: 6px;
  padding: 13px 26px;
  background: var(--tgl-blue);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tgl-done:hover:not(:disabled) { background: var(--tgl-blue-deep); }
.tgl-done:disabled { background: #a9b7d8; cursor: not-allowed; }
.tgl-done:focus-visible { outline: 3px solid var(--tgl-blue); outline-offset: 3px; }

/* knop op de productpagina */
.tgl-start { cursor: pointer; }

/* ---- telefoon en kleine schermen ---- */
@media (max-width: 860px) {
  .tgl-overlay { padding: 0; align-items: stretch; }
  .tgl-dialog { width: 100%; max-height: none; height: 100%; border-radius: 0; }
  .tgl-head { padding: 10px 14px; }
  .tgl-title { font-size: 19px; }
  .tgl-body { display: block; overflow: auto; -webkit-overflow-scrolling: touch; }
  .tgl-stage { padding: 14px; overflow: visible; }
  .tgl-panel { padding: 0 14px 14px; overflow: visible; }
  .tgl-actions .tgl-btn { flex: 1 1 0; justify-content: center; padding: 10px 10px; }
  .tgl-foot { padding: 10px 14px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .tgl-message { font-size: 13px; }
  .tgl-done { padding: 13px 20px; }
  .tgl-styles { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
  .tgl-style, .tgl-border { padding: 4px; }
  .tgl-style-name, .tgl-border-name { font-size: 12px; }
}

@media (prefers-reduced-motion: no-preference) {
  .tgl-style, .tgl-border, .tgl-done { transition: border-color 0.15s, box-shadow 0.15s, background 0.15s; }
}

/* ---------------------------------------------------------------------------
 * Bescherming tegen thema-opmaak
 * Veel WordPress-thema's geven alle knoppen op de site een eigen kleur (soms wit
 * op wit) of hoofdletters. Daardoor kunnen knoppen onzichtbaar worden. Hieronder
 * leggen we de kleuren van onze eigen knoppen vast, zodat ze altijd leesbaar zijn.
 * ------------------------------------------------------------------------- */
.tgl-overlay button { text-transform: none !important; letter-spacing: normal !important; text-shadow: none !important; }
.tgl-overlay .tgl-close { color: #16233f !important; background: #ffffff !important; }
.tgl-overlay .tgl-close:hover { background: #eaf0fb !important; }
.tgl-overlay .tgl-tool { color: #16233f !important; background: transparent !important; }
.tgl-overlay .tgl-tool.is-on { color: #ffffff !important; background: #1c3d8f !important; }
.tgl-overlay .tgl-done { color: #ffffff !important; background: #1c3d8f !important; }
.tgl-overlay .tgl-done:hover:not(:disabled) { background: #142c68 !important; }
.tgl-overlay .tgl-done:disabled { color: #ffffff !important; background: #a9b7d8 !important; }
.tgl-overlay .tgl-style, .tgl-overlay .tgl-border { color: #16233f !important; background: #ffffff !important; }
.tgl-overlay .tgl-style-name, .tgl-overlay .tgl-border-name { color: #16233f !important; }
.tgl-overlay .tgl-drop { color: #1c3d8f !important; background: transparent !important; }
.tgl-overlay .tgl-drop:hover { background: rgba(28, 61, 143, 0.06) !important; }
.tgl-overlay .tgl-drop span { color: #5a6788 !important; }
.tgl-overlay .tgl-drop strong { color: #1c3d8f !important; }

/* ---- bezig met rekenen: klein draaiend rondje op de tegel ---- */
.tgl-tile.is-busy::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 14px;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(28, 61, 143, 0.22);
  border-top-color: #1c3d8f;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  animation: tgl-spin 0.8s linear infinite;
}
@keyframes tgl-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tgl-tile.is-busy::after { animation: none; } }

/* ---- AI-tekening ---- */
.tgl-overlay .tgl-make {
  flex: 1 1 100%;
  justify-content: center;
  padding: 13px 18px;
  font-size: 16px;
  background: #1c3d8f !important;
  color: #ffffff !important;
  border-color: #1c3d8f;
}
.tgl-overlay .tgl-make:hover:not(:disabled) { background: #142c68 !important; }
.tgl-overlay .tgl-make:disabled { background: #a9b7d8 !important; border-color: #a9b7d8; cursor: not-allowed; }
.tgl-ainote { width: min(100%, 560px); margin: 12px auto 0; font-size: 14px; color: var(--tgl-ink); }
.tgl-ainote:empty { display: none; }
.tgl-privacy { width: min(100%, 560px); margin: 8px auto 0; font-size: 12.5px; color: var(--tgl-muted); }
.tgl-privacy a { color: #1c3d8f; }
.tgl-wait {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  border-radius: 3px;
  background: rgba(251, 252, 255, 0.82);
  text-align: center;
  color: #142c68;
}
.tgl-tile.is-painting .tgl-wait { display: flex; }
.tgl-wait strong { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-size: 20px; }
.tgl-wait span { font-size: 14px; color: #5a6788; }
.tgl-spin {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(28, 61, 143, 0.2);
  border-top-color: #1c3d8f;
  border-radius: 50%;
  animation: tgl-spin 0.9s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .tgl-spin { animation: none; } }
