/* Xellence Customizer – designer UI. Scoped under .xc-* to stay theme-independent. */
:root { --xc-accent: #7b2ff7; --xc-btn-bg: #7b2ff7; --xc-btn-fg: #fff; }
.xc-root, .xc-inline-root, .xc-launch { --xc-ink: #1d1b26; --xc-mute: #6b6880; --xc-line: #e7e4ef; --xc-soft: #f6f4fb; --xc-r: 12px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
.xc-root[hidden] { display: none !important; }
html.xc-open, html.xc-open body { overflow: hidden !important; }

/* Launch button on the product page */
.xc-launch { margin: 0 0 14px; width: 100%; }
.xc-launch__info { margin: 0 0 8px; color: #555; font-size: .95em; }
.xc-launch__btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; padding: 12px 20px; border: 0; border-radius: 10px; background: var(--xc-btn-bg); color: var(--xc-btn-fg); font-weight: 700; font-size: 16px; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.12); transition: transform .15s, box-shadow .15s; }
.xc-launch__btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0,0,0,.16); }
.xc-launch__saved { display: flex; gap: 12px; align-items: center; margin-top: 10px; padding: 10px; border: 1px solid #d7f0dc; background: #f3fbf5; border-radius: 10px; font-size: 14px; }
.xc-launch__saved[hidden] { display: none; }
.xc-launch__saved img { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid #eee; }
.xc-launch__saved small { display: block; color: #555; margin: 2px 0; }
.xc-linkbtn { background: none; border: 0; padding: 0; color: var(--xc-accent); text-decoration: underline; cursor: pointer; font: inherit; }
.xc-loop-button { white-space: nowrap; }

/* Shell */
.xc-mode-modal { position: fixed; inset: 0; z-index: 999999; background: rgba(20, 16, 34, .55); display: flex; align-items: stretch; justify-content: center; padding: 16px; }
.xc-mode-inline { margin: 24px 0; clear: both; }
.xc-designer { position: relative; display: flex; flex-direction: column; width: 100%; max-width: 1440px; background: #fff; color: var(--xc-ink); border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.35); font-size: 14px; line-height: 1.4; }
.xc-mode-inline .xc-designer { height: min(860px, 92vh); box-shadow: 0 8px 30px rgba(0,0,0,.1); border: 1px solid var(--xc-line); }
.xc-designer.xc-fs, .xc-designer:fullscreen { position: fixed; inset: 0; max-width: none; border-radius: 0; z-index: 1000000; }
.xc-designer *, .xc-designer *::before, .xc-designer *::after { box-sizing: border-box; }
.xc-designer button { font-family: inherit; letter-spacing: normal; text-transform: none; line-height: 1.2; margin: 0; }
.xc-designer svg { display: block; }
.xc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--xc-line); min-height: 56px; }
.xc-head__title { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xc-head__tools { display: flex; gap: 4px; align-items: center; }
.xc-body { flex: 1; display: grid; grid-template-columns: 380px 1fr; min-height: 0; }

/* Buttons */
.xc-ibtn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--xc-ink); cursor: pointer; }
.xc-ibtn:hover { background: var(--xc-soft); }
.xc-ibtn:disabled { opacity: .35; cursor: default; background: transparent; }
.xc-ibtn.is-on { background: var(--xc-accent); color: #fff; }
.xc-ibtn.xc-danger:hover { background: #fdecef; color: #c62828; }
.xc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--xc-line); border-radius: 10px; background: #fff; color: var(--xc-ink); font-weight: 600; font-size: 14px; cursor: pointer; }
.xc-btn:hover { border-color: #cfc9dd; background: var(--xc-soft); }
.xc-btn--primary { background: var(--xc-accent); border-color: var(--xc-accent); color: #fff; }
.xc-btn--primary:hover { filter: brightness(1.07); background: var(--xc-accent); }
.xc-btn--block { width: 100%; margin-top: 8px; }
.xc-chip { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 12px; border: 1px solid var(--xc-line); border-radius: 999px; background: #fff; color: var(--xc-ink); font-size: 13px; cursor: pointer; }
.xc-chip:hover { background: var(--xc-soft); }
.xc-chip.is-on { background: var(--xc-ink); color: #fff; border-color: var(--xc-ink); }
.xc-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

/* Tools column */
.xc-tools { display: flex; min-height: 0; border-right: 1px solid var(--xc-line); background: #fff; }
.xc-tabs { display: flex; flex-direction: column; gap: 2px; width: 84px; padding: 8px 6px; border-right: 1px solid var(--xc-line); background: var(--xc-soft); overflow-y: auto; }
.xc-tab { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px; border: 0; border-radius: 10px; background: transparent; color: var(--xc-mute); font-size: 11.5px; font-weight: 600; cursor: pointer; text-align: center; }
.xc-tab:hover { color: var(--xc-ink); background: #fff; }
.xc-tab.is-on { color: var(--xc-accent); background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.xc-tab--collapse { display: none; }
.xc-panel { flex: 1; overflow-y: auto; padding: 16px; }
.xc-sec { margin-bottom: 18px; }
.xc-sec h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--xc-ink); text-transform: none; letter-spacing: 0; }
.xc-hint { margin: 0 0 8px; color: var(--xc-mute); font-size: 13px; }
.xc-hint--big { font-size: 14px; padding: 16px; background: var(--xc-soft); border-radius: var(--xc-r); }
.xc-lbl { display: block; margin: 10px 0 4px; font-size: 12.5px; font-weight: 600; color: var(--xc-mute); }
.xc-lblrow { display: flex; justify-content: space-between; align-items: center; }
.xc-val { font-size: 12px; color: var(--xc-mute); font-variant-numeric: tabular-nums; }
.xc-input { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--xc-line); border-radius: 10px; background: #fff; color: var(--xc-ink); font-size: 15px; font-family: inherit; }
.xc-input:focus { outline: 2px solid var(--xc-accent); outline-offset: 0; border-color: transparent; }
textarea.xc-input { resize: vertical; min-height: 64px; }
.xc-font { font-size: 17px; }
.xc-range { width: 100%; accent-color: var(--xc-accent); margin: 4px 0 6px; height: 28px; }
.xc-row { display: flex; gap: 6px; align-items: center; }
.xc-wrap { flex-wrap: wrap; }
.xc-end { justify-content: flex-end; margin-top: 14px; }
.xc-sep { width: 1px; height: 24px; background: var(--xc-line); margin: 0 4px; }
.xc-toggles { margin-top: 10px; }
.xc-tog { width: 40px; height: 40px; border: 1px solid var(--xc-line); border-radius: 10px; background: #fff; color: var(--xc-ink); font-size: 16px; cursor: pointer; }
.xc-tog.is-on { background: var(--xc-ink); color: #fff; border-color: var(--xc-ink); }
.xc-check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-weight: 600; cursor: pointer; }
.xc-check input { width: 18px; height: 18px; accent-color: var(--xc-accent); }
.xc-swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.xc-sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #d8d4e2; cursor: pointer; padding: 0; }
.xc-sw.is-on { box-shadow: 0 0 0 2px var(--xc-accent); }
.xc-sw--none { background: linear-gradient(135deg, #fff 45%, #e53935 45%, #e53935 55%, #fff 55%); }
.xc-colorpick { width: 34px; height: 30px; padding: 0; border: 1px solid var(--xc-line); border-radius: 8px; background: #fff; cursor: pointer; }
.xc-actions { justify-content: space-between; padding: 6px; background: var(--xc-soft); border-radius: var(--xc-r); }
.xc-list { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.xc-listitem { text-align: left; padding: 9px 12px; border: 1px solid var(--xc-line); border-radius: 10px; background: #fff; cursor: pointer; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--xc-ink); }
.xc-listitem.is-on { border-color: var(--xc-accent); background: #f4efff; }

/* Upload */
.xc-drop { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 14px; border: 2px dashed #cdc6e0; border-radius: 14px; background: var(--xc-soft); color: var(--xc-ink); cursor: pointer; text-align: center; }
.xc-drop:hover, .xc-drag .xc-drop { border-color: var(--xc-accent); background: #f1eaff; }
.xc-drop__icon { color: var(--xc-accent); }
.xc-drop small { color: var(--xc-mute); }
.xc-drag::after { content: ""; position: absolute; inset: 0; border: 3px dashed var(--xc-accent); border-radius: 18px; background: rgba(123, 47, 247, .06); pointer-events: none; z-index: 30; }

/* Grids */
.xc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.xc-grid--photos { grid-template-columns: repeat(3, 1fr); }
.xc-grid--shapes { grid-template-columns: repeat(6, 1fr); margin-bottom: 12px; }
.xc-grid--tpl { grid-template-columns: repeat(2, 1fr); }
.xc-thumb { position: relative; }
.xc-thumb__img { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1; padding: 6px; border: 1px solid var(--xc-line); border-radius: 10px; background: #fff; cursor: pointer; overflow: hidden; }
.xc-thumb__img:hover { border-color: var(--xc-accent); }
.xc-thumb__img img, .xc-thumb__img canvas { max-width: 100%; max-height: 100%; object-fit: contain; }
.xc-grid--photos .xc-thumb__img { padding: 0; }
.xc-grid--photos .xc-thumb__img img { width: 100%; height: 100%; object-fit: cover; }
.xc-thumb__del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.xc-tpl { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--xc-line); border-radius: 12px; background: #fff; cursor: pointer; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--xc-ink); }
.xc-tpl canvas { width: 100%; height: auto; border-radius: 6px; background: var(--xc-soft); }
.xc-tpl:hover, .xc-tpl.is-on { border-color: var(--xc-accent); }
.xc-spinner { width: 28px; height: 28px; margin: 20px auto; border: 3px solid var(--xc-line); border-top-color: var(--xc-accent); border-radius: 50%; animation: xc-spin .8s linear infinite; }
@keyframes xc-spin { to { transform: rotate(360deg); } }

/* Stage */
.xc-stage { position: relative; min-height: 0; min-width: 0; background: radial-gradient(circle at 50% 40%, #fbfaff, #eeebf5); overflow: hidden; }
.xc-canvas { position: absolute; inset: 0; width: 100%; height: 100%; outline: none; cursor: default; touch-action: none; }
.xc-sidebar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 5; max-width: 95%; }
.xc-sidebar:empty { display: none; }
.xc-side { padding: 8px 14px; margin: 0 2px; border: 1px solid var(--xc-line); border-radius: 999px; background: rgba(255,255,255,.95); font-weight: 600; font-size: 13px; cursor: pointer; color: var(--xc-ink); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.xc-side.is-on { background: var(--xc-ink); color: #fff; border-color: var(--xc-ink); }
.xc-side.is-used:not(.is-on)::after { content: " •"; color: var(--xc-accent); }
.xc-sidebar { flex-direction: row; flex-wrap: wrap; justify-content: center; }
.xc-areas { display: flex; gap: 6px; flex-basis: 100%; justify-content: center; }
.xc-areachip { padding: 5px 11px; border: 1px dashed #b9b1cf; border-radius: 999px; background: rgba(255,255,255,.9); font-size: 12px; cursor: pointer; color: var(--xc-ink); }
.xc-areachip.is-on { border-style: solid; border-color: var(--xc-accent); color: var(--xc-accent); }
.xc-float { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; background: #fff; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.12); z-index: 6; }
.xc-float[hidden] { display: none; }
.xc-quality { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; z-index: 6; max-width: 92%; text-align: center; }
.xc-quality[hidden] { display: none; }
.xc-quality--good { background: #e8f5e9; color: #1b5e20; }
.xc-quality--low { background: #fff8e1; color: #8d5a00; }
.xc-quality--bad { background: #fdecea; color: #b71c1c; }
.xc-mini { position: absolute; right: 12px; top: 12px; width: 150px; height: 150px; background: #fff; border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.14); z-index: 5; }
.xc-mini[hidden] { display: none; }
.xc-toast { position: absolute; left: 50%; bottom: 70px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 10px 16px; border-radius: 12px; background: var(--xc-ink); color: #fff; font-size: 13.5px; font-weight: 600; z-index: 40; transition: .2s; max-width: 90%; text-align: center; }
.xc-toast.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.xc-toast--err { background: #c62828; }
.xc-toast--warn { background: #8d5a00; }
.xc-toast--ok { background: #1b5e20; }
.xc-toast .xc-linkbtn { color: #fff; }

/* Footer */
.xc-foot { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-top: 1px solid var(--xc-line); background: #fff; flex-wrap: wrap; }
.xc-vars { display: flex; gap: 8px; flex-wrap: wrap; }
.xc-vars:empty { display: none; }
.xc-var { display: flex; flex-direction: column; font-size: 11.5px; font-weight: 600; color: var(--xc-mute); }
.xc-var .xc-input { min-height: 38px; padding: 6px 8px; font-size: 14px; min-width: 110px; }
.xc-var--qty .xc-input { width: 80px; min-width: 0; }
.xc-shake { animation: xc-shake .5s; }
@keyframes xc-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.xc-price { margin-left: auto; text-align: right; }
.xc-price__total { display: flex; gap: 8px; align-items: baseline; justify-content: flex-end; }
.xc-price__total span { color: var(--xc-mute); font-size: 12px; }
.xc-price__total strong { font-size: 20px; }
.xc-price__det { font-size: 12px; color: var(--xc-mute); }
.xc-price__lines { list-style: none; margin: 2px 0 0; padding: 0; font-size: 12px; color: var(--xc-mute); }
.xc-foot__btns { display: flex; gap: 8px; }
.xc-busy .xc-cart, .xc-saving .xc-cart { opacity: .7; pointer-events: none; }
.xc-saving .xc-cart::after { content: ""; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: xc-spin .8s linear infinite; }

/* Modal (crop / preview) */
.xc-modal { position: absolute; inset: 0; z-index: 50; background: rgba(20,16,34,.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.xc-modal__card { position: relative; width: min(980px, 100%); max-height: 100%; overflow: auto; padding: 22px; background: #fff; border-radius: 16px; }
.xc-modal__x { position: absolute; top: 8px; right: 8px; }
.xc-modal__title { margin: 0 0 14px; font-size: 18px; }
.xc-modal--crop .xc-modal__card { width: min(760px, 100%); }
.xc-cropwrap { display: flex; justify-content: center; background: #222; border-radius: 10px; padding: 8px; }
.xc-cropcv { max-width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.xc-pv { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 14px; }
.xc-pv figure { margin: 0; text-align: center; }
.xc-pv__img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--xc-line); }
.xc-pv figcaption { margin-top: 6px; font-weight: 600; }
.xc-modal .xc-price { text-align: left; margin: 0; }
.xc-modal .xc-price__total { justify-content: flex-start; }

/* Tablet */
@media (max-width: 1100px) { .xc-body { grid-template-columns: 330px 1fr; } .xc-grid { grid-template-columns: repeat(3, 1fr); } }

/* Mobile: preview on top, collapsible toolbar, sticky add-to-cart */
@media (max-width: 767px) {
	.xc-mode-modal { padding: 0; }
	.xc-designer { border-radius: 0; height: 100%; height: 100dvh; max-height: none; }
	.xc-mode-inline .xc-designer { height: 92vh; height: 92dvh; border-radius: 12px; }
	.xc-head { min-height: 48px; padding: 4px 6px 4px 12px; }
	.xc-head__title { font-size: 14px; }
	.xc-ibtn { width: 38px; height: 38px; }
	.xc-hide-sm { display: none !important; }
	.xc-body { display: flex; flex-direction: column; }
	.xc-stage { order: 1; flex: 1 1 auto; min-height: 38vh; }
	.xc-tools { order: 2; flex: 0 0 auto; flex-direction: column; border-right: 0; border-top: 1px solid var(--xc-line); }
	.xc-tabs { flex-direction: row; width: 100%; padding: 4px; border-right: 0; border-bottom: 1px solid var(--xc-line); overflow-x: auto; overflow-y: hidden; }
	.xc-tab { flex: 1 0 auto; min-width: 62px; padding: 6px 4px; font-size: 11px; }
	.xc-tab--collapse { display: flex; flex: 0 0 44px; min-width: 44px; justify-content: center; }
	.xc-collapsed .xc-tab--collapse svg { transform: rotate(180deg); }
	.xc-tab--collapse svg { transform: none; transition: transform .2s; }
	.xc-panel { max-height: 36vh; max-height: 36dvh; padding: 12px; }
	.xc-collapsed .xc-panel { display: none; }
	.xc-grid { grid-template-columns: repeat(4, 1fr); }
	.xc-grid--shapes { grid-template-columns: repeat(6, 1fr); }
	.xc-foot { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 8px; }
	.xc-foot--sticky { position: sticky; bottom: 0; z-index: 20; box-shadow: 0 -6px 18px rgba(0,0,0,.06); }
	.xc-vars { width: 100%; }
	.xc-var { flex: 1; }
	.xc-var .xc-input { min-width: 0; width: 100%; }
	.xc-price { margin-left: 0; text-align: left; flex: 1; }
	.xc-price__total { justify-content: flex-start; }
	.xc-price__lines { display: none; }
	.xc-foot__btns .xc-btn:not(.xc-cart) span { display: none; }
	.xc-foot__btns .xc-btn:not(.xc-cart) { padding: 10px 12px; }
	.xc-cart { min-width: 140px; }
	.xc-float { top: 8px; }
	.xc-quality { top: auto; bottom: 52px; left: 8px; transform: none; max-width: calc(100% - 16px); padding: 4px 10px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.xc-toast { bottom: auto; top: 62px; }
	.xc-toast.is-on { transform: translate(-50%, 0); }
	.xc-mini { width: 96px; height: 96px; top: 8px; right: 8px; }
	.xc-sidebar { bottom: 8px; }
	.xc-modal { padding: 8px; }
	.xc-modal__card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { .xc-launch__btn, .xc-toast, .xc-spinner { transition: none; animation: none; } }
