/* [Customizer] Редакторът за персонализиране на продукта (partials/product_customizer.blade.php). */
/* .tpc-tools е извън .tpc на десктоп (преместен в дясната колона) — затова променливите са и на него. */
.tpc, .tpc-tools { --tpc-accent: var(--primary-color, #0d6efd); --tpc-border: rgba(17, 24, 39, .12); --tpc-muted: #6b7280; --tpc-bg: #f6f7f9; }
.tpc { margin-bottom: 1rem; }
.tpc [hidden], .tpc-tools[hidden], .tpc-tools [hidden] { display: none !important; }
.tpc-only-mobile { display: none !important; }
.tpc-spacer { flex: 1 1 auto; }

/* --- бутонът „Персонализирай“ --- */
.tpc-cta { display: none; margin-bottom: 14px; }
.tpc.is-closed .tpc-cta { display: block; }
.tpc-cta-btn {
    display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 18px; text-align: left;
    border: 0; border-radius: 14px; color: #fff; cursor: pointer;
    background: linear-gradient(135deg, var(--tpc-accent), color-mix(in srgb, var(--tpc-accent) 65%, #000));
    box-shadow: 0 10px 24px color-mix(in srgb, var(--tpc-accent) 35%, transparent);
}
.tpc-cta-btn > i:first-child { font-size: 1.5rem; }
.tpc-cta-btn strong { display: block; font-size: 1.1rem; }
.tpc-cta-btn small { display: block; opacity: .9; line-height: 1.3; }

/* --- платното --- */
.tpc-stage { background: var(--tpc-bg); border: 1px solid var(--tpc-border); border-radius: 16px; padding: 10px; }
.tpc.is-closed > .tpc-stage { display: none; }
.tpc-stage-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tpc-stage-title { font-weight: 700; color: #111827; }
.tpc-stage-title i { color: var(--tpc-accent); margin-right: 4px; }
.tpc-canvas-wrap { position: relative; display: flex; justify-content: center; align-items: center; min-height: 200px; }
.tpc-canvas-wrap .canvas-container { border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.tpc-busy { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; background: rgba(255,255,255,.82); border-radius: 12px; font-weight: 600; color: #111827; }
.tpc-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(0,0,0,.12); border-top-color: var(--tpc-accent); animation: tpc-spin .8s linear infinite; }
@keyframes tpc-spin { to { transform: rotate(360deg); } }
.tpc-warning { margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: #fff7e6; color: #8a5300; border: 1px solid #ffd58a; font-size: .875rem; }
.tpc-hint { margin-top: 8px; font-size: .85rem; color: var(--tpc-muted); text-align: center; }
.tpc.has-content .tpc-hint { display: none; }

.tpc-sides { display: flex; gap: 8px; justify-content: center; margin-top: 10px; overflow-x: auto; padding-bottom: 2px; }
.tpc-side { position: relative; flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; min-width: 64px; border: 2px solid transparent; border-radius: 12px; background: #fff; cursor: pointer; font-size: .78rem; color: #374151; }
.tpc-side img { width: 52px; height: 52px; object-fit: contain; border-radius: 8px; background: #fff; }
.tpc-side.is-active { border-color: var(--tpc-accent); color: #111827; font-weight: 700; }
.tpc-side .tpc-dot { position: absolute; top: 4px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--tpc-accent); box-shadow: 0 0 0 2px #fff; }

.tpc-colors-host { margin-top: 10px; }
.tpc-colors { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tpc-color { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); cursor: pointer; padding: 0; position: relative; }
.tpc-color.is-active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--tpc-accent); }
.tpc-colors-host .tpc-label { display: block; text-align: center; }

/* --- инструментите --- */
.tpc-tools { border: 1px solid var(--tpc-border); border-radius: 16px; padding: 12px; margin-bottom: 1.25rem; background: #fff; }
.tpc-tabs { display: flex; gap: 4px; background: var(--tpc-bg); padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.tpc-tab { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border: 0; border-radius: 9px; background: transparent; color: #4b5563; font-size: .8rem; font-weight: 600; cursor: pointer; min-width: 0; }
.tpc-tab i { font-size: 1.05rem; }
.tpc-tab.is-active { background: #fff; color: var(--tpc-accent); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tpc-panel { display: none; }
.tpc-panel.is-active { display: block; }
.tpc-label { display: block; font-size: .8rem; font-weight: 600; color: #374151; margin: 8px 0 4px; }
.tpc-row { display: flex; gap: 10px; flex-wrap: wrap; }
.tpc-grow { flex: 1 1 160px; min-width: 0; }
.tpc-text-input { resize: vertical; min-height: 54px; }
.tpc-seg { display: inline-flex; border: 1px solid var(--tpc-border); border-radius: 10px; overflow: hidden; }
.tpc-seg button { width: 38px; height: 38px; border: 0; background: #fff; color: #374151; cursor: pointer; }
.tpc-seg button + button { border-left: 1px solid var(--tpc-border); }
.tpc-seg button.is-on { background: var(--tpc-accent); color: #fff; }
.tpc-swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tpc-swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); cursor: pointer; padding: 0; }
.tpc-swatch.is-active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--tpc-accent); }
.tpc-swatch-free { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.tpc-swatch-free input { position: absolute; inset: -6px; opacity: 0; cursor: pointer; }
.tpc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; cursor: pointer; line-height: 1.2; }
.tpc-btn-primary { background: var(--tpc-accent); color: #fff; }
.tpc-btn-light { background: var(--tpc-bg); color: #111827; border-color: var(--tpc-border); }
.tpc-btn-sm { padding: 7px 12px; font-size: .9rem; }
.tpc-add-text { width: 100%; margin-top: 8px; }
.tpc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--tpc-border); background: #fff; font-size: .85rem; font-weight: 600; color: #374151; cursor: pointer; }
.tpc-icon { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--tpc-border); border-radius: 10px; background: #fff; color: #374151; cursor: pointer; }
.tpc-icon:disabled { opacity: .4; cursor: default; }

.tpc-upload { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 14px; border: 2px dashed var(--tpc-border); border-radius: 14px; text-align: center; cursor: pointer; color: #374151; background: var(--tpc-bg); }
.tpc-upload:hover { border-color: var(--tpc-accent); }
.tpc-upload i { font-size: 1.8rem; color: var(--tpc-accent); }
.tpc-upload small { color: var(--tpc-muted); }
.tpc-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tpc-upload-status { margin-top: 8px; color: var(--tpc-muted); }

.tpc-clipart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; padding: 2px; }
.tpc-clip { aspect-ratio: 1; border: 1px solid var(--tpc-border); border-radius: 10px; background: #fff; padding: 8px; cursor: pointer; }
.tpc-clip:hover { border-color: var(--tpc-accent); }
.tpc-clip img { width: 100%; height: 100%; object-fit: contain; }

.tpc-layers { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.tpc-layer { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--tpc-border); border-radius: 10px; cursor: pointer; background: #fff; }
.tpc-layer.is-active { border-color: var(--tpc-accent); background: color-mix(in srgb, var(--tpc-accent) 7%, #fff); }
.tpc-layer-thumb { width: 34px; height: 34px; border-radius: 6px; background: var(--tpc-bg); display: flex; align-items: center; justify-content: center; overflow: hidden; flex: 0 0 auto; }
.tpc-layer-thumb img { max-width: 100%; max-height: 100%; }
.tpc-layer-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; }
.tpc-layer button { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 8px; color: #4b5563; cursor: pointer; }
.tpc-layer button:hover { background: var(--tpc-bg); }
.tpc-layer-empty { color: var(--tpc-muted); font-size: .875rem; }

.tpc-objbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; padding: 6px; border-radius: 12px; background: var(--tpc-bg); }
.tpc-objbar button { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 8px; border: 1px solid var(--tpc-border); border-radius: 9px; background: #fff; font-size: .8rem; font-weight: 600; color: #374151; cursor: pointer; }
.tpc-objbar .tpc-danger { color: #b42318; }

.tpc-price { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--tpc-border); display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: .95rem; color: #374151; }
.tpc-price strong { font-size: 1.15rem; color: #111827; }
.tpc-price .tpc-extra { color: var(--tpc-accent); font-weight: 600; }

/* --- телефон: редакторът на цял екран --- */
.tpc-sheet { position: fixed; inset: 0; z-index: 1085; background: #fff; display: flex; flex-direction: column; height: 100dvh; }
.tpc-sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--tpc-border); flex: 0 0 auto; }
.tpc-sheet-title { flex: 1 1 auto; min-width: 0; line-height: 1.15; }
.tpc-sheet-title strong { display: block; font-size: .95rem; }
.tpc-sheet-price { font-size: .8rem; color: var(--tpc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.tpc-sheet-stage { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.tpc-sheet-stage .tpc-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; border: 0; border-radius: 0; padding: 6px 8px; }
.tpc-sheet-stage .tpc-stage-top { position: absolute; right: 10px; z-index: 5; margin: 0; }
.tpc-sheet-stage .tpc-canvas-wrap { flex: 1 1 0; min-height: 0; }
.tpc-sheet-stage .tpc-hint { display: none; }
.tpc-sheet-stage .tpc-sides { margin-top: 6px; }
.tpc-sheet-stage .tpc-side img { width: 40px; height: 40px; }
.tpc-sheet-tools { flex: 0 0 auto; }
.tpc-sheet-tools .tpc-tools { display: flex; flex-direction: column; border: 0; border-top: 1px solid var(--tpc-border); border-radius: 0; margin: 0; padding: 0; }
.tpc-sheet-tools .tpc-tabs { order: 9; margin: 0; border-radius: 0; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--tpc-border); }
.tpc-sheet-tools .tpc-tab.is-active { background: var(--tpc-bg); box-shadow: none; }
.tpc-sheet-tools .tpc-objbar { order: 1; margin: 6px 8px 0; }
.tpc-sheet-tools .tpc-objbar span { display: none; }
.tpc-sheet-tools .tpc-panel { order: 2; padding: 4px 12px 8px; max-height: 36dvh; overflow-y: auto; }
.tpc-sheet-tools .tpc-price { display: none; }
.tpc-sheet-tools .tpc-clipart-grid { max-height: none; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
.tpc-sheet.has-panel .tpc-sides { margin-top: 4px; }
.tpc-sheet.has-panel .tpc-side { flex-direction: row; gap: 6px; padding: 2px 8px 2px 2px; min-width: 0; }
.tpc-sheet.has-panel .tpc-side img { width: 28px; height: 28px; }
body.tpc-sheet-open { overflow: hidden; }

@media (max-width: 991.98px) {
    .tpc-only-desktop { display: none !important; }
    .tpc-only-mobile { display: flex !important; }
    .tpc .tpc-cta { display: block; }
    .tpc > .tpc-stage, .tpc > .tpc-tools { display: none; }
    .tpc-tab span { font-size: .72rem; }
}
@media (min-width: 992px) {
    .tpc-sheet { display: none !important; }
    .tpc.is-open ~ .product-gallery { display: none; }
}

/* Известие „Не е избрана щампа“ (require_design) */
.tpc-toast { position: fixed; z-index: 2000; top: 20px; left: 50%; transform: translate(-50%, -16px); opacity: 0; transition: transform .25s ease, opacity .25s ease;
    display: flex; align-items: flex-start; gap: 14px; width: min(440px, calc(100vw - 32px)); padding: 16px 44px 18px 16px; overflow: hidden;
    background: #fff; color: #111827; border-radius: 16px; border: 1px solid rgba(17, 24, 39, .08);
    box-shadow: 0 24px 48px -16px rgba(17, 24, 39, .35), 0 2px 6px rgba(17, 24, 39, .06); font-family: inherit; }
.tpc-toast.is-in { transform: translate(-50%, 0); opacity: 1; }
.tpc-toast-icon { flex: 0 0 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 18px;
    background: linear-gradient(135deg, #f59e0b, #ef4444); box-shadow: 0 8px 18px -8px rgba(239, 68, 68, .6); }
.tpc-toast-body { flex: 1; min-width: 0; }
.tpc-toast-body strong { display: block; font-size: 1rem; font-weight: 800; line-height: 1.25; }
.tpc-toast-body p { margin: 4px 0 12px; font-size: .88rem; color: #4b5563; line-height: 1.4; }
.tpc-toast-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tpc-toast-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; font-size: .85rem; font-weight: 700;
    border: 1px solid rgba(17, 24, 39, .14); background: #fff; color: #111827; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.tpc-toast-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -8px rgba(17, 24, 39, .4); }
.tpc-toast-btn.is-primary { border-color: transparent; color: #fff;
    background: linear-gradient(135deg, var(--primary-color, #0d6efd), color-mix(in srgb, var(--primary-color, #0d6efd) 65%, #000)); }
.tpc-toast-close { position: absolute; top: 8px; right: 10px; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent;
    color: #9ca3af; font-size: 22px; line-height: 1; cursor: pointer; }
.tpc-toast-close:hover { background: #f3f4f6; color: #111827; }
.tpc-toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; transform-origin: left;
    background: linear-gradient(90deg, #f59e0b, #ef4444); animation: tpcToastBar 8s linear forwards; }
@keyframes tpcToastBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (max-width: 576px) { .tpc-toast { top: auto; bottom: 16px; transform: translate(-50%, 16px); } .tpc-toast.is-in { transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .tpc-toast, .tpc-toast-bar { transition: none; animation: none; } }

/* 3D преглед */
.tpc-3d-btn { margin-left: 6px; }
.tpc-3d { position: fixed; inset: 0; z-index: 2100; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px); opacity: 0; transition: opacity .2s ease; }
.tpc-3d.is-in { opacity: 1; }
.tpc-3d-box { position: relative; width: min(760px, 100%); height: min(640px, calc(100vh - 32px)); background: radial-gradient(circle at 50% 35%, #ffffff 0%, #eef1f6 70%); border-radius: 20px; overflow: hidden; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .6); }
.tpc-3d-mv { width: 100%; height: 100%; background: transparent; --poster-color: transparent; }
.tpc-3d-close { position: absolute; top: 10px; right: 12px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .4); font-size: 24px; line-height: 1; cursor: pointer; }
.tpc-3d-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 7px 14px; border-radius: 999px; background: rgba(255, 255, 255, .9); font-size: .85rem; color: #334155; white-space: nowrap; box-shadow: 0 4px 14px -8px rgba(0, 0, 0, .35); }
.tpc-3d-loading { position: absolute; inset: 0; display: none; place-items: center; }
.tpc-3d.is-loading .tpc-3d-loading { display: grid; }
@media (max-width: 576px) { .tpc-3d-hint { white-space: normal; text-align: center; width: calc(100% - 32px); } }

/* QR кодовете на стикерите */
.tpc-qr-intro { font-size: .85rem; color: var(--tpc-muted); margin: 0 0 10px; }
.tpc-qr-field { margin-bottom: 12px; }
.tpc-qr-wifi { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tpc-qr-help { display: block; font-size: .78rem; color: var(--tpc-muted); margin-top: 4px; line-height: 1.35; }
.tpc-qr-ok { color: #16a34a; margin-left: 4px; }
.tpc-qr-field.is-busy .tpc-label::after { content: " …"; color: var(--tpc-muted); }

/* Стикерите: бележка, че QR кодът идва от TapTo */
.tpc-sys-note{display:flex;gap:8px;align-items:flex-start;margin:8px 0 0;padding:8px 12px;border-radius:12px;background:#eef2ff;color:#3730a3;font-size:.8rem;line-height:1.35}
.tpc-sys-note i{margin-top:2px}

/* Слоевете винаги видими на компютъра; на телефона остават в раздела */
.tpc-tools > .tpc-layers-box { display: block; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--tpc-border); }
.tpc-tab[data-tab="layers"] { display: none; }
.tpc-sheet-tools .tpc-tab[data-tab="layers"] { display: flex; }
.tpc-sheet-tools .tpc-tools > .tpc-layers-box { margin-top: 0; border-top: 0; }
.tpc-sheet-tools .tpc-tools > .tpc-layers-box:not(.is-active) { display: none; }
.tpc-sheet-tools .tpc-layers-title { display: none; }
.tpc-layers-title { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.tpc-layer.is-locked { cursor: default; background: var(--tpc-bg); }
.tpc-layer.is-locked .tpc-layer-lock { color: var(--tpc-muted); padding: 0 8px; }
/* Меню с десния бутон върху елемент */
.tpc-ctx { position: fixed; z-index: 100000; min-width: 190px; padding: 6px; background: #fff; border: 1px solid var(--tpc-border); border-radius: 12px; box-shadow: 0 16px 40px -12px rgba(15,23,42,.35); }
.tpc-ctx button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 8px; font-size: .875rem; color: #0f172a; cursor: pointer; text-align: left; }
.tpc-ctx button:hover { background: var(--tpc-bg); }
.tpc-ctx button i { width: 16px; color: #64748b; }
.tpc-ctx .tpc-ctx-danger, .tpc-ctx .tpc-ctx-danger i { color: #dc2626; }
.tpc-ctx hr { margin: 4px 6px; border: 0; border-top: 1px solid var(--tpc-border); }

/* Стикери/етикети (печата се целият фон): платното в истинската форма — без заобляне и бял фон отзад.
   Правоъгълните етикети са с прави ъгли, а заоблените стикери носят формата си в самата картинка. */
.tpc.is-print .tpc-canvas-wrap .canvas-container { border-radius: 0; background: transparent; box-shadow: none; }
