/**
 * Ecab13 Print - product editor page: stage, selection, layers and final window of the module
 *
 * @author    Ecab13
 * @copyright Since 2026 Ecab13
 * @license   Commercial license - see the LICENSE.md file shipped with this module
 */
html, body { margin: 0; height: 100%; }
body.e13e-page-mode { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--e13e-text); }
[hidden] { display: none !important; }

/* Loader */
#e13e-page-loader { position: fixed; inset: 0; z-index: 999999; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; transition: opacity .4s ease; }
#e13e-page-loader.hidden { opacity: 0; pointer-events: none; }
.e13e-loader-ring { width: 54px; height: 54px; border-radius: 50%; border: 3px solid rgba(0,0,0,.08); border-top-color: var(--e13e-accent); animation: e13eSpin .85s linear infinite; }
@keyframes e13eSpin { to { transform: rotate(360deg); } }
#e13e-loader-text { font-size: .95rem; font-weight: 600; }

/* Header */
.e13e-header-sep { color: rgba(0,0,0,.12); font-size: .9rem; }
.e13e-header-spacer { flex: 1; }
.e13e-header-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: .9rem; }
.e13e-header-logo-img { height: 28px; width: auto; }

/* Buttons */
.e13e-btn-block { width: 100%; margin-top: 10px; justify-content: center; }
.e13e-btn-danger { background: #fee; color: #dc2626; border: 1.5px solid #fcc; }
.e13e-btn-danger:hover { background: #fdd; }
.e13e-qa-btn:disabled { opacity: .35; cursor: default; }
.e13e-qa-btn.active { color: var(--e13e-accent); background: var(--e13e-accent-bg); }
.e13e-field-input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1.5px solid var(--e13e-border2); border-radius: 8px; font-size: .85rem; font-family: inherit; background: #fff; }
textarea.e13e-field-input { resize: vertical; }
.e13e-color-picker-row .e13e-range { flex: 1; max-width: 150px; margin-left: 10px; }
.e13e-color-picker-row .e13e-color-input + .e13e-range, .e13e-color-picker-row .e13e-range + .e13e-color-input { margin-left: 8px; }
.e13e-empty { text-align: center; padding: 10px 0; }

/* Faces: many sides (the 13 pages of a calendar) scroll sideways with arrows, the tools stay visible */
.e13e-face-scroller { position: relative; display: flex; align-items: center; flex: 1 1 auto; min-width: 0; }
.e13e-face-buttons { display: flex; gap: 6px; flex-wrap: nowrap; min-width: 0; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; }
.e13e-face-buttons::-webkit-scrollbar { display: none; }
.e13e-face-arrow { position: absolute; top: 50%; z-index: 2; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-top: -15px; border: 1px solid var(--e13e-border); border-radius: 50%; background: var(--e13e-surface); color: var(--e13e-text); box-shadow: 0 2px 8px rgba(15, 23, 42, .15); cursor: pointer; font-size: .75rem; }
.e13e-face-arrow[hidden] { display: none; }
.e13e-face-arrow:hover { color: var(--e13e-accent); border-color: var(--e13e-accent-bd); }
.e13e-face-arrow.is-prev { left: 0; }
.e13e-face-arrow.is-next { right: 0; }
.e13e-face-scroller.has-prev::before, .e13e-face-scroller.has-next::after { content: ""; position: absolute; top: 0; bottom: 0; width: 48px; z-index: 1; pointer-events: none; }
.e13e-face-scroller.has-prev::before { left: 0; background: linear-gradient(to right, var(--e13e-surface) 40%, transparent); }
.e13e-face-scroller.has-next::after { right: 0; background: linear-gradient(to left, var(--e13e-surface) 40%, transparent); }
.e13e-qa-inline { flex: none; }

/* Words of the dotted lines of a template (print area, dates of a calendar...), at the end of each line */
.e13e-template-notes { position: absolute; inset: 0; z-index: 2; pointer-events: none; container-type: inline-size; }
.e13e-template-note { position: absolute; transform: translateY(-50%); max-width: 120px; padding: 0 6px; font-size: 11px; line-height: 1.25; font-weight: 500; color: #374151; text-align: right; white-space: normal; }
.e13e-template-note.is-right { text-align: left; }
.e13e-template-note.is-center { transform: translate(-50%, 4px); max-width: none; text-align: center; white-space: nowrap; }
.e13e-template-note.is-center.is-above { transform: translate(-50%, calc(-100% - 4px)); }
.e13e-template-note.is-along { transform: translateY(calc(-100% - 2px)); max-width: none; padding: 0 2px; text-align: left; white-space: nowrap; }
.e13e-template-note.is-along.is-right { text-align: right; }
.e13e-template-note.is-legend { transform: translateY(-50%); max-width: none; padding: 0 4px; text-align: left; white-space: nowrap; }
.e13e-template-note.is-caption { width: max-content; max-width: 92%; white-space: normal; }
/* Text box of the editor of Printful (TemplateNotes): place, width, alignment and size given, from its top. */
.e13e-template-note.is-box { transform: none; max-width: none; padding: 0; line-height: 1.2; white-space: normal; text-align: center; }
.e13e-face-btn { position: relative; white-space: nowrap; }
.e13e-face-dot { position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: #10b981; }
.e13e-face-btn.active .e13e-face-dot { background: #fff; }
.e13e-qa-inline { margin-left: auto; }

/* Stage: product color, design (under the Printful overlay template), template, frame and selection */
.e13e-mockup-wrap { overflow: auto; position: relative; min-height: 280px; }
#e13e-mockup-inner { position: relative; flex: none; display: block; transition: none; }
#e13e-product-color { position: absolute; inset: 0; }
/* Background image of the template (heather, camouflage): over the color, under the design */
#e13e-mockup-inner .e13e-mockup-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; z-index: 0; pointer-events: none; user-select: none; }
#e13e-mockup-inner .e13e-mockup-bg[hidden] { display: none; }
#e13e-mockup-inner .e13e-mockup-img { position: absolute; inset: 0; width: 100% !important; height: 100% !important; max-width: none; max-height: none; object-fit: fill; z-index: 2; filter: none; }
#e13e-mockup-inner.is-background .e13e-mockup-img { z-index: 0; }
#e13e-print-area { z-index: 1; border: 0; border-radius: 0; overflow: hidden; pointer-events: none; }
/* Knitwear: the trims (collar, cuffs, hem) in their color, over the design, under the template */
#e13e-product-trim { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
#e13e-product-trim > span { position: absolute; }
#e13e-mockup-inner.is-photo #e13e-product-trim { display: none; }
#e13e-layers { position: absolute; inset: 0; }
.e13e-el { position: absolute; pointer-events: auto; cursor: move; touch-action: none; user-select: none; }
.e13e-el canvas, .e13e-el img { display: block; width: 100%; height: 100%; pointer-events: none; }
.e13e-area-frame { position: absolute; z-index: 3; outline: 1.5px dashed color-mix(in srgb, var(--e13e-accent) 60%, transparent); pointer-events: none; }
.e13e-area-frame .e13e-guide-v { left: 50%; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--e13e-accent); }
.e13e-area-frame .e13e-guide-h { top: 50%; left: 0; right: 0; height: 0; border-top: 1px dashed var(--e13e-accent); }
.e13e-selection { position: absolute; box-sizing: border-box; border: 1.5px solid var(--e13e-accent); pointer-events: auto; cursor: move; touch-action: none; }
.e13e-selection .e13e-resize-handle { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--e13e-accent); cursor: nwse-resize; box-sizing: border-box; display: block; }
.e13e-sel-rotate { position: absolute; left: 50%; top: -30px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: #fff; border: 2px solid var(--e13e-accent); cursor: grab; box-sizing: border-box; }
.e13e-sel-rotate::after { content: ''; position: absolute; left: 50%; top: 16px; width: 2px; height: 12px; margin-left: -1px; background: var(--e13e-accent); }
/* A locked element (QR background, QR code in its zone): an outline only, the clicks going through its frame (the frame
   of a background as large as the area would catch them all, the code above it out of reach). */
.e13e-selection.is-locked { pointer-events: none; cursor: default; border-style: dashed; }
.e13e-selection.is-locked .e13e-resize-handle, .e13e-selection.is-locked .e13e-sel-rotate, .e13e-selection.is-locked .e13e-sel-delete { display: none !important; }
/* A QR background selected: its frame lets the clicks through to the code over it (moved by its image), its handles
   catch them; never turned. */
.e13e-selection.is-background { pointer-events: none; }
.e13e-selection.is-background .e13e-resize-handle, .e13e-selection.is-background .e13e-sel-delete { pointer-events: auto; }
.e13e-selection.is-background .e13e-sel-rotate { display: none !important; }
.e13e-sel-delete { position: absolute; right: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #dc2626; color: #fff; font-size: 15px; line-height: 20px; padding: 0; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.e13e-status { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 10; max-width: calc(100% - 32px); padding: 8px 14px; border-radius: 10px; font-size: .82rem; font-weight: 600; background: var(--e13e-surface); box-shadow: var(--e13e-shadow); pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e13e-status.is-success { color: #047857; }
.e13e-status.is-error { color: #b91c1c; }

/* Colors under the stage */
#e13e-options { padding: 12px 16px 18px; }
.e13e-tshirt-swatch.active { border-color: #fff; box-shadow: 0 0 0 2px var(--e13e-accent); }

/* Themes */
.e13e-template-preview { display: block; width: 100%; aspect-ratio: 3 / 2; border-radius: 10px; overflow: hidden; background: #f1f3f8; border: 1.5px solid var(--e13e-border2); }
.e13e-template-preview-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.e13e-template-card:hover .e13e-template-preview { border-color: var(--e13e-accent); }
.e13e-template-name { font-size: .7rem; font-weight: 600; color: var(--e13e-muted); text-align: center; line-height: 1.2; }

.e13e-pattern-cats[hidden] { display: none; }

/* Cliparts of the merchant: the image whole in its tile */
.cl-tile-img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* Themes shown whole, in cards of their shape: portrait, landscape (bigger, 2 per row), square */
.e13e-theme-group + .e13e-theme-group { margin-top: 14px; }
.e13e-theme-group-title { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--e13e-muted); }
.e13e-theme-shape { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; }
.e13e-theme-shape.is-portrait { width: 9px; height: 12px; }
.e13e-theme-shape.is-landscape { width: 14px; height: 10px; }
.e13e-theme-shape.is-square { width: 11px; height: 11px; }
.e13e-templates-grid.is-landscape { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.e13e-templates-grid.is-portrait .e13e-template-preview { aspect-ratio: 3 / 4; }
.e13e-templates-grid.is-landscape .e13e-template-preview { aspect-ratio: 3 / 2; }
.e13e-templates-grid.is-square .e13e-template-preview { aspect-ratio: 1; }
.e13e-templates-grid .e13e-template-preview-img { object-fit: contain; }

/* Layers */
.e13e-layers-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.e13e-layer-item { cursor: pointer; padding: 6px 8px; gap: 8px; }
.e13e-layer-item.is-active { border-color: var(--e13e-accent); background: var(--e13e-accent-bg); }
.e13e-layer-item.is-hidden .e13e-layer-name { opacity: .45; }
.e13e-layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }
.e13e-layer-actions { display: flex; gap: 2px; }
.e13e-layer-btn { width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--e13e-muted); cursor: pointer; }
.e13e-layer-btn:hover:not(:disabled) { background: #fff; color: var(--e13e-text); }
.e13e-layer-btn:disabled { opacity: .3; cursor: default; }
.e13e-layer-btn.is-danger:hover { color: #dc2626; }
.e13e-text-layer-item .del { border: 0; background: transparent; cursor: pointer; color: var(--e13e-muted); }

/* Final window */
.e13e-size-modal-box { max-height: calc(100dvh - 40px); overflow-y: auto; }
.e13e-modal-preview-item { flex: 1; min-width: 0; text-align: center; }
.e13e-modal-preview { width: 100%; max-width: 320px; aspect-ratio: 1; object-fit: contain; border-radius: 12px; background: #f4f6fb; }
.e13e-size-btn.active { background: var(--e13e-accent); border-color: var(--e13e-accent); color: #fff; }
.e13e-size-btn:disabled { opacity: .35; cursor: not-allowed; }
.e13e-size-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.e13e-summary-qty { display: flex; align-items: center; gap: 14px; margin: 6px 0 14px; flex-wrap: wrap; }
.e13e-qty { display: inline-flex; align-items: stretch; height: 44px; border: 1.5px solid var(--e13e-border2); border-radius: 10px; overflow: hidden; background: var(--e13e-surface); }
.e13e-qty button { width: 44px; padding: 0; border: 0; background: #f8fafd; color: inherit; font-size: 1.25rem; line-height: 1; cursor: pointer; transition: background .15s ease; }
.e13e-qty button:hover { background: #eef2f8; }
.e13e-qty input { width: 72px; min-width: 0; padding: 0 6px; border: 0; border-left: 1px solid var(--e13e-border2); border-right: 1px solid var(--e13e-border2); background: transparent; color: inherit; text-align: center; font: inherit; font-size: 1.05rem; font-weight: 700; -moz-appearance: textfield; appearance: textfield; }
.e13e-qty input:focus-visible { outline: 2px solid var(--e13e-accent); outline-offset: -2px; }
.e13e-qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.e13e-summary-total { margin-left: auto; font-size: 1.15rem; font-weight: 800; }
.e13e-summary-done p { font-weight: 700; color: #047857; font-size: 1rem; }

@media (max-width: 900px) {
  .e13e-qa-inline { margin-left: 0; }
  .e13e-face-tabs { flex-wrap: wrap; }
}

/* Adjustments of the editor styles */
.e13e-tab-nav { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.e13e-tab-btn { justify-content: center; }
.cl-upload-cta { box-sizing: border-box; cursor: pointer; }
.e13e-section-title .e13e-section-value { margin-left: 6px; text-transform: none; letter-spacing: 0; }
#e13e-summary-add, .e13e-size-confirm { background: var(--e13e-accent); background-image: none; border-color: var(--e13e-accent); color: #fff; }
#e13e-summary-add:hover { filter: brightness(1.08); }

/* Preview of an offline product (employee) */
.e13e-preview-banner { flex-shrink: 0; margin: 8px 12px 0; padding: 8px 14px; border-radius: 10px; background: #fff7e6; color: #8a4b00; border: 1px solid #f5c26b; font-size: .8rem; font-weight: 600; }

/* Surcharge of the additional sides */
.e13e-face-extra { margin-left: 6px; font-size: .68rem; font-weight: 700; opacity: .85; }
.e13e-summary-extras { margin: -6px 0 12px; font-size: .8rem; color: var(--e13e-muted); }
.e13e-summary-extra + .e13e-summary-extra { margin-top: 2px; }
.e13e-summary-delay { margin-bottom: 4px; font-weight: 600; color: #b45309; }

/* Side refused by Printful with a side already designed */
.e13e-face-btn.is-blocked { opacity: .45; border-style: dashed; }

/* Groups changing the preview under the stage (models of a phone case, finishes), as buttons */
.e13e-model-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.e13e-model-btn.active { background: var(--e13e-accent); border-color: var(--e13e-accent); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--e13e-accent) 30%, transparent); }
.e13e-model-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Loader of the stage while the template of another color or model loads */
.e13e-mockup-wrap.is-loading .e13e-mockup-img { opacity: .55; transition: opacity .2s ease; }
.e13e-mockup-wrap.is-loading::after { content: ''; position: absolute; top: 50%; left: 50%; z-index: 5; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255, 255, 255, .9); box-shadow: 0 4px 16px rgba(0, 0, 0, .12); border: 3px solid rgba(0, 0, 0, .08); border-top-color: var(--e13e-accent); animation: e13eSpin .8s linear infinite; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .e13e-mockup-wrap.is-loading::after { animation-duration: 2.4s; } }

/* Editor of the merchant (back office): the design saved, no cart, quantity nor price */
.e13e-merchant .e13e-summary-qty,
.e13e-merchant .e13e-summary-extras,
.e13e-merchant .e13e-face-extra,
.e13e-merchant .e13e-emb-price { display: none !important; }
.e13e-merchant-photos { margin: 0 0 16px; }
.e13e-merchant-photos p { margin: 0 0 12px; font-size: 13px; line-height: 1.45; color: #4b5563; }
.e13e-merchant-photos .e13e-section-title { display: block; margin: 10px 0 4px; }
.e13e-merchant-return { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 13px; color: #374151; cursor: pointer; }
.e13e-merchant-select { width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; font: inherit; font-size: 14px; }
.e13e-merchant-scope label { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 14px; cursor: pointer; }
.e13e-merchant-scope input { margin: 0; }

/* Merchant: the photo styles to tick, each with its photo on the blank product (loadPhotoStyles()) */
.e13e-photo-styles-hint { margin: 0 0 8px; color: #6b7280; font-size: .78rem; line-height: 1.4; }
.e13e-photo-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin: 0 0 12px; }
.e13e-photo-style { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 5px; border: 2px solid #e5e7eb; border-radius: 9px; background: #fff; cursor: pointer; }
.e13e-photo-style:hover { border-color: #9ca3af; }
.e13e-photo-style:has(input:checked) { border-color: var(--e13e-accent); }
.e13e-photo-style-picture { position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden; background: #f4f6f7 center / cover no-repeat; }
.e13e-photo-style-picture.is-loading { animation: e13e-photo-style-wait 1.2s ease-in-out infinite alternate; }
.e13e-photo-style-picture img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.e13e-photo-style-name { display: flex; align-items: flex-start; gap: 5px; font-size: .75rem; font-weight: 600; line-height: 1.25; }
.e13e-photo-style-name input { flex: none; margin: 1px 0 0; accent-color: var(--e13e-accent); }
/* Merchant: the photo styles ticked do not show a side drawn (photoStyleNote()) */
.e13e-photo-style-note { margin: -4px 0 12px; padding: 9px 12px; border: 1px solid #f5c26b; border-radius: 9px; background: #fff7e6; color: #7c2d12; font-size: .8rem; font-weight: 600; line-height: 1.4; }
.e13e-photo-style-note[hidden] { display: none; }
@keyframes e13e-photo-style-wait { from { opacity: 1; } to { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .e13e-photo-style-picture.is-loading { animation: none; } }
