/* ============================================================
   Folder Designer Ult — Frontend Styles
   Combines base designer styles + Standard's modal/toast/notice additions
   ============================================================ */

:root {
  --fdl-accent:       #1e40af;
  --fdl-accent-hover: #1e3a8a;
  --fdl-accent-light: #eff6ff;
  --fdl-text:         #111827;
  --fdl-muted:        #6b7280;
  --fdl-border:       #e5e7eb;
  --fdl-radius:       8px;
  --fdl-font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --fdl-transition:   .18s ease;
}

.fdl-app {
  font-family: var(--fdl-font);
  color: var(--fdl-text);
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 680px;
  border: 1px solid var(--fdl-border);
  border-radius: var(--fdl-radius);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
}

/* ── Top bar ── */
.fdl-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .4rem .75rem;
  background: #fff;
  border-bottom: 1px solid var(--fdl-border);
  gap: .75rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.fdl-topbar__dims {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: .78rem;
  color: var(--fdl-muted);
}
.fdl-dim-lbl { font-weight: 600; }
.fdl-dim-input {
  width: 44px;
  text-align: center;
  border: 1px solid var(--fdl-border);
  border-radius: 4px;
  padding: .18rem .25rem;
  font-size: .78rem;
  background: #f9fafb;
}
.fdl-topbar__title {
  font-weight: 700;
  font-size: .9rem;
  color: var(--fdl-text);
}
.fdl-topbar__actions { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }

.fdl-stbtn {
  padding: .28rem .65rem;
  border-radius: 4px;
  border: 1px solid var(--fdl-border);
  background: #fff;
  font-size: .75rem;
  cursor: pointer;
  color: var(--fdl-text);
  white-space: nowrap;
  transition: all var(--fdl-transition);
  font-family: var(--fdl-font);
}
.fdl-stbtn:hover       { background: var(--fdl-accent-light); }
.fdl-stbtn--del        { color: #dc2626; border-color: #fca5a5; }
.fdl-stbtn--del:hover  { background: #fef2f2; }
.fdl-stbtn--download   { background: var(--fdl-accent); color: #fff; border-color: var(--fdl-accent); font-weight: 600; }
.fdl-stbtn--download:hover { background: var(--fdl-accent-hover); }

/* ── Body ── */
.fdl-body {
  display: flex;
  flex: 1;
  min-height: 580px;
  background: #e5e7eb;
}

/* Icon strip */
.fdl-iconbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #1e1b4b;
  width: 62px;
  flex-shrink: 0;
  padding: .4rem 0;
  gap: .05rem;
  overflow-y: auto;
}
.fdl-sib {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .18rem;
  width: 100%;
  padding: .55rem .2rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.55);
  transition: all var(--fdl-transition);
  font-family: var(--fdl-font);
  flex-shrink: 0;
}
.fdl-sib:hover  { background: rgba(255,255,255,.1);  color: #fff; }
.fdl-sib.active { background: rgba(255,255,255,.15); color: #fff; }
.fdl-sib__icon  { font-size: 1.1rem; line-height: 1; display: block; }
.fdl-sib__label { font-size: .46rem; letter-spacing: .07em; text-transform: uppercase; line-height: 1; }

/* Sidebar panel */
.fdl-spanel {
  width: 210px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--fdl-border);
  overflow-y: auto;
  padding: .65rem .7rem;
}
.fdl-sp { display: none; }
.fdl-sp.active { display: block; }

.fdl-sp-label {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  color: var(--fdl-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .35rem;
}
.fdl-sp-hint {
  font-size: .72rem;
  color: var(--fdl-muted);
  margin-bottom: .5rem;
  line-height: 1.4;
}
.fdl-sp-divider { height: 1px; background: var(--fdl-border); margin: .65rem 0; }
.fdl-sp-select {
  width: 100%;
  padding: .3rem .4rem;
  border: 1px solid var(--fdl-border);
  border-radius: 4px;
  font-size: .78rem;
  margin-bottom: .45rem;
}
.fdl-sp-row {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .35rem;
}
.fdl-sp-row--fmt { gap: .25rem; }
.fdl-sp-num {
  width: 55px;
  padding: .22rem .35rem;
  border: 1px solid var(--fdl-border);
  border-radius: 4px;
  font-size: .78rem;
  text-align: center;
}
.fdl-fmt-btn {
  padding: .25rem .55rem;
  border: 1px solid var(--fdl-border);
  border-radius: 4px;
  background: #f9fafb;
  cursor: pointer;
  font-size: .85rem;
  transition: background var(--fdl-transition);
}
.fdl-fmt-btn:hover, .fdl-fmt-btn.active { background: var(--fdl-accent-light); border-color: var(--fdl-accent); }

/* Upload button */
.fdl-sp-upload-btn {
  display: block;
  width: 100%;
  padding: .55rem;
  background: var(--fdl-accent-light);
  border: 1px dashed var(--fdl-accent);
  border-radius: var(--fdl-radius);
  color: var(--fdl-accent);
  cursor: pointer;
  font-size: .82rem;
  text-align: center;
  transition: all var(--fdl-transition);
  margin-bottom: .45rem;
  font-family: var(--fdl-font);
}
.fdl-sp-upload-btn:hover { background: var(--fdl-accent); color: #fff; }

/* Text buttons */
.fdl-sp-text-h, .fdl-sp-text-b {
  display: block;
  width: 100%;
  padding: .5rem;
  background: #f9fafb;
  border: 1px solid var(--fdl-border);
  border-radius: var(--fdl-radius);
  cursor: pointer;
  text-align: center;
  margin-bottom: .35rem;
  transition: background var(--fdl-transition);
  font-family: var(--fdl-font);
}
.fdl-sp-text-h { font-size: .95rem; }
.fdl-sp-text-b { font-size: .78rem; }
.fdl-sp-text-h:hover, .fdl-sp-text-b:hover { background: var(--fdl-accent-light); }

/* Shape buttons */
.fdl-sp-shape {
  display: block;
  width: 100%;
  padding: .45rem .65rem;
  background: #f9fafb;
  border: 1px solid var(--fdl-border);
  border-radius: 4px;
  cursor: pointer;
  font-size: .82rem;
  text-align: left;
  margin-bottom: .3rem;
  transition: background var(--fdl-transition);
  font-family: var(--fdl-font);
}
.fdl-sp-shape:hover { background: var(--fdl-accent-light); }

/* Color swatches */
.fdl-color-swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .3rem;
  margin-bottom: .5rem;
}
.fdl-sw {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  border: 1px solid var(--fdl-border);
  cursor: pointer;
  transition: transform .15s;
}
.fdl-sw:hover { transform: scale(1.2); }
.fdl-sw.active { box-shadow: 0 0 0 2px var(--fdl-accent); }

/* Template grid */
.fdl-template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
  margin-bottom: .75rem;
}
.fdl-tmpl-card {
  border: 2px solid var(--fdl-border);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--fdl-transition);
}
.fdl-tmpl-card img {
  width: 100%;
  height: 60px;
  object-fit: cover;
  display: block;
}
.fdl-tmpl-card span {
  display: block;
  font-size: .65rem;
  padding: 2px 4px;
  color: var(--fdl-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fdl-tmpl-card:hover { border-color: var(--fdl-accent); }
.fdl-tmpl-card.active { border-color: var(--fdl-accent); box-shadow: 0 0 0 1px var(--fdl-accent); }
.fdl-tmpl-empty {
  grid-column: 1/-1;
  font-size: .75rem;
  color: var(--fdl-muted);
  text-align: center;
  padding: .75rem;
  background: #f9fafb;
  border-radius: 4px;
  line-height: 1.5;
}

/* Template clear button */
.fdl-tmpl-clear {
  display: block;
  width: 100%;
  margin-top: .35rem;
  padding: .3rem;
  font-size: .7rem;
  color: #dc2626;
  background: none;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--fdl-font);
}
.fdl-tmpl-clear:hover { background: #fef2f2; }

/* Layers */
.fdl-layers-list { min-height: 60px; }

/* Canvas area */
.fdl-canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1.75rem 1rem 1.25rem 1.75rem;
  position: relative;
  overflow: auto;
  background: #e5e7eb;
}

/* Inch rulers */
.fdlp-ruler-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  background: #b8b8b8;
  pointer-events: none;
  z-index: 4;
  border-right: 1px solid #a0a0a0;
  border-bottom: 1px solid #a0a0a0;
}
.fdlp-ruler-h,
.fdlp-ruler-v {
  position: absolute;
  display: block;
  pointer-events: none;
  z-index: 4;
}
.fdlp-ruler-h { height: 20px; border-bottom: 1px solid #a0a0a0; }
.fdlp-ruler-v { width:  20px; border-right:  1px solid #a0a0a0; }

.fdl-dpi-badge {
  font-size: .68rem;
  color: rgba(255,255,255,.85);
  background: rgba(0,0,0,.38);
  padding: .18rem .6rem;
  border-radius: 20px;
  margin-top: .5rem;
  font-family: monospace;
  letter-spacing: .04em;
}
.fdl-canvas-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(229,231,235,.8);
  font-size: .85rem;
  color: var(--fdl-muted);
  gap: .4rem;
  z-index: 5;
}
.fdl-spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--fdl-border);
  border-top-color: var(--fdl-accent);
  border-radius: 50%;
  display: inline-block;
  animation: fdl-spin .7s linear infinite;
}
@keyframes fdl-spin { to { transform: rotate(360deg); } }

/* Right panel */
.fdl-right {
  width: 200px;
  flex-shrink: 0;
  background: #fff;
  border-left: 1px solid var(--fdl-border);
  padding: .75rem .65rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  overflow-y: auto;
}
.fdl-right__header {
  font-size: .8rem;
  font-weight: 700;
  padding-bottom: .45rem;
  border-bottom: 1px solid var(--fdl-border);
}
.fdl-right__section { overflow: visible; }
.fdl-right__color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .78rem;
  margin-bottom: .35rem;
}
.fdl-right__swatch {
  width: 22px; height: 22px;
  border-radius: 4px;
  border: 1px solid var(--fdl-border);
}
.fdl-btn-download {
  display: block;
  width: 100%;
  padding: .65rem .5rem;
  background: var(--fdl-accent);
  color: #fff;
  border: none;
  border-radius: var(--fdl-radius);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
  transition: background var(--fdl-transition);
  font-family: var(--fdl-font);
}
.fdl-btn-download:hover { background: var(--fdl-accent-hover); }
.fdl-right__note {
  font-size: .65rem;
  color: var(--fdl-muted);
  line-height: 1.4;
  margin: 0;
}
.fdl-right__download { margin-top: auto; }

/* ── CSS 3D open-folder viewer ── */
.fdlp-3d-scene {
  perspective: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: .75rem .5rem .35rem;
  background: linear-gradient(160deg, #cdd4de 0%, #d8dde6 50%, #c8cfd8 100%);
  border-radius: 8px;
  cursor: grab;
  overflow: hidden;
  position: relative;
}
.fdlp-3d-scene:active { cursor: grabbing; }

.fdlp-folder-outer {
  transform-style: preserve-3d;
  position: relative;
  /* NOTE: filter:drop-shadow() on a preserve-3d element flattens all child
     3D transforms and breaks backface-visibility — do NOT add filter here.
     Shadow is handled by .fdlp-folder-shadow below instead. */
}

.fdlp-folder-shadow {
  position: absolute;
  bottom: -22px;
  height: 18px;
  background: radial-gradient(ellipse, rgba(0,0,0,.42) 0%, rgba(0,0,0,.18) 45%, transparent 75%);
  border-radius: 50%;
  pointer-events: none;
  filter: blur(5px);
}

.fdlp-open-book {
  display: flex;
  align-items: flex-start;
  transform-style: preserve-3d;
  position: relative;
}

.fdlp-book-panel {
  position: relative;
  transform-style: preserve-3d;
  flex-shrink: 0;
}

.fdlp-face-inside {
  position: absolute;
  inset: 0;
  transform: translateZ(0.5px);
  /* No border — inner edges would create a visible seam at the fold */
  backface-visibility: hidden;
}

.fdlp-face-outside {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg) translateZ(0.5px);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  /* No border — inner edges would create a visible seam at the fold */
  backface-visibility: hidden;
  overflow: hidden;
}

/* Subtle bow/curve — base overlay on both outside faces */
.fdlp-face-outside::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom,
      rgba(255,255,255,.06) 0%,
      transparent 30%,
      rgba(0,0,0,.04) 65%,
      rgba(0,0,0,.12) 100%);
  pointer-events: none;
  border-radius: inherit;
}

/*
 * Directional curve per panel:
 *  Left panel  — spine is on the RIGHT edge, so darken toward the right
 *  Right panel — spine is on the LEFT  edge, so darken toward the left
 * Combined with a highlight off-center toward the outer edge this
 * makes each panel look slightly convex / bowed like real card stock.
 */
#fdu-po-left::after {
  background:
    /* highlight off-center, biased toward outer (left) edge */
    radial-gradient(ellipse 75% 65% at 35% 32%,
      rgba(255,255,255,.26) 0%,
      rgba(255,255,255,.08) 40%,
      transparent 68%),
    /* horizontal: lighter outer edge → darker spine edge */
    linear-gradient(to right,
      rgba(255,255,255,.05)  0%,
      transparent            45%,
      rgba(0,0,0,.07)        78%,
      rgba(0,0,0,.18)        100%),
    /* vertical depth */
    linear-gradient(to bottom,
      rgba(255,255,255,.06) 0%,
      transparent 30%,
      rgba(0,0,0,.04) 65%,
      rgba(0,0,0,.12) 100%);
}

#fdu-po-right::after {
  background:
    /* highlight off-center, biased toward outer (right) edge */
    radial-gradient(ellipse 75% 65% at 65% 32%,
      rgba(255,255,255,.26) 0%,
      rgba(255,255,255,.08) 40%,
      transparent 68%),
    /* horizontal: lighter outer edge → darker spine edge */
    linear-gradient(to left,
      rgba(255,255,255,.05)  0%,
      transparent            45%,
      rgba(0,0,0,.07)        78%,
      rgba(0,0,0,.18)        100%),
    /* vertical depth */
    linear-gradient(to bottom,
      rgba(255,255,255,.06) 0%,
      transparent 30%,
      rgba(0,0,0,.04) 65%,
      rgba(0,0,0,.12) 100%);
}

.fdlp-edge-top {
  position: absolute;
  top: -2px; left: 0; right: 0;
  height: 2px;  /* 2px = visible cardstock depth without creating obvious bands */
  transform: rotateX(90deg) translateZ(1px);
  transform-origin: top center;
}
.fdlp-edge-bot {
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 2px;
  transform: rotateX(-90deg) translateZ(1px);
  transform-origin: bottom center;
}

.fdlp-book-spine {
  flex-shrink: 0;
  transform-style: preserve-3d;
}

.fdlp-3d-hint {
  font-size: .6rem;
  color: rgba(0,0,0,.35);
  margin-top: .4rem;
  text-align: center;
  letter-spacing: .01em;
  pointer-events: none;
  flex-shrink: 0;
}

/* Style picker cards */
.fdlp-style-grid {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin-bottom: .5rem;
}

.fdlp-style-card {
  border: 2px solid var(--fdl-border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--fdl-transition), box-shadow var(--fdl-transition);
  background: #fff;
  padding: .4rem;
}
.fdlp-style-card:hover  { border-color: var(--fdl-accent); }
.fdlp-style-card.active { border-color: var(--fdl-accent); box-shadow: 0 0 0 2px var(--fdl-accent); }

.fdlp-style-thumb {
  width: 100%;
  display: block;
  margin-bottom: .3rem;
  border-radius: 4px;
  overflow: hidden;
}
.fdlp-style-thumb svg { display: block; width: 100%; height: auto; }

.fdlp-style-name {
  font-size: .76rem;
  font-weight: 700;
  color: var(--fdl-text);
  margin-bottom: .1rem;
}
.fdlp-style-desc {
  font-size: .65rem;
  color: var(--fdl-muted);
  line-height: 1.3;
}

/* ── Resolution tip in sidebar ── */
.fds-res-tip {
  font-size: .7rem;
  line-height: 1.5;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: .45rem .55rem;
  color: #78350f;
  margin-top: .25rem;
}

/* ── Low-DPI toast ── */
.fdu-dpi-toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  padding: .28rem .85rem;
  font-size: .72rem;
  color: #92400e;
  font-weight: 600;
  flex-shrink: 0;
  animation: fdu-slide-in .25s ease;
}
@keyframes fdu-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Warning Modal ── */
.fdu-warn-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}

.fdu-warn-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
}

.fdu-warn-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid #fee2e2;
  background: #fef2f2;
  border-radius: 12px 12px 0 0;
  flex-shrink: 0;
}
.fdu-warn-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  color: #dc2626;
}
.fdu-warn-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #991b1b;
  line-height: 1.3;
  margin: 0;
}

.fdu-warn-body {
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
  overflow-y: auto;
}

.fdu-warn-item {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .75rem;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}
.fdu-warn-item--alert {
  background: #fffbeb;
  border-color: #fde68a;
}
.fdu-warn-item-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1.4;
  width: 28px;
  text-align: center;
}
.fdu-warn-item strong {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: .3rem;
}
.fdu-warn-item p {
  font-size: .77rem;
  color: #4b5563;
  line-height: 1.5;
  margin: 0;
}

.fdu-checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.fdu-checklist li {
  font-size: .77rem;
  color: #4b5563;
  line-height: 1.4;
  padding-left: 1.2rem;
  position: relative;
}
.fdu-checklist li::before {
  content: '☐';
  position: absolute;
  left: 0;
  color: #6b7280;
}

.fdu-warn-footer {
  display: flex;
  gap: .75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.fdu-warn-btn {
  padding: .6rem 1.1rem;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  font-family: var(--fdl-font);
  white-space: nowrap;
}
.fdu-warn-btn--cancel {
  background: #fff;
  border: 1px solid #d1d5db;
  color: #374151;
}
.fdu-warn-btn--cancel:hover { background: #f9fafb; }
.fdu-warn-btn--confirm {
  background: #1e40af;
  border: 1px solid #1e40af;
  color: #fff;
}
.fdu-warn-btn--confirm:hover { background: #1e3a8a; }

/* ── Order panel (bottom dark bar) ── */
#fdu-order-panel {
  background: #1e293b;
  color: #f1f5f9;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  border-top: 3px solid #334155;
  flex-shrink: 0;
}

#fdu-order-panel select,
#fdu-order-panel input[type="number"],
#fdu-order-panel input[type="text"] {
  width: 100%;
  padding: .45rem .6rem;
  border-radius: 5px;
  border: 1px solid #475569;
  background: #0f172a;
  color: #f1f5f9;
  font-size: .85rem;
  font-family: var(--fdl-font);
}

#fdu-atc-btn {
  width: 100%;
  padding: .6rem 1rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  font-family: var(--fdl-font);
}
#fdu-atc-btn:hover:not(:disabled) { background: #1d4ed8; }
#fdu-atc-btn:disabled { opacity: .55; cursor: not-allowed; }

/* Mobile */
@media (max-width: 760px) {
  .fdl-body    { flex-wrap: wrap; min-height: auto; }
  .fdl-iconbar { flex-direction: row; width: 100%; height: auto; overflow-x: auto; }
  .fdl-spanel, .fdl-right { width: 100%; }
  .fdl-canvas-area { min-height: 280px; padding: 1.25rem .5rem .75rem 1.25rem; }
  .fdu-warn-footer { justify-content: stretch; }
  .fdu-warn-btn { flex: 1; text-align: center; }
  #fdu-order-panel > div { min-width: 140px !important; }
}

[hidden] { display: none !important; }

/* ============================================================
   Light Grey Studio Theme
   ============================================================ */

/* Unified grey background for all panels */
.fdl-topbar      { background: #dde1e8; border-bottom-color: #c4cad4; }
.fdl-body        { background: #dde1e8; }
.fdl-canvas-area { background: #dde1e8; }
.fdl-spanel      { background: #dde1e8; border-right-color: #c4cad4; }
.fdl-right       { background: #dde1e8; border-left-color:  #c4cad4; }
.fdl-right__header { border-bottom-color: #c4cad4; }
.fdl-right__swatch { border-color: #c4cad4; }

/* Buttons sit on white card so they pop against the grey */
.fdl-stbtn { background: #fff; border-color: #c4cad4; }
.fdl-stbtn:hover { background: #cdd2db; }
.fdl-dim-input { background: #fff; border-color: #c4cad4; }

.fdl-sp-shape,
.fdl-sp-text-h,
.fdl-sp-text-b  { background: #fff; border-color: #c4cad4; }
.fdl-fmt-btn    { background: #fff; border-color: #c4cad4; }
.fdl-sp-select,
.fdl-sp-num     { background: #fff; border-color: #c4cad4; }

.fdlp-style-card { background: #fff; }
.fdl-tmpl-empty  { background: #fff; }

/* ============================================================
   Canvas Zoom Controls
   ============================================================ */

.fdu-zoom-group {
  display: flex;
  align-items: center;
  gap: .18rem;
}

.fdu-zoom-lbl {
  font-size: .68rem;
  font-weight: 600;
  color: var(--fdl-muted);
  margin-right: .08rem;
  white-space: nowrap;
}

.fdu-zoom-btn {
  padding: .24rem .52rem;
  background: #fff;
  border: 1px solid var(--fdl-border);
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--fdl-muted);
  font-family: var(--fdl-font);
  transition: all .15s;
  white-space: nowrap;
  line-height: 1.4;
}
.fdu-zoom-btn:hover {
  background: var(--fdl-accent-light);
  border-color: var(--fdl-accent);
  color: var(--fdl-accent);
}
.fdu-zoom-btn.active {
  background: var(--fdl-accent);
  border-color: var(--fdl-accent);
  color: #fff;
}

/* ============================================================
   Dieline Toggle Button
   ============================================================ */

.fdu-dieline-btn {
  padding: .24rem .62rem;
  background: #fff;
  border: 1px solid var(--fdl-border);
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--fdl-muted);
  font-family: var(--fdl-font);
  transition: all .15s;
  white-space: nowrap;
  line-height: 1.4;
}
.fdu-dieline-btn:hover {
  background: var(--fdl-accent-light);
  border-color: var(--fdl-accent);
  color: var(--fdl-accent);
}
.fdu-dieline-btn.dl-on {
  background: #ecfdf5;
  border-color: #10b981;
  color: #059669;
}
.fdu-dieline-btn.dl-off {
  background: #fff;
  border-color: var(--fdl-border);
  color: var(--fdl-muted);
}

/* ============================================================
   v1.0.9 — Taller designer + Enlarge dialog
   ============================================================ */

/* Designer fills more of the viewport by default */
.fdl-app {
  min-height: 80vh;
}
.fdl-body {
  min-height: 0;
  flex: 1;
}

/* Version label — confirms which version is loaded */
.fdu-version-lbl {
  font-size: .58rem;
  font-weight: 700;
  color: #888fa0;
  background: #fff;
  border: 1px solid #c4cad4;
  border-radius: 3px;
  padding: .1rem .35rem;
  letter-spacing: .03em;
  white-space: nowrap;
}

/* Keep topbar always visible — never scrolls away */
.fdl-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
}

/* Enlarge Designer button — green pill in topbar */
.fdu-enlarge-btn {
  padding: .28rem .78rem;
  background: #22c55e;
  border: 1px solid #16a34a;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  font-family: var(--fdl-font);
  transition: background .15s;
  white-space: nowrap;
  line-height: 1.4;
}
.fdu-enlarge-btn:hover { background: #16a34a; }

/* ── Native <dialog> popup (browser top-layer — nothing can bleed through) ── */
dialog.fdu-enlarge-dlg {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: #dde1e8 !important;
  overflow: hidden !important;
}
dialog.fdu-enlarge-dlg::backdrop {
  background: rgba(0,0,0,.65);
}

/* App fills the dialog completely */
dialog.fdu-enlarge-dlg #fdu-app {
  width: 100% !important;
  height: 100dvh !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  overflow: hidden !important;
  background: #dde1e8 !important;
}

/* Close button floats over top-right corner of the designer */
.fdu-lg-close {
  position: absolute;
  top: .55rem;
  right: .65rem;
  z-index: 9999;
  padding: .38rem .9rem;
  background: rgba(255,255,255,.96);
  border: 1px solid #dce1ea;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  color: #111827;
  font-family: var(--fdl-font);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  white-space: nowrap;
  transition: all .15s;
  line-height: 1.4;
}
.fdu-lg-close:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

/* Hint shown only when designer is inside the Enlarge dialog */
.fdu-dlg-hint {
  display: none;
  font-size: .65rem;
  color: #6b7280;
  text-align: center;
  margin-top: .5rem;
  padding: .32rem .55rem;
  background: #fff;
  border: 1px solid #dce1ea;
  border-radius: 5px;
  line-height: 1.4;
}
dialog.fdu-enlarge-dlg .fdu-dlg-hint {
  display: block;
}

/* ============================================================
   v2.3.0 — 3D Fold Controls + Enlarged 3D Dialog
   ============================================================ */

/* Controls bar below the 3D scene in the right panel */
.fdu-3d-controls {
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: .3rem .25rem .15rem;
  flex-shrink: 0;
}

.fdu-3d-ctrl-btn {
  padding: .2rem .4rem;
  background: #fff;
  border: 1px solid #c4cad4;
  border-radius: 5px;
  font-size: .62rem;
  font-weight: 700;
  cursor: pointer;
  color: #374151;
  white-space: nowrap;
  font-family: var(--fdl-font);
  line-height: 1.4;
  transition: all .15s;
  flex-shrink: 0;
}
.fdu-3d-ctrl-btn:hover {
  background: var(--fdl-accent-light);
  border-color: var(--fdl-accent);
  color: var(--fdl-accent);
}
.fdu-3d-enlarge-btn {
  background: #1e40af;
  border-color: #1e40af;
  color: #fff;
}
.fdu-3d-enlarge-btn:hover {
  background: #1e3a8a !important;
  border-color: #1e3a8a !important;
  color: #fff !important;
}

/* ── Enlarged 3D view — PORTAL approach ─────────────────────────────────────
 * #fdu-3d-portal is created by JS and appended directly to <body>.
 * This bypasses every WordPress stacking context / transform that would
 * prevent position:fixed from working correctly inside the normal DOM tree.
 * ─────────────────────────────────────────────────────────────────────────── */

/* Portal container — direct child of <body>, invisible until opened */
#fdu-3d-portal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: #1a1f2e;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
#fdu-3d-portal.fdu-portal-open {
  display: flex;
}

/* Scene inside the portal — sized to fill the dark bg nicely */
#fdu-3d-portal #fdu-3d-scene {
  width: min(88vw, 84vh) !important;
  height: min(88vw, 84vh) !important;
  min-height: unset !important;
  max-width: none !important;
  border-radius: 12px !important;
  position: relative !important;
}

/* Controls bar floats as overlay at the bottom when inside portal */
#fdu-3d-portal .fdu-3d-controls {
  position: absolute !important;
  bottom: 1.1rem !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  background: rgba(0,0,0,.45) !important;
  border-radius: 8px !important;
  padding: .42rem .65rem !important;
  white-space: nowrap !important;
  z-index: 10 !important;
  gap: .3rem !important;
}
#fdu-3d-portal .fdu-3d-ctrl-btn {
  background: rgba(255,255,255,.12) !important;
  border-color: rgba(255,255,255,.22) !important;
  color: #fff !important;
}
#fdu-3d-portal .fdu-3d-ctrl-btn:hover {
  background: rgba(255,255,255,.25) !important;
  border-color: rgba(255,255,255,.45) !important;
}
/* Enlarge button hides inside portal (can't enlarge what's already fullscreen) */
#fdu-3d-portal .fdu-3d-enlarge-btn {
  display: none !important;
}
/* Exit button: hidden in normal panel, shown inside portal */
.fdu-3d-exit-btn {
  display: none;
}
#fdu-3d-portal .fdu-3d-exit-btn {
  display: inline-block !important;
  background: rgba(220,38,38,.7) !important;
  border-color: rgba(220,38,38,.9) !important;
  color: #fff !important;
}
#fdu-3d-portal .fdu-3d-exit-btn:hover {
  background: rgba(185,28,28,.85) !important;
}

/* Dim hint text in portal */
#fdu-3d-portal .fdlp-3d-hint {
  color: rgba(255,255,255,.3) !important;
}
