/* ==========================================================================
   Visual Site Editor 2.0 (Mobile-first & Full Customization)
   De Vries Bikecenter Webshop
   ========================================================================== */

/* Page editing mode */
body.editing {
  padding-top: 54px;
  background: #ede7dc;
  transition: padding .25s ease;
}
body.editing .site-header,
body.editing .site-footer,
body.editing .demo-dock,
body.editing .announce {
  display: none !important;
}

body.editing #page {
  margin: 0 auto;
  background: var(--cream);
  box-shadow: 0 0 0 1px rgba(12, 14, 7, .08), var(--shadow-l);
  transition: max-width .3s cubic-bezier(.2, .8, .2, 1);
  min-height: calc(100vh - 54px);
}
body.editing #page a { cursor: pointer; }
body.editing #page button:not(.blk-tools button):not(.faq-item) { pointer-events: none; }

/* Responsive preview widths */
body.editing.preview-tablet #page { max-width: 820px; }
body.editing.preview-mobile #page { max-width: 390px; }
body.editing.preview-tablet #page .products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.editing.preview-mobile #page .products,
body.editing.preview-mobile #page .cats,
body.editing.preview-mobile #page .reviews-grid,
body.editing.preview-mobile #page .gallery-grid,
body.editing.preview-mobile #page .brands { grid-template-columns: 1fr; }
body.editing.preview-mobile #page .usps { grid-template-columns: 1fr 1fr; }
body.editing.preview-mobile #page .split,
body.editing.preview-mobile #page .contact-grid { grid-template-columns: 1fr; }
body.editing.preview-mobile #page .promo-deal__in,
body.editing.preview-tablet #page .promo-deal__in { grid-template-columns: 1fr; }
body.editing.preview-mobile #page .promo-deal__media,
body.editing.preview-tablet #page .promo-deal__media { order: -1; max-width: 100%; }
body.editing.preview-mobile #page .promo-deal h2 { font-size: 2.1rem; }
body.editing.preview-mobile #page .hero h1 { font-size: 2.4rem; }

/* Desktop panel spacing */
@media (min-width: 861px) {
  body.editing { padding-right: 360px; }
}

/* ------------------------------------------------------------- Top Bar -- */
.ed-bar {
  position: fixed; inset: 0 0 auto 0; height: 54px; z-index: 140;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 0 12px;
  background: #14170f; color: #f4eee1;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  font-family: var(--font-ui); font-size: 13px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .28);
}
.ed-bar__left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ed-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; letter-spacing: -.01em; white-space: nowrap; }
.ed-brand svg { width: 18px; height: 18px; color: var(--peru); flex: none; }
.ed-badge {
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  background: rgba(206, 151, 70, .18); color: var(--burlywood);
  padding: 3px 8px; border-radius: 999px; border: 1px solid rgba(206, 151, 70, .28);
}

.ed-bar__mid {
  display: flex; align-items: center; gap: 2px;
  background: rgba(255, 255, 255, .08); padding: 3px; border-radius: 10px;
}
.ed-bar__mid button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 28px; border: 0; border-radius: 7px;
  background: transparent; color: rgba(244, 238, 225, .7); cursor: pointer;
  transition: all .15s ease;
}
.ed-bar__mid button:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.ed-bar__mid button.is-active { background: var(--cream); color: var(--ink); }
.ed-bar__mid svg { width: 15px; height: 15px; }

.ed-bar__right { display: flex; align-items: center; gap: 6px; }
.ed-bar__right button, .ed-bar__right a {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: rgba(244, 238, 225, .82);
  font-size: 12px; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: all .15s ease;
}
.ed-bar__right button:hover, .ed-bar__right a:hover {
  background: rgba(255, 255, 255, .12); color: #fff;
}
.ed-bar__right button:disabled { opacity: .28; pointer-events: none; }
.ed-bar__right .divider { width: 1px; height: 20px; background: rgba(255, 255, 255, .15); margin: 0 2px; }

.ed-btn-save {
  background: var(--peru) !important; color: #1c1305 !important; font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(206, 151, 70, .3);
}
.ed-btn-save:hover { background: var(--burlywood) !important; }
.ed-btn-save.is-dirty::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: #a33a2e; margin-left: 2px; box-shadow: 0 0 0 2px #fff;
}
.ed-close { color: rgba(244, 238, 225, .65); }

@media (max-width: 760px) {
  .ed-bar__mid { display: none; }
  .ed-bar .label-text { display: none; }
  .ed-bar .ed-badge { display: none; }
}

/* --------------------------------------------------------------- Panel -- */
.ed-panel {
  position: fixed; z-index: 135;
  background: #fdfbf7;
  display: flex; flex-direction: column;
  box-shadow: -15px 0 45px -20px rgba(12, 14, 7, .3);
}

/* Desktop Sidebar */
@media (min-width: 861px) {
  .ed-panel {
    top: 54px; right: 0; bottom: 0; width: 360px;
    border-left: 1px solid var(--line);
  }
  .ed-sheet-handle { display: none; }
}

/* Mobile Bottom Sheet */
@media (max-width: 860px) {
  .ed-panel {
    left: 0; right: 0; bottom: 0;
    width: 100%; border-radius: 20px 20px 0 0;
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, .28);
    transition: height .3s cubic-bezier(.2, .8, .2, 1), transform .3s ease;
  }
  .ed-panel.is-minimized {
    height: 52px !important; max-height: 52px !important;
    overflow: hidden;
  }
  .ed-panel.is-minimized .ed-panes { display: none; }
  .ed-panel.is-minimized .ed-tabs button { padding: 8px 4px 6px; font-size: 11px; }
  .ed-panel.is-half {
    height: 48vh; max-height: 48vh;
  }
  .ed-panel.is-full {
    height: 86vh; max-height: 86vh;
  }
}

/* Sheet Handle Bar on Mobile */
.ed-sheet-handle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px 4px; cursor: grab; user-select: none;
  background: #fdfbf7; border-radius: 20px 20px 0 0;
}
.ed-sheet-handle__pill {
  width: 42px; height: 4.5px; border-radius: 999px;
  background: var(--line); margin: 0 auto;
}
.ed-sheet-handle__actions {
  display: flex; align-items: center; gap: 8px; width: 100%; justify-content: space-between;
}
.ed-sheet-handle__title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.ed-sheet-btn-toggle {
  background: none; border: 0; color: var(--ink-3); font-size: 11.5px; font-weight: 600;
  cursor: pointer; padding: 2px 6px; border-radius: 4px;
}

/* Panel Tabs (4 tabs: Secties, Toevoegen, Stijl, Thema) */
.ed-tabs {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line); background: #fff;
  flex: none;
}
.ed-tabs button {
  border: 0; background: transparent; padding: 12px 2px 10px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: color .15s ease, border-color .15s ease;
}
.ed-tabs button svg { width: 14px; height: 14px; }
.ed-tabs button.is-active { color: var(--ink); border-bottom-color: var(--peru); background: #fffcf8; }

/* Panes container */
.ed-panes { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ed-pane { display: none; padding: 16px 16px 36px; }
.ed-pane.is-active { display: block; }
.ed-pane h4 {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin: 6px 0 10px; font-family: var(--font-ui); font-weight: 700;
}
.ed-pane h4 + p { font-size: 12.5px; color: var(--muted); margin: -4px 0 12px; line-height: 1.45; }
.ed-pane .divider { height: 1px; background: var(--line-soft); margin: 16px 0; }

/* --------------------------------------------------------- Block List -- */
.ed-list { display: grid; gap: 6px; }
.ed-item {
  display: grid; grid-template-columns: 24px 1fr auto auto; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 9px;
  background: #fff; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .15s ease;
}
.ed-item:hover { border-color: var(--line); background: #fdfbf7; }
.ed-item.is-selected {
  border-color: var(--peru); background: #fdf8ee;
  box-shadow: 0 0 0 2px rgba(206, 151, 70, .25);
}
.ed-item.is-hidden { opacity: .45; }
.ed-item__grip { color: var(--muted); cursor: grab; display: grid; place-items: center; }
.ed-item__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-item__reorder { display: flex; gap: 2px; }
.ed-item__reorder button {
  width: 26px; height: 26px; border: 0; background: rgba(0, 0, 0, .04); border-radius: 6px;
  color: var(--ink); display: grid; place-items: center; cursor: pointer;
}
.ed-item__reorder button:hover { background: var(--brand-tint); color: var(--brand-deep); }
.ed-item__acts { display: flex; gap: 2px; }
.ed-item__acts button {
  width: 26px; height: 26px; border: 0; background: transparent; border-radius: 6px;
  color: var(--muted); display: grid; place-items: center; cursor: pointer;
}
.ed-item__acts button:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }

/* ------------------------------------------------------------ Presets -- */
.ed-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ed-preset {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 12px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; text-align: left; cursor: pointer;
  transition: all .18s cubic-bezier(.2, .8, .2, 1);
}
.ed-preset:hover {
  border-color: var(--peru); transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
}
.ed-preset--wide { grid-column: span 2; flex-direction: row; align-items: center; gap: 12px; }
.ed-preset__thumb {
  width: 32px; height: 32px; border-radius: 8px; background: var(--brand-tint);
  color: var(--brand-deep); display: grid; place-items: center; flex: none;
}
.ed-preset__thumb svg { width: 17px; height: 17px; }
.ed-preset span { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.ed-preset small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 2px; }

/* ----------------------------------------------------- Style Controls -- */
.ed-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ed-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 6px 4px; border: 1.5px solid var(--line-soft); border-radius: 8px;
  background: #fff; cursor: pointer; transition: all .15s ease;
}
.ed-swatch span {
  width: 24px; height: 24px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, .12);
}
.ed-swatch small { font-size: 10.5px; color: var(--muted); font-weight: 500; }
.ed-swatch:hover { border-color: var(--peru); }
.ed-swatch.is-active { border-color: var(--ink); box-shadow: 0 0 0 2px var(--brand-tint); }

.ed-custom-color {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  padding: 8px 10px; background: #fff; border: 1px solid var(--line-soft); border-radius: 8px;
}
.ed-custom-color input[type=color] {
  width: 30px; height: 30px; border: 0; padding: 0; border-radius: 6px; cursor: pointer; background: none;
}
.ed-custom-color input[type=text] {
  flex: 1; height: 32px; font-size: 12.5px; font-family: monospace;
  border: 1px solid var(--line); border-radius: 6px; padding: 0 8px;
}

/* Segmented Buttons */
.ed-seg {
  display: flex; background: rgba(0, 0, 0, .05); padding: 3px; border-radius: 9px; gap: 2px;
}
.ed-seg button {
  flex: 1; height: 32px; border: 0; background: transparent; border-radius: 7px;
  font-size: 11.5px; font-weight: 600; color: var(--ink-3); cursor: pointer;
  transition: all .15s ease; white-space: nowrap;
}
.ed-seg button:hover { color: var(--ink); }
.ed-seg button.is-active {
  background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0, 0, 0, .08);
}

/* Form controls in Style Pane */
.ed-field { display: grid; gap: 6px; margin-bottom: 12px; }
.ed-field label { font-size: 12px; font-weight: 600; color: var(--ink-2); display: flex; justify-content: space-between; }
.ed-field input, .ed-field select, .ed-field textarea {
  width: 100%; padding: 8px 10px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
  box-sizing: border-box;
}
.ed-field input:focus, .ed-field select:focus, .ed-field textarea:focus {
  outline: none; border-color: var(--peru); box-shadow: 0 0 0 2px rgba(206, 151, 70, .2);
}
.ed-range-row { display: flex; align-items: center; gap: 10px; }
.ed-range-row input[type=range] { flex: 1; accent-color: var(--peru); cursor: pointer; }
.ed-range-val { font-size: 12px; font-weight: 700; width: 40px; text-align: right; color: var(--ink); }

/* Switch Toggle Row */
.ed-switch {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; font-size: 13px; font-weight: 500; cursor: pointer;
}
.ed-switch input[type=checkbox] {
  width: 18px; height: 18px; accent-color: var(--peru); cursor: pointer;
}

/* ------------------------------------------------------ Canvas States -- */
body.editing #page [data-block] {
  position: relative; transition: outline .15s ease;
}
body.editing #page [data-block]:hover {
  outline: 2px dashed rgba(206, 151, 70, .6); outline-offset: -2px;
}
body.editing #page [data-block].is-selected {
  outline: 3px solid var(--peru) !important; outline-offset: -3px;
}
body.editing #page [data-block].drop-before::before,
body.editing #page [data-block].drop-after::after {
  content: ""; position: absolute; left: 0; right: 0; height: 4px;
  background: var(--peru); z-index: 50; box-shadow: 0 0 10px var(--peru);
}
body.editing #page [data-block].drop-before::before { top: -2px; }
body.editing #page [data-block].drop-after::after { bottom: -2px; }

/* Desktop block toolbar */
.blk-tools {
  position: absolute; top: 10px; right: 10px; z-index: 45; display: flex; gap: 3px;
  background: rgba(14, 16, 10, .94); border-radius: 9px; padding: 4px;
  opacity: 0; transform: translateY(-4px); transition: all .15s ease;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .3); backdrop-filter: blur(8px);
}
body.editing [data-block]:hover > .blk-tools,
body.editing [data-block].is-selected > .blk-tools,
body.editing [data-block]:focus-within > .blk-tools {
  opacity: 1; transform: none;
}
.blk-tools__label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255, 255, 255, .7); padding: 5px 8px; white-space: nowrap;
}
.blk-tools button {
  width: 28px; height: 28px; border: 0; border-radius: 6px;
  background: transparent; color: rgba(255, 255, 255, .85);
  display: grid; place-items: center; cursor: pointer;
  transition: all .12s ease;
}
.blk-tools button:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.blk-tools button.is-danger:hover { background: #dc2626; color: #fff; }
.blk-tools svg { width: 15px; height: 15px; }

/* Mobile Floating Touch Toolbar (Pops up when a block is selected on mobile) */
.ed-touch-bar {
  display: none;
}
@media (max-width: 860px) {
  .ed-touch-bar {
    position: fixed; left: 14px; right: 14px; bottom: 62px; z-index: 138;
    background: #14170f; border-radius: 14px; padding: 6px 10px;
    display: flex; align-items: center; justify-content: space-around; gap: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    border: 1px solid rgba(255, 255, 255, .15);
    backdrop-filter: blur(12px);
    animation: edSlideUp .2s cubic-bezier(.2, .8, .2, 1);
  }
  .ed-touch-bar.is-hidden { display: none !important; }
  .ed-touch-bar button {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    min-width: 48px; height: 44px; padding: 4px 6px; border: 0; border-radius: 8px;
    background: transparent; color: rgba(255, 255, 255, .88); cursor: pointer;
    font-size: 10px; font-weight: 600;
  }
  .ed-touch-bar button svg { width: 18px; height: 18px; color: var(--peru); }
  .ed-touch-bar button.is-danger svg { color: #f87171; }
  .ed-touch-bar button:active { background: rgba(255, 255, 255, .15); }
}

@keyframes edSlideUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Inline text editing */
body.editing [data-edit="text"] {
  transition: box-shadow .15s ease, background .15s ease; border-radius: 4px;
}
body.editing [data-edit="text"]:hover {
  box-shadow: 0 0 0 2px rgba(206, 151, 70, .55); background: rgba(255, 255, 255, .08);
}
body.editing [data-edit="text"]:focus {
  outline: none; box-shadow: 0 0 0 3px var(--peru); background: rgba(255, 255, 255, .14);
}
body.editing img[data-edit="image"] {
  cursor: pointer; transition: filter .15s ease;
}
body.editing img[data-edit="image"]:hover {
  filter: brightness(.82); outline: 2px solid var(--peru);
}

/* ----------------------------------------------------- Button Inspector -- */
.ed-btn-popover {
  position: fixed; inset: 0; z-index: 150; display: grid; place-items: center;
  background: rgba(12, 14, 7, .55); backdrop-filter: blur(4px);
  padding: 16px;
}
.ed-btn-card {
  width: min(440px, 100%); background: #fff; border-radius: 16px;
  padding: 24px; box-shadow: var(--shadow-l);
  display: grid; gap: 14px; animation: edPop .2s ease;
}
.ed-btn-card h3 { margin: 0; font-size: 20px; }
@keyframes edPop { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------------------------------------------------------- Media Modal -- */
.media-panel { width: min(720px, 100%); padding: 24px; max-height: 90vh; overflow-y: auto; }
.media-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px;
}
@media (max-width: 600px) {
  .media-grid { grid-template-columns: repeat(2, 1fr); }
}
.media-thumb {
  aspect-ratio: 4/3; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; background: #fff; padding: 0; cursor: pointer;
  transition: all .15s ease;
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-thumb:hover { border-color: var(--peru); transform: scale(1.02); }
.media-thumb.is-active { border-color: var(--ink); box-shadow: 0 0 0 2px var(--brand); }
.media-upload { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.media-upload input[type=text] { flex: 1 1 180px; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font-size: 13px; }

/* --------------------------------------------------- Helper utilities -- */
body.editing #page [data-hidden="true"] { display: block !important; opacity: .28; pointer-events: none; }
[data-hidden="true"] { display: none !important; }
@media (max-width: 760px) { [data-hide-mobile="true"] { display: none !important; } }
@media (min-width: 761px) { [data-hide-desktop="true"] { display: none !important; } }
.rot90 { transform: rotate(90deg); }
