/**
 * DFF Customizer Customer Frontend Stylesheet
 * Strict DFF Blue Design System
 */

:root {
  --dff-blue-50: #eff6ff;
  --dff-blue-100: #dbeafe;
  --dff-blue-200: #bfdbfe;
  --dff-blue-500: #3b82f6;
  --dff-blue-600: #2563eb;
  --dff-blue-700: #1d4ed8;
  --dff-blue-800: #1e40af;
  --dff-blue-900: #1e3a8a;
  --dff-gray-50: #f8fafc;
  --dff-gray-100: #f1f5f9;
  --dff-gray-200: #e2e8f0;
  --dff-gray-300: #cbd5e1;
  --dff-gray-400: #94a3b8;
  --dff-gray-500: #64748b;
  --dff-gray-600: #475569;
  --dff-gray-700: #334155;
  --dff-gray-800: #1e293b;
  --dff-gray-900: #0f172a;
}

/* THE ONE DFF BLUE CUSTOMIZE BUTTON (NO GREEN BUTTON) */
.dffc-button-wrapper {
  margin: 14px 0 16px;
  clear: both;
}

.dffc-btn-customize {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--dff-blue-800) 0%, var(--dff-blue-600) 100%) !important;
  color: #ffffff !important;
  font-family: inherit;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  padding: 14px 28px !important;
  border: 1px solid var(--dff-blue-700) !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  text-decoration: none !important;
  outline: none;
}

.dffc-btn-customize:hover {
  background: linear-gradient(135deg, var(--dff-blue-900) 0%, var(--dff-blue-700) 100%) !important;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.38) !important;
  transform: translateY(-2px);
  color: #ffffff !important;
}

.dffc-btn-customize:focus-visible {
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.5) !important;
}

.dffc-btn-customize .dffc-icon {
  stroke: #ffffff;
  transition: transform 0.2s ease;
}

.dffc-btn-customize:hover .dffc-icon {
  transform: rotate(-8deg) scale(1.1);
}

/* MODAL OVERLAY & CONTAINER */
.dffc-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  animation: dffc-fade-in 0.2s ease;
}

@keyframes dffc-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.dffc-modal-container {
  background: #ffffff;
  width: 100%;
  max-width: 1300px;
  height: 92vh;
  max-height: 900px;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--dff-gray-900);
}

/* MODAL HEADER */
.dffc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--dff-gray-200);
  background: #ffffff;
  gap: 16px;
  flex-shrink: 0;
}

.dffc-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dffc-header-badge {
  background: linear-gradient(135deg, var(--dff-blue-800), var(--dff-blue-600));
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.dffc-header-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--dff-gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
}

/* SIDE SWITCHER (FRONT / BACK) */
.dffc-side-switcher {
  display: flex;
  background: var(--dff-gray-100);
  padding: 4px;
  border-radius: 10px;
  gap: 4px;
}

.dffc-side-tab {
  padding: 7px 20px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--dff-gray-600);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dffc-side-tab.active {
  background: var(--dff-blue-600);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.dffc-modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: var(--dff-gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.dffc-modal-close:hover {
  background: var(--dff-gray-100);
  color: var(--dff-gray-900);
}

/* MODAL BODY */
.dffc-modal-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

/* DESKTOP LEFT CONTROL PANEL */
.dffc-controls-panel {
  width: 380px;
  border-right: 1px solid var(--dff-gray-200);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  flex-shrink: 0;
  overflow: hidden;
}

.dffc-tool-tabs {
  display: flex;
  border-bottom: 1px solid var(--dff-gray-200);
  background: var(--dff-gray-50);
}

.dffc-tool-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 8px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--dff-gray-600);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dffc-tool-tab.active {
  background: #ffffff;
  color: var(--dff-blue-600);
  border-bottom-color: var(--dff-blue-600);
}

.dffc-tab-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.dffc-tab-pane.active {
  display: block;
}

/* FORM STYLES */
.dffc-form-group {
  margin-bottom: 16px;
}

.dffc-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--dff-gray-700);
  margin-bottom: 6px;
}

.dffc-label-sub {
  font-size: 12px;
  color: var(--dff-gray-600);
  font-weight: 500;
}

.dffc-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--dff-gray-300);
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}

.dffc-input:focus {
  border-color: var(--dff-blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.dffc-input-btn-group {
  display: flex;
  gap: 8px;
}

.dffc-btn-secondary {
  padding: 9px 16px;
  background: var(--dff-blue-50);
  color: var(--dff-blue-700);
  border: 1px solid var(--dff-blue-200);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.dffc-btn-secondary:hover {
  background: var(--dff-blue-600);
  color: #ffffff;
  border-color: var(--dff-blue-600);
}

.dffc-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--dff-gray-300);
  border-radius: 8px;
  font-size: 14px;
  background-color: #ffffff;
  box-sizing: border-box;
}

.dffc-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--dff-gray-500);
  margin: 16px 0 10px;
  border-bottom: 1px solid var(--dff-gray-100);
  padding-bottom: 4px;
}

.dffc-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dffc-slider {
  width: 100%;
  accent-color: var(--dff-blue-600);
}

/* PALETTE */
.dffc-palette-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.dffc-palette-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.15s ease;
}

.dffc-palette-swatch:hover {
  transform: scale(1.15);
}

.dffc-palette-swatch.active {
  border-color: var(--dff-blue-600);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.4);
}

.dffc-color-custom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.dffc-color-picker-input {
  width: 36px;
  height: 28px;
  border: none;
  background: none;
  cursor: pointer;
}

/* FORMAT TOOLBAR */
.dffc-format-toolbar {
  display: flex;
  align-items: center;
  background: var(--dff-gray-100);
  padding: 4px;
  border-radius: 8px;
  gap: 4px;
}

.dffc-tool-icon-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  color: var(--dff-gray-700);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dffc-tool-icon-btn:hover {
  background: #ffffff;
}

.dffc-tool-icon-btn.active {
  background: #ffffff;
  color: var(--dff-blue-600);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.dffc-tool-separator {
  width: 1px;
  height: 18px;
  background: var(--dff-gray-300);
  margin: 0 2px;
}

/* UPLOAD DROPZONE */
.dffc-upload-dropzone {
  border: 2px dashed var(--dff-blue-200);
  background: var(--dff-blue-50);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dffc-upload-dropzone:hover,
.dffc-upload-dropzone.dragover {
  border-color: var(--dff-blue-600);
  background: #dbeafe;
}

.dffc-upload-title {
  margin: 10px 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--dff-gray-800);
}

.dffc-upload-sub {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--dff-gray-600);
}

.dffc-upload-limits {
  margin: 0;
  font-size: 11px;
  color: var(--dff-gray-500);
}

.dffc-upload-progress {
  margin-top: 14px;
  text-align: center;
}

.dffc-progress-bar {
  height: 6px;
  background: var(--dff-gray-200);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.dffc-progress-fill {
  width: 40%;
  height: 100%;
  background: var(--dff-blue-600);
  animation: dffc-progress-anim 1s infinite linear;
}

@keyframes dffc-progress-anim {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

.dffc-progress-text {
  font-size: 12px;
  color: var(--dff-blue-700);
  font-weight: 600;
}

/* LAYERS LIST */
.dffc-layers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.dffc-layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--dff-gray-50);
  border: 1px solid var(--dff-gray-200);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dffc-layer-item:hover {
  background: var(--dff-gray-100);
}

.dffc-layer-item.active {
  border-color: var(--dff-blue-600);
  background: var(--dff-blue-50);
}

.dffc-layer-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--dff-gray-800);
}

.dffc-layer-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.dffc-btn-layer-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid var(--dff-gray-300);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.dffc-btn-layer-action:hover {
  background: var(--dff-gray-50);
}

.dffc-btn-layer-action.text-danger {
  color: #dc2626;
  border-color: #fca5a5;
}

.dffc-btn-layer-action.text-danger:hover {
  background: #fef2f2;
}

/* HISTORY / RESET BAR */
.dffc-history-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--dff-gray-200);
  background: var(--dff-gray-50);
}

.dffc-btn-group-sm {
  display: flex;
  gap: 6px;
}

.dffc-history-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid var(--dff-gray-300);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--dff-gray-700);
}

.dffc-history-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dffc-reset-dropdown-wrap {
  position: relative;
}

.dffc-reset-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 6px;
  background: #ffffff;
  border: 1px solid var(--dff-gray-200);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  min-width: 160px;
  z-index: 100;
  overflow: hidden;
}

.dffc-reset-menu button {
  padding: 10px 14px;
  text-align: left;
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--dff-gray-700);
}

.dffc-reset-menu button:hover {
  background: var(--dff-gray-50);
}

.dffc-reset-menu button.text-danger {
  color: #dc2626;
}

/* RIGHT PREVIEW WORKSPACE */
.dffc-preview-workspace {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
  position: relative;
  overflow: hidden;
}

.dffc-canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--dff-gray-200);
  z-index: 10;
}

.dffc-zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dffc-canvas-tool-btn {
  padding: 4px 10px;
  background: #ffffff;
  border: 1px solid var(--dff-gray-300);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.dffc-zoom-val {
  font-size: 12px;
  font-weight: 600;
  min-width: 44px;
  text-align: center;
  color: var(--dff-gray-700);
}

.dffc-view-indicator-pill {
  display: flex;
  align-items: center;
  gap: 8px;
}

#dffc-current-view-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--dff-gray-800);
}

.dffc-printable-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--dff-blue-50);
  color: var(--dff-blue-700);
  border: 1px solid var(--dff-blue-200);
  padding: 2px 8px;
  border-radius: 12px;
}

/* STAGE VIEWPORT */
.dffc-stage-viewport {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  padding: 12px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  touch-action: none;
  user-select: none;
}

.dffc-stage-canvas-wrap {
  position: relative;
  display: inline-block;
  width: fit-content;
  height: fit-content;
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  transition: transform 0.1s ease-out;
}

.dffc-base-product-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(58vh, 620px);
  object-fit: contain;
  object-position: center center;
  pointer-events: none;
}

.dffc-missing-notice {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(248, 250, 252, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}

.dffc-missing-card h4 {
  margin: 10px 0 6px;
  color: #e11d48;
}

.dffc-missing-card p {
  color: var(--dff-gray-600);
  font-size: 13px;
}

/* SELLER DEFINED PRINT AREA BOUNDARY */
.dffc-print-area-boundary {
  position: absolute;
  border: 1px dashed rgba(37, 99, 235, 0.6);
  background: rgba(37, 99, 235, 0.03);
  box-sizing: border-box;
  overflow: hidden; /* STRICT CONSTRAINT: layers cannot render outside print zone */
}

.dffc-print-area-tag {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: rgba(37, 99, 235, 0.7);
  pointer-events: none;
  text-transform: uppercase;
}

.dffc-layers-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* INTERACTIVE LAYER ELEMENT ON PREVIEW */
.dffc-canvas-layer {
  position: absolute;
  cursor: move;
  user-select: none;
  touch-action: none;
  transform-origin: center center;
  box-sizing: border-box;
}

.dffc-canvas-layer.selected {
  outline: 1.5px solid var(--dff-blue-600);
}

.dffc-canvas-layer-text {
  white-space: pre-wrap;
  line-height: 1.15;
  user-select: none;
}

.dffc-canvas-layer-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* LAYER TRANSFORM HANDLES */
.dffc-layer-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border: 1.5px solid var(--dff-blue-600);
  border-radius: 50%;
  box-sizing: border-box;
  z-index: 50;
}

.dffc-handle-rot {
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dff-blue-600);
  cursor: grab;
}

.dffc-handle-se {
  bottom: -5px;
  right: -5px;
  cursor: nwse-resize;
}

/* TOAST */
.dffc-toast {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dff-gray-900);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  z-index: 100;
  animation: dffc-toast-in 0.2s ease;
}

@keyframes dffc-toast-in {
  from { transform: translate(-50%, 10px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* MODAL FOOTER */
.dffc-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--dff-gray-200);
  background: #ffffff;
  flex-shrink: 0;
  gap: 16px;
}

.dffc-footer-left,
.dffc-footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dffc-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--dff-gray-300);
  background: #ffffff;
  color: var(--dff-gray-700);
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dffc-btn-outline:hover {
  background: var(--dff-gray-50);
  border-color: var(--dff-gray-400);
}

.dffc-qty-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dffc-label-qty {
  font-size: 13px;
  font-weight: 600;
  color: var(--dff-gray-700);
}

.dffc-input-qty {
  width: 55px;
  padding: 8px;
  border: 1px solid var(--dff-gray-300);
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

/* ADD TO CART BUTTON (DFF BLUE GRADIENT) */
.dffc-btn-primary-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--dff-blue-800) 0%, var(--dff-blue-600) 100%);
  color: #ffffff;
  border: none;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 13px 28px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
}

.dffc-btn-primary-add:hover {
  background: linear-gradient(135deg, var(--dff-blue-900) 0%, var(--dff-blue-700) 100%);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.dffc-btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: dffc-spin 0.7s linear infinite;
}

/* RESPONSIVE DESIGN (MOBILE & TABLET) */
@media (max-width: 900px) {
  .dffc-modal-overlay {
    padding: 0;
  }

  .dffc-modal-container {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .dffc-modal-body {
    flex-direction: column-reverse;
  }

  .dffc-controls-panel {
    width: 100%;
    height: 50vh;
    border-right: none;
    border-top: 1px solid var(--dff-gray-200);
  }

  .dffc-preview-workspace {
    height: 40vh;
    min-height: 0;
    flex: 0 0 40vh;
  }

  .dffc-stage-viewport {
    min-height: 0;
    padding: 8px;
  }

  .dffc-base-product-img {
    max-height: 32vh;
    max-width: 100%;
  }

  .dffc-header-title {
    max-width: 180px;
  }

  .dffc-modal-footer {
    padding: 10px 16px;
  }

  .dffc-btn-outline span {
    display: none;
  }
}


/* v1.0.2: resilient stage sizing against theme/global CSS overrides */
#dffc-modal-overlay .dffc-modal-container { width: min(96vw, 1400px) !important; height: min(94vh, 1000px) !important; max-width: 1400px !important; max-height: 94vh !important; }
#dffc-modal-overlay .dffc-modal-body { display: flex !important; flex-direction: row !important; flex: 1 1 0 !important; min-height: 0 !important; height: auto !important; overflow: hidden !important; }
#dffc-modal-overlay .dffc-controls-panel { flex: 0 0 340px !important; width: 340px !important; min-height: 0 !important; max-height: 100% !important; }
#dffc-modal-overlay .dffc-preview-workspace { display: flex !important; flex: 1 1 0 !important; width: auto !important; height: auto !important; min-width: 0 !important; min-height: 0 !important; max-height: 100% !important; overflow: hidden !important; }
#dffc-modal-overlay .dffc-stage-viewport { display: flex !important; flex: 1 1 0 !important; width: 100% !important; height: auto !important; min-width: 0 !important; min-height: 0 !important; padding: 12px !important; align-items: center !important; justify-content: center !important; overflow: hidden !important; box-sizing: border-box !important; }
#dffc-modal-overlay .dffc-stage-canvas-wrap { display: block !important; flex: 0 1 auto !important; width: max-content !important; height: max-content !important; max-width: 100% !important; max-height: 100% !important; margin: auto !important; }
#dffc-modal-overlay #dffc-base-product-img { display: block; width: auto !important; height: auto !important; max-width: 100% !important; max-height: min(62vh, 680px) !important; object-fit: contain !important; object-position: center center !important; margin: auto !important; }
#dffc-modal-overlay #dffc-print-area-boundary { box-sizing: border-box !important; }
@media (max-width: 900px) {
  #dffc-modal-overlay .dffc-modal-container { width: 100vw !important; height: 100dvh !important; max-height: 100dvh !important; border-radius: 0 !important; }
  #dffc-modal-overlay .dffc-modal-body { flex-direction: column !important; }
  #dffc-modal-overlay .dffc-preview-workspace { order: 0 !important; flex: 0 0 38vh !important; width: 100% !important; height: 38vh !important; min-height: 190px !important; }
  #dffc-modal-overlay .dffc-controls-panel { order: 1 !important; flex: 1 1 0 !important; width: 100% !important; height: auto !important; max-height: none !important; min-height: 0 !important; border-right: 0 !important; border-top: 1px solid #e5e7eb !important; }
  #dffc-modal-overlay #dffc-base-product-img { max-height: 32vh !important; max-width: 100% !important; }
}


/* v1.0.4: true full-screen workstation, reliable full-size stage, compact actions above preview */
#dffc-modal-overlay {
  position: fixed !important; inset: 0 !important; width: 100vw !important; height: 100vh !important;
  padding: 0 !important; margin: 0 !important; align-items: stretch !important; justify-content: stretch !important;
  overflow: hidden !important; z-index: 2147483000 !important;
}
#dffc-modal-overlay .dffc-modal-container {
  position: relative !important; display: flex !important; flex-direction: column !important;
  width: 100vw !important; max-width: none !important; min-width: 0 !important;
  height: 100vh !important; max-height: none !important; min-height: 0 !important;
  margin: 0 !important; border-radius: 0 !important; overflow: hidden !important;
}
#dffc-modal-overlay .dffc-modal-header { flex: 0 0 auto !important; min-height: 58px !important; padding: 8px 18px !important; }
#dffc-modal-overlay .dffc-modal-body { flex: 1 1 0 !important; min-height: 0 !important; height: auto !important; overflow: hidden !important; }
#dffc-modal-overlay .dffc-controls-panel { flex: 0 0 360px !important; width: 360px !important; max-width: 38vw !important; min-height: 0 !important; overflow: auto !important; }
#dffc-modal-overlay .dffc-preview-workspace { flex: 1 1 0 !important; width: auto !important; min-width: 0 !important; min-height: 0 !important; display: flex !important; flex-direction: column !important; overflow: hidden !important; }
#dffc-modal-overlay .dffc-canvas-toolbar { flex: 0 0 auto !important; min-height: 42px !important; padding: 5px 10px !important; }
#dffc-modal-overlay .dffc-modal-footer.dffc-preview-actions-toolbar {
  display: flex !important; flex: 0 0 auto !important; align-items: center !important; justify-content: flex-start !important;
  flex-wrap: wrap !important; gap: 6px !important; padding: 6px 10px !important; margin: 0 !important;
  border-top: 1px solid #e5e7eb !important; border-bottom: 1px solid #e5e7eb !important; background: #fff !important;
}
#dffc-modal-overlay .dffc-footer-left, #dffc-modal-overlay .dffc-footer-right { display: flex !important; align-items: center !important; flex-wrap: wrap !important; gap: 6px !important; }
#dffc-modal-overlay .dffc-btn-outline { padding: 6px 9px !important; gap: 5px !important; font-size: 11px !important; line-height: 1.2 !important; border-radius: 5px !important; }
#dffc-modal-overlay .dffc-btn-outline svg { width: 13px !important; height: 13px !important; }
#dffc-modal-overlay .dffc-qty-wrap { gap: 4px !important; }
#dffc-modal-overlay .dffc-label-qty { font-size: 11px !important; }
#dffc-modal-overlay .dffc-input-qty { width: 48px !important; padding: 5px !important; font-size: 12px !important; }
#dffc-modal-overlay .dffc-btn-primary-add { padding: 7px 11px !important; font-size: 11px !important; letter-spacing: 0 !important; line-height: 1.2 !important; border-radius: 5px !important; box-shadow: none !important; }
#dffc-modal-overlay .dffc-stage-viewport { flex: 1 1 0 !important; min-height: 0 !important; min-width: 0 !important; width: 100% !important; height: auto !important; padding: 14px !important; display: flex !important; align-items: center !important; justify-content: center !important; overflow: hidden !important; }
#dffc-modal-overlay .dffc-stage-canvas-wrap { position: relative !important; display: block !important; flex: 0 1 auto !important; max-width: 100% !important; max-height: 100% !important; margin: auto !important; transform-origin: center center !important; }
#dffc-modal-overlay #dffc-base-product-img { display: block !important; width: auto !important; height: auto !important; max-width: 100% !important; max-height: 100% !important; object-fit: contain !important; object-position: center !important; margin: 0 auto !important; }
#dffc-modal-overlay .dffc-print-area-tag, #dffc-modal-overlay .dffc-printable-badge { display: none !important; }
@media (max-width: 900px) {
  #dffc-modal-overlay .dffc-modal-header { padding: 7px 10px !important; }
  #dffc-modal-overlay .dffc-modal-body { flex-direction: column !important; }
  #dffc-modal-overlay .dffc-preview-workspace { order: 0 !important; flex: 1 1 52vh !important; width: 100% !important; height: auto !important; min-height: 220px !important; }
  #dffc-modal-overlay .dffc-controls-panel { order: 1 !important; flex: 0 0 38vh !important; width: 100% !important; max-width: none !important; height: 38vh !important; border-right: 0 !important; border-top: 1px solid #e5e7eb !important; }
  #dffc-modal-overlay .dffc-modal-footer.dffc-preview-actions-toolbar { gap: 4px !important; padding: 5px !important; }
  #dffc-modal-overlay .dffc-footer-left, #dffc-modal-overlay .dffc-footer-right { gap: 4px !important; }
  #dffc-modal-overlay .dffc-btn-outline { padding: 5px 6px !important; font-size: 10px !important; }
  #dffc-modal-overlay .dffc-btn-primary-add { padding: 6px 8px !important; font-size: 10px !important; }
}


/* v1.0.5: dedicate the right half of the screen to a genuinely large product preview.
   Use grid sizing to prevent flex shrink/empty space caused by theme-level main/footer styles. */
#dffc-modal-overlay .dffc-modal-container {
  display: flex !important; flex-direction: column !important;
  width: 100vw !important; height: 100vh !important; max-width: 100vw !important; max-height: 100vh !important;
}
#dffc-modal-overlay .dffc-modal-body {
  display: grid !important;
  grid-template-columns: minmax(280px, 24vw) minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  align-items: stretch !important;
  flex: 1 1 0 !important; width: 100% !important; height: auto !important;
  min-width: 0 !important; min-height: 0 !important; overflow: hidden !important;
}
#dffc-modal-overlay .dffc-controls-panel {
  grid-column: 1 !important; grid-row: 1 !important;
  width: auto !important; max-width: none !important; min-width: 0 !important;
  height: 100% !important; max-height: 100% !important; min-height: 0 !important;
  overflow: auto !important;
}
#dffc-modal-overlay .dffc-preview-workspace {
  grid-column: 2 !important; grid-row: 1 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto auto minmax(0, 1fr) !important;
  align-content: stretch !important; align-items: stretch !important;
  width: auto !important; height: 100% !important; max-height: 100% !important;
  min-width: 0 !important; min-height: 0 !important; overflow: hidden !important;
  margin: 0 !important; padding: 0 !important; justify-content: stretch !important;
}
#dffc-modal-overlay .dffc-canvas-toolbar { grid-row: 1 !important; margin: 0 !important; }
#dffc-modal-overlay .dffc-preview-actions-toolbar { grid-row: 2 !important; margin: 0 !important; }
#dffc-modal-overlay .dffc-stage-viewport {
  grid-row: 3 !important; display: flex !important; align-self: stretch !important;
  width: 100% !important; height: 100% !important; min-width: 0 !important; min-height: 0 !important;
  padding: 12px !important; box-sizing: border-box !important;
  align-items: center !important; justify-content: center !important; overflow: hidden !important;
}
#dffc-modal-overlay .dffc-stage-canvas-wrap {
  position: relative !important; display: block !important; flex: 0 1 auto !important;
  width: max-content !important; height: max-content !important; max-width: 100% !important;
  max-height: 100% !important; margin: auto !important; transform-origin: center center !important;
}
#dffc-modal-overlay #dffc-base-product-img {
  display: block !important; width: auto !important; height: auto !important;
  max-width: 100% !important; max-height: 100% !important;
  object-fit: contain !important; object-position: center center !important; margin: auto !important;
}
#dffc-modal-overlay .dffc-preview-actions-toolbar {
  display: flex !important; flex-wrap: nowrap !important; align-items: center !important;
  justify-content: flex-start !important; gap: 6px !important; padding: 5px 8px !important;
  min-height: 40px !important; overflow-x: auto !important;
}
#dffc-modal-overlay .dffc-preview-actions-toolbar .dffc-btn-outline,
#dffc-modal-overlay .dffc-preview-actions-toolbar .dffc-btn-primary-add {
  white-space: nowrap !important; flex: 0 0 auto !important;
  padding: 6px 9px !important; font-size: 11px !important; line-height: 1.15 !important;
}
@media (max-width: 900px) {
  #dffc-modal-overlay .dffc-modal-body {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 58vh) minmax(0, 1fr) !important;
  }
  #dffc-modal-overlay .dffc-preview-workspace {
    grid-column: 1 !important; grid-row: 1 !important; height: 100% !important;
    grid-template-rows: auto auto minmax(0, 1fr) !important;
  }
  #dffc-modal-overlay .dffc-controls-panel {
    grid-column: 1 !important; grid-row: 2 !important; width: 100% !important;
    height: 100% !important; border-right: 0 !important; border-top: 1px solid #e5e7eb !important;
  }
  #dffc-modal-overlay .dffc-preview-actions-toolbar { gap: 4px !important; padding: 4px !important; }
  #dffc-modal-overlay .dffc-preview-actions-toolbar .dffc-btn-outline,
  #dffc-modal-overlay .dffc-preview-actions-toolbar .dffc-btn-primary-add { padding: 5px 6px !important; font-size: 10px !important; }
}


/* v1.0.9: balanced half-screen editor and half-screen product preview.
   Scoped to the DFF modal so theme styles cannot collapse either column. */
#dffc-modal-overlay .dffc-modal-container {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
}
#dffc-modal-overlay .dffc-modal-body {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  width: 100% !important;
  flex: 1 1 0 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
#dffc-modal-overlay .dffc-controls-panel {
  grid-column: 1 !important;
  grid-row: 1 !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}
#dffc-modal-overlay .dffc-tool-tabs {
  flex: 0 0 auto !important;
}
#dffc-modal-overlay .dffc-tab-pane {
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}
#dffc-modal-overlay .dffc-preview-workspace {
  grid-column: 2 !important;
  grid-row: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  width: auto !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
#dffc-modal-overlay .dffc-canvas-toolbar,
#dffc-modal-overlay .dffc-history-bar,
#dffc-modal-overlay .dffc-preview-actions-toolbar {
  flex: 0 0 auto !important;
  min-width: 0 !important;
}
#dffc-modal-overlay .dffc-stage-viewport {
  flex: 1 1 0 !important;
  width: 100% !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}
#dffc-modal-overlay .dffc-stage-canvas-wrap {
  position: relative !important;
  display: block !important;
  flex: 0 1 auto !important;
  width: max-content !important;
  height: max-content !important;
  max-width: 100% !important;
  max-height: 100% !important;
  margin: auto !important;
}
#dffc-modal-overlay #dffc-base-product-img {
  display: block !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center center !important;
  margin: 0 auto !important;
}
#dffc-modal-overlay .dffc-preview-actions-toolbar {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 5px 7px !important;
  overflow-x: auto !important;
}
#dffc-modal-overlay .dffc-preview-actions-toolbar .dffc-btn-outline,
#dffc-modal-overlay .dffc-preview-actions-toolbar .dffc-btn-primary-add {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
  padding: 6px 8px !important;
  font-size: 10px !important;
}

/* Small screens: stack the preview and tools rather than squeezing both columns. */
@media (max-width: 900px) {
  #dffc-modal-overlay .dffc-modal-body {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(240px, 52vh) minmax(0, 1fr) !important;
  }
  #dffc-modal-overlay .dffc-preview-workspace {
    grid-column: 1 !important;
    grid-row: 1 !important;
    height: 100% !important;
  }
  #dffc-modal-overlay .dffc-controls-panel {
    grid-column: 1 !important;
    grid-row: 2 !important;
    width: 100% !important;
    height: 100% !important;
    border-right: 0 !important;
    border-top: 1px solid #e5e7eb !important;
  }
  #dffc-modal-overlay .dffc-preview-actions-toolbar .dffc-btn-outline,
  #dffc-modal-overlay .dffc-preview-actions-toolbar .dffc-btn-primary-add {
    padding: 5px 6px !important;
    font-size: 9px !important;
  }
}
