/* ─────────────────────────────────────────────────────
   Canvas Designer – Phase 4
   ───────────────────────────────────────────────────── */

/* ── Layout wrapper ──────────────────────────── */
#canvas-designer {
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
    border-radius: 0px;
    overflow: hidden;
    margin: 55px 0 0;
    height: calc(100vh - 56px);
}

/* ── Top bar ─────────────────────────────────── */
.cd-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: #1b2838;
    color: #fff;
    flex-shrink: 0;
    gap: 10px;
    flex-wrap: wrap;
}

.cd-topbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cd-topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Bottom action bar (inside cd-canvas-col) ── */
.cd-bottom-bar {
    position: absolute;
    bottom: 2px;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 8px;
    border-top: 1px solid #e3dfdf;
    flex-wrap: nowrap;
    background: rgb(233,236,239);
    backdrop-filter: blur(4px);
    z-index: 5;
}
.cd-bottom-bar .cd-btn {
    flex: 1;
    justify-content: center;
    max-width: 160px;
}

.cd-product-label { font-size: 11px; color: #7a9ab5; text-transform: uppercase; letter-spacing: .5px; }

.cd-price-display { font-size: 12px; color: #e6bc29; font-weight: 600; margin-bottom: 4px; }
.cd-price-display .cd-price-was { font-size: 11px; color: rgba(255,255,255,.35); text-decoration: line-through; margin-right: 4px; font-weight: 400; }
.cd-price-display .cd-price-ea { font-size: 11px; color: rgba(255,255,255,.45); font-weight: 400; margin-left: 2px; }

#cd-resolution-warning {
    display: none;
    position: absolute;
    bottom: 50px; /* sits just above the bottom bar */
    left: 8px;
    right: 8px;
    z-index: 6;
    padding: 7px 12px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 5px;
    font-size: 12px;
    color: #7a4800;
    text-align: center;
    white-space: normal;
}
#cd-resolution-warning i { margin-right: 5px; color: #f59e0b; }

#cd-product-select {
    background: #2a3f57;
    color: #fff;
    border: 1px solid #3a5068;
    border-radius: 4px;
    padding: 5px 2px 5px 5px;
    font-size: 13px;
    cursor: pointer;
    max-width: 200px;
}

.cd-orientation-wrap { display: flex; border: 1px solid #3a5068; border-radius: 4px; overflow: hidden; }
.cd-orientation-btn {
    padding: 5px 8px;
    border: none;
    background: transparent;
    font-size: 12px;
    color: #7a9ab5;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.cd-orientation-btn.active { background: #3a5068; color: #fff; }

/* ── Variation cards (topbar) ────────────────── */
.cd-variation-wrap { display: flex; align-items: center; gap: 4px; }
.cd-var-card {
    cursor: pointer;
    padding: 5px 8px;
    border: 1px solid #3a5068;
    border-radius: 4px;
    background: transparent;
    transition: border-color .15s, background .15s, color .15s;
    font-size: 12px;
    color: #7a9ab5;
    white-space: nowrap;
}
.cd-var-card:hover { border-color: #5a7a99; background: rgba(255,255,255,.06); color: #c0d8ee; }
.cd-var-card.selected { background: #3a5068; color: #fff; border-color: #3a5068; }

.cd-bleed-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    background: transparent;
    border: 1px solid #3a5068;
    border-radius: 4px;
    color: #7a9ab5;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.cd-bleed-toggle:hover { background: #2a3f57; color: #c8d6e0; }
.cd-bleed-toggle.active { background: rgba(220,50,50,0.18); border-color: rgba(220,50,50,0.6); color: #ff8080; }

/* ── Buttons ─────────────────────────────────── */
.cd-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    white-space: nowrap;
}
.cd-btn:hover { opacity: .88; }
.cd-btn:active { transform: scale(.97); }
.cd-btn:disabled { opacity: .45; cursor: not-allowed; }
.cd-btn-primary  { background: #e6bc29; color: #1b2838; }
.cd-btn-secondary{ background: #3a5068; color: #fff; }
.cd-btn-danger   { background: #dc3545; color: #fff; }

/* ── Main flex body ──────────────────────────── */
.cd-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ── Sidebar outer wrapper ───────────────────── */
.cd-sidebar-outer {
    display: flex;
    flex-shrink: 0;
    position: relative;
}

/* ── Icon strip (always visible) ────────────── */
.cd-icon-strip {
    width: 46px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    z-index: 1;
}

.cd-tab {
    width: 46px;
    height: 52px;
    flex-shrink: 0;
    border: none;
    background: none;
    color: #aaa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border-left: 3px solid transparent;
    transition: color .15s, background .15s, border-color .15s;
    padding: 0;
}
.cd-tab.active { color: #1b2838; border-left-color: #e6bc29; background: #f8f9fa; }
.cd-tab:hover:not(.active) { color: #1b2838; background: #f0f2f5; }

/* ── Sidebar toggle (inside icon strip) ──────── */
.cd-sidebar-toggle {
    width: 46px;
    height: 48px;
    flex-shrink: 0;
    margin-top: auto;
    border: none;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background .15s, color .15s;
    padding: 0;
}
.cd-sidebar-toggle:hover { background: #e9ecef; color: #1b2838; }
.cd-main.sidebar-open .cd-sidebar-toggle { background: #1b2838; color: #e6bc29; border-top-color: #2a3f57; }
.cd-main.sidebar-open .cd-sidebar-toggle:hover { background: #2a3f57; color: #fed136; }

/* ── Collapsible panel ───────────────────────── */
.cd-sidebar {
    position: absolute;
    left: 46px;
    top: 0;
    bottom: 0;
    width: 300px;
    background: #fff;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width .25s ease, opacity .2s ease;
    z-index: 6;
}
.cd-sidebar.collapsed {
    width: 0;
    opacity: 0;
    border-right: none;
}

.cd-tab-panel {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    flex-direction: column;
}
.cd-tab-panel.active { display: flex; }

/* ── Upload area ─────────────────────────────── */
.cd-upload-zone {
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    padding: 14px 8px;
    text-align: center;
    cursor: pointer;
    color: #bbb;
    font-size: 11px;
    transition: border-color .15s, color .15s;
    flex-shrink: 0;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.cd-upload-zone:hover,
.cd-upload-zone.dz-drag-hover { border-color: #e6bc29; color: #888; }
.cd-upload-zone i { font-size: 20px; margin-bottom: 5px; display: block; }
.cd-upload-zone i,
.cd-upload-zone span,
.cd-upload-zone small { pointer-events: none; }

/* ── Add Tile / Add to Cart button (strip sidebar) ─────────── */
.cd-strip-sidebar #cd-add-to-cart { margin-top: auto; width: 100%; }
.cd-save-tile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin: 0 0 8px;
    padding: 8px 0;
    background: #e6bc29;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #1b2838;
    cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
}
.cd-save-tile-btn:hover { background: #d4a91e; }

/* ── Auto populate ───────────────────────────── */
.cd-auto-populate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    margin-top: 8px;
    padding: 6px 10px;
    background: #f0f2f5;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    font-size: 12px;
    color: #5a7a99;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.cd-auto-populate-btn:hover { background: #e6bc29; border-color: #e6bc29; color: #1b2838; }

/* ── Photo pool ──────────────────────────────── */
.cd-photo-pool {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-top: 10px;
    align-content: start;
}

.cd-pool-thumb {
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    cursor: grab;
    border: 2px solid transparent;
    transition: border-color .15s, transform .1s, opacity .15s;
    position: relative;
}
.cd-pool-thumb:hover { border-color: #e6bc29; transform: scale(1.05); }
.cd-pool-thumb.in-use { border-color: #e6bc29; }
.cd-pool-thumb.cd-dragging { opacity: 0.35; cursor: grabbing; transform: none; }
.cd-pool-thumb.in-use::after {
    content: '✓';
    position: absolute;
    bottom: 3px; left: 3px;
    background: #e6bc29;
    color: #1b2838;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
    border-radius: 2px;
    padding: 2px 3px;
    pointer-events: none;
}
.cd-pool-count {
    position: absolute;
    top: 3px; right: 3px;
    background: #1b2838;
    color: #e6bc29;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    border-radius: 2px;
    padding: 2px 4px;
    pointer-events: none;
}

/* ── Layouts ─────────────────────────────────── */
.cd-layouts-list { display: flex; flex-direction: column; gap: 8px; }

.cd-layout-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: grab;
    transition: border-color .15s, background .15s;
}
.cd-layout-item:active { cursor: grabbing; }
.cd-layout-item:hover { border-color: #adb5bd; background: #f8f9fa; }
.cd-layout-item.active { border-color: #e6bc29; background: #fffdf0; }

.cd-layout-preview { flex-shrink: 0; width: 52px; }
.cd-layout-name { font-size: 12px; color: #444; font-weight: 600; line-height: 1.3; }
.cd-layout-name-main { display: block; }
.cd-layout-name-sub { font-size: 10px; font-weight: 400; color: #888; }

/* ── Backgrounds ─────────────────────────────── */
.cd-bg-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    align-content: start;
}

.cd-bg-swatch {
    aspect-ratio: 1;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid #e9ecef;
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
    transition: transform .12s, border-color .12s;
}
.cd-bg-swatch:hover { transform: scale(1.12); }
.cd-bg-swatch.active { border-color: #e6bc29; box-shadow: 0 0 0 3px rgba(230,188,41,.3); }

/* ── Canvas column ───────────────────────────── */
.cd-canvas-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    align-items: stretch;
    justify-content: flex-start;
    padding: 10px 10px 56px;
    background: #f0f2f5;
    min-width: 0;
    overflow: hidden;
    transition: margin-left .25s ease;
}
.cd-main.sidebar-open .cd-canvas-col {
    margin-left: 346px; /* 46px icon strip + 300px panel */
}

/* Scrollable centring container for the canvas */
.cd-vp-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
}
.cd-canvas-viewport {
    width: 100%;
    height: 100%;
    overflow: scroll;
    scrollbar-width: none;
}
.cd-canvas-viewport::-webkit-scrollbar { display: none; }

#cd-zoom-spacer {
    min-width: 100%;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Floating scrollbars ─────────────────── */
.cd-scrollbar {
    position: absolute;
    z-index: 20;
    display: none;
    background: rgba(27,40,56,0.35);
    border-radius: 8px;
}
.cd-scrollbar.active { display: block; pointer-events: auto; }
.cd-scrollbar-y { right: 4px; top: 4px; bottom: 4px; width: 14px; }
.cd-scrollbar-x { bottom: -6px; left: 4px; right: 22px; height: 14px; }

.cd-scrollbar-thumb {
    position: absolute;
    background: rgba(230,188,41,0.6);
    border-radius: 5px;
    cursor: grab;
    transition: background 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
/* Y thumb fills the track width with 3px inset each side */
.cd-scrollbar-y .cd-scrollbar-thumb  { left: 3px; right: 3px; min-height: 28px; }
/* X thumb fills the track height with 3px inset each side */
.cd-scrollbar-x .cd-scrollbar-thumb  { top: 3px; bottom: 3px; min-width: 28px; }
.cd-scrollbar-thumb:hover { background: #f5cd42; }
.cd-scrollbar-thumb.dragging { background: #ffd84d; cursor: grabbing; }

.cd-canvas-wrap {
    position: relative;
    filter: drop-shadow(0 6px 24px rgba(0,0,0,.2));
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
    transform-origin: center center;
    transition: transform .15s ease;
}

/* ── Canvas action bar (wrapper row) ─────────── */
.cd-canvas-action-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 4px;
    flex-shrink: 0;
    width: 100%;
}
.cd-zoom-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Zoom bar (pill) ──────────────────────────── */
.cd-zoom-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e0e4e9;
    border-radius: 20px;
    padding: 5px 12px;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.cd-zoom-btn {
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    padding: 2px 5px;
    font-size: 12px;
    border-radius: 4px;
    line-height: 1;
    transition: background .15s, color .15s;
}
.cd-zoom-btn:hover { background: #f0f2f5; color: #1b2838; }
.cd-zoom-reset { margin-left: 2px; color: #aaa; }
.cd-zoom-reset:hover { color: #e6bc29; }
.cd-action-save { margin-left: 8px; border-left: 1px solid #dee2e6; padding-left: 10px; color: #aaa; }
.cd-action-save:hover { color: #e6bc29; }
#cd-zoom-slider {
    width: 120px;
    accent-color: #1b2838;
    cursor: pointer;
}
.cd-zoom-label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    min-width: 36px;
    text-align: center;
}

.cd-canvas-tooltip {
    position: fixed;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 9999;
}

/* ── Zone resize handles ─────────────────────── */
#cd-resize-handles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.cd-rh {
    position: absolute;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cd-rh-v {
    width: 20px;
    transform: translateX(-50%);
    cursor: ew-resize;
}
.cd-rh-h {
    height: 20px;
    transform: translateY(-50%);
    cursor: ns-resize;
}
.cd-rh::after {
    content: '';
    border-radius: 3px;
    background: rgba(230,188,41,0.92);
    box-shadow: 0 1px 5px rgba(0,0,0,0.35);
    transition: background .12s, transform .12s;
}
.cd-rh-v::after { width: 4px; height: 32px; }
.cd-rh-h::after { width: 32px; height: 4px; }
.cd-rh:hover::after {
    background: #e6bc29;
    transform: scale(1.25);
}

.cd-canvas-hint { display: none; }

.cd-zoom-hint-icon {
    margin-left: auto;
    font-size: 14px;
    color: #bbb;
    cursor: default;
    display: none;
    transition: color .15s;
}
.cd-zoom-hint-icon:hover { color: #1b2838; }
@media (min-width: 992px) {
    .cd-zoom-hint-icon { display: flex; align-items: center; }
}


/* ── Save-project modal ──────────────────────── */
#cd-save-project-modal {
    position: fixed;
    inset: 0;
    z-index: 9950;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cd-save-project-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
}
.cd-save-project-content {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 10px;
    padding: 28px 32px 24px;
    width: 420px;
    max-width: 94vw;
    box-shadow: 0 12px 40px rgba(0,0,0,0.28);
}
.cd-save-project-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.cd-save-project-header h6 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1b2838;
}
.cd-save-project-cancel {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #888;
    padding: 0 4px;
}
.cd-save-project-cancel:hover { color: #333; }
.cd-save-project-hint {
    font-size: 13px;
    color: #666;
    margin: 0 0 16px;
}
.cd-save-project-name-input {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid #c8d0db;
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 15px;
    color: #1b2838;
    outline: none;
    margin-bottom: 10px;
    transition: border-color .15s;
}
.cd-save-project-name-input:focus { border-color: #3a7bd5; }
.cd-save-project-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ── Toast notification ──────────────────────── */
.cd-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: #1b2838;
    color: #fff;
    padding: 11px 22px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s, transform .25s;
    z-index: 99999;
    white-space: nowrap;
}
.cd-toast.cd-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Photo picker modal ──────────────────────── */
#cd-picker-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9900;
}
.cd-picker-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
}
.cd-picker-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    width: min(420px, 90vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
}
.cd-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.cd-picker-header h6 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #1b2838;
}
.cd-picker-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
}
.cd-picker-photos {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.cd-picker-thumb {
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s, transform .1s;
}
.cd-picker-thumb:hover { border-color: #e6bc29; transform: scale(1.06); }
.cd-picker-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px;
    color: #aaa;
    font-size: 13px;
}
.cd-picker-upload-btn {
    margin-top: 12px;
    width: 100%;
    padding: 9px;
    background: #1b2838;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Bottom tile strip ───────────────────────── */
.cd-strip {
    border-top: 1px solid #2a3f57;
    background: #1b2838;
    padding: 8px 0px 4px 12px;
    flex-shrink: 0;
    display: flex;
    gap: 12px;
    height: 200px;
    min-height: 80px;
    max-height: 420px;
    overflow: hidden;
    position: relative;
    align-items: flex-start;
}

.cd-strip-resizer {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    cursor: row-resize;
    z-index: 5;
}
.cd-strip-resizer::after {
    content: '';
    position: absolute;
    top: 2px; left: 50%;
    transform: translateX(-50%);
    width: 36px; height: 2px;
    border-radius: 2px;
    background: rgba(255,255,255,0.15);
    transition: background .15s;
}
.cd-strip-resizer:hover::after,
.cd-strip-resizer.dragging::after { background: #e6bc29; }
.cd-strip-sidebar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    flex-shrink: 0;
    min-width: 150px;
    max-width: 170px;
    height: 100%;
    padding-right: 10px;
    border-right: 1px solid #2a3f57;
    align-self: stretch;
}

.cd-strip-label {
    font-size: 11px;
    font-weight: 600;
    color: #7a9ab5;
    text-transform: uppercase;
    letter-spacing: .6px;
    display: flex;
    align-items: center;
	width:100%;
    justify-content: space-between;
}
#cd-clear-strip {
    background: none;
    border: none;
    color: #e05555;
    margin-left: auto;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    line-height: 1;
    transition: color .15s;
}
#cd-clear-strip:hover { color: #ff6b6b; }

.cd-strip-summary {
    font-size: 10px;
    line-height: 1.5;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #2a3f57 transparent;
}
.cd-sum-row {
    display: flex;
    align-items: baseline;
    gap: 3px;
    width: 100%;
}
.cd-sum-qty {
    color: #5a7a99;
    min-width: 16px;
    text-align: right;
    flex-shrink: 0;
}
.cd-sum-label {
    color: #5a7a99;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cd-sum-price {
    color: #e6bc29;
    font-weight: 600;
    flex-shrink: 0;
    text-align: right;
}
.cd-sum-divider {
    border-top: 1px solid #2a3f57;
    margin: 3px 0;
    width: 100%;
}
.cd-sum-total .cd-sum-label { color: #8aacca; font-weight: 600; }
.cd-sum-total .cd-sum-price { color: #fff; }

.cd-btn-sm {
    font-size: 11px !important;
    padding: 5px 8px !important;
    white-space: nowrap;
}
.cd-strip-scroll-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    overflow: hidden;
}
.cd-strip-tiles { display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
.cd-strip-tiles::-webkit-scrollbar { display: none; }
.cd-strip-scroll-btn {
    position: absolute;
    top: 0; bottom: 0;
    z-index: 6;
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0 10px;
    transition: opacity .15s;
}
.cd-strip-scroll-prev {
    left: 0;
    background: linear-gradient(to right, #1b2838 90%, transparent);
}
.cd-strip-scroll-next {
    right: 0;
    background: linear-gradient(to left, #1b2838 90%, transparent);
}
.cd-strip-scroll-btn:hover { opacity: .8; }

.cd-strip-tile-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.cd-strip-size-label {
    font-size: 10px;
    color: #8aacca;
    font-weight: 600;
    text-align: center;
    letter-spacing: .2px;
    margin: 3px 0 1px;
    white-space: nowrap;
}
.cd-strip-tile-footer {
    display: flex;
    align-items: center;
    gap: 5px;
}

.cd-strip-tile-order {
    font-size: 10px;
    color: #5a7a99;
    font-weight: 600;
    letter-spacing: .3px;
    white-space: nowrap;
}

.cd-strip-tile-qty {
    font-size: 11px;
    background: #1b2838;
    color: #c8d6e0;
    border: 1px solid #2a3f57;
    border-radius: 4px;
    padding: 1px 4px;
    cursor: pointer;
    outline: none;
}
.cd-strip-tile-qty:hover,
.cd-strip-tile-qty:focus { border-color: #e6bc29; }

.cd-strip-tile-imgwrap {
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cd-strip-tile {
    position: relative;
    /* width & height set inline by JS to match product orientation */
    flex-shrink: 0;
    border-radius: 5px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .15s;
}
.cd-strip-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cd-strip-tile:hover { border-color: #e6bc29; }
.cd-strip-tile.editing { border-color: #e6bc29; box-shadow: 0 0 0 2px rgba(230,188,41,.35); }
.cd-strip-tile-wrap.cd-layout-drop-target .cd-strip-tile { border-color: #4dabf7; box-shadow: 0 0 0 2px rgba(77,171,247,.4); }
#cd-canvas-wrap.cd-drag-layout-over { outline: 3px dashed #4dabf7; outline-offset: 4px; }

.cd-strip-tile-spinner {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.52);
    display: flex; align-items: center; justify-content: center;
    border-radius: 3px;
    pointer-events: none;
}
.cd-strip-tile-spinner::after {
    content: '';
    width: 22px; height: 22px;
    border: 3px solid rgba(255,255,255,0.25);
    border-top-color: #e6bc29;
    border-radius: 50%;
    animation: cd-spin .65s linear infinite;
}

.cd-strip-del {
    background: none;
    border: none;
    color: #3a5068;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    line-height: 1;
    margin-left: 4px;
    flex-shrink: 0;
}
.cd-strip-del:hover { color: #e05555; }

.cd-strip-warn-badge {
    position: absolute;
    z-index: 3;
    top: 4px; right: 4px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    color: #f59e0b;
    font-size: 11px;
    padding: 2px 5px;
    border-radius: 3px;
    line-height: 1;
    z-index: 2;
    cursor: default;
}

.cd-strip-add-btn {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    border: 2px dashed #3a5068;
    border-radius: 5px;
    background: none;
    color: #5a7a99;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .15s, color .15s;
}
.cd-strip-add-btn:hover { border-color: #e6bc29; color: #e6bc29; }

.cd-strip-empty { color: #3a5068; font-size: 12px; }

/* ── Spinner ─────────────────────────────────── */
.cd-spin {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cd-spin .6s linear infinite;
    vertical-align: middle;
}
@keyframes cd-spin { to { transform: rotate(360deg); } }

/* ── Options tab ─────────────────────────────── */
.cd-option-component {
    padding: 10px 12px 8px;
    border-bottom: 1px solid #e8ecf0;
}
.cd-option-component:last-child { border-bottom: none; }

.cd-option-label {
    font-size: 11px;
    font-weight: 700;
    color: #5a7a99;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
}

.cd-option-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cd-option-swatch-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.cd-option-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    box-sizing: border-box;
    background-size: cover;
    background-position: center;
    transition: border-color .15s, box-shadow .15s, transform .1s;
}
.cd-option-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 2px rgba(230,188,41,.45);
}
.cd-option-swatch.selected {
    border-color: #e53935;
    box-shadow: 0 0 0 2px rgba(229,57,53,.35);
}

/* Colour swatches for frame_colour (when no thumbnail) */
.cd-option-swatch[data-frame="b"] { background-color: #111; }
.cd-option-swatch[data-frame="w"] { background-color: #fff; border-color: #c8d0db; }
.cd-option-swatch[data-frame="w"].selected { border-color: #e53935; }

.cd-option-swatch-label {
    font-size: 10px;
    color: #7a9ab5;
    text-align: center;
    max-width: 48px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Admin canvas styles (admin.phtml) ───────── */
.adm-layout-handle:hover { color: #888 !important; }
.adm-layout-placeholder {
    border: 2px dashed #e6bc29;
    border-radius: 8px;
    background: rgba(230,188,41,.06);
    visibility: visible !important;
}
.adm-layout-col.ui-sortable-helper { box-shadow: 0 4px 16px rgba(0,0,0,.15); opacity: .92; }
.adm-canvas-product-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 24px;
    overflow: hidden;
}
.adm-canvas-product-header {
    background: #f8f9fa;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
}
.adm-canvas-product-body { padding: 18px; display: none; }
.adm-canvas-product-body.open { display: block; }

.adm-zone-editor {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-top: 12px;
}
.adm-zone-canvas {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
    position: relative;
    flex-shrink: 0;
}
.adm-zone-rect {
    position: absolute;
    border: 2px solid #e6bc29;
    background: rgba(230,188,41,.15);
    border-radius: 2px;
    box-sizing: border-box;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #888;
    user-select: none;
}
.adm-zone-resize-handle {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    background: #e6bc29;
    border-radius: 1px;
    cursor: se-resize;
}

.adm-bg-swatch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.adm-bg-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 4px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 12px;
}
.adm-bg-chip-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #e0e0e0;
}
.adm-bg-chip-del {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 12px;
    padding: 0 2px;
    line-height: 1;
}

/* ── Zone photo editor modal ─────────────────────── */
#cd-zone-editor-modal {
    display: none;
    position: fixed; inset: 0; z-index: 1060;
    align-items: center; justify-content: center;
}
#cd-zone-editor-modal.active { display: flex; }

.cd-zone-editor-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.6);
}

.cd-zone-editor-content {
    position: relative; z-index: 1;
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    width: calc(100% - 40px);
    max-width: 560px;
    max-height: calc(100svh - 40px);
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.28);
}

.cd-zone-editor-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
}
.cd-zone-editor-header h6 {
    margin: 0; font-size: 15px; font-weight: 600; color: #222;
}
.cd-zone-editor-header button {
    background: none; border: none; font-size: 24px; line-height: 1;
    color: #777; cursor: pointer; padding: 0 4px;
}
.cd-zone-editor-header button:hover { color: #222; }

.cd-zone-editor-hint {
    font-size: 11px; color: #999; margin: 0 0 10px; text-align: center;
}

.cd-zone-editor-preview {
    display: flex; justify-content: center;
    background: #2a2a2a; border-radius: 6px;
    overflow: hidden; margin-bottom: 12px;
}
.cd-zone-editor-preview canvas {
    display: block; cursor: grab; touch-action: none;
}
.cd-zone-editor-preview canvas:active { cursor: grabbing; }

.cd-zone-editor-toolbar {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-bottom: 14px;
}
.cd-zone-editor-toolbar button {
    background: #f0f0f0; border: 1px solid #d0d0d0; border-radius: 5px;
    padding: 5px 14px; font-size: 16px; cursor: pointer; line-height: 1.2;
    transition: background .12s;
}
.cd-zone-editor-toolbar button:hover { background: #e0e0e0; }
#cd-zone-editor-zoom-label {
    font-size: 13px; color: #555; min-width: 46px; text-align: center;
    font-variant-numeric: tabular-nums;
}
#cd-zone-editor-reset { font-size: 12px !important; }

/* ── Mobile adjustments ──────────────────────── */
@media (max-width: 767px) {
    .cd-canvas-col {
        padding: 6px 0 50px 0;
    }
    .cd-product-label { display: none; }

    #cd-zone-editor-modal {
        align-items: flex-start;
        padding: 20px 0;
    }
    .cd-zone-editor-content {
        width: calc(100% - 24px);
        padding: 14px;
        border-radius: 8px;
    }
}

.cd-zone-editor-warning {
    margin: 0 0 12px;
    padding: 7px 12px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 5px;
    font-size: 12px;
    color: #7a4800;
    text-align: center;
}
.cd-zone-editor-warning i { margin-right: 5px; color: #f59e0b; }

.cd-zone-editor-footer {
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ── Frame colour / border option tools (per-tile strip) ─────────────── */
.tile-container .tool-container {
    background-color: #e9ecef;
    border-radius: 4px;
    padding: 4px 4px 4px 10px;
    margin-top: 8px;
    margin-right: 10px;
}
.tool-container .label {
    color: #333;
    font-size: 75%;
    display: inline-block;
    line-height: 30px;
}
.tool-container .frame-colour,
.tool-container .frame-option {
    width: 22px;
    height: 22px;
    background-size: cover;
    background-repeat: no-repeat;
    cursor: pointer;
    display: inline-block;
    position: relative;
    top: 5px;
    border-radius: 3px;
}
.tool-container .frame-colour.selected,
.tool-container .frame-option.selected {
    outline: 3px solid #e53935;
    border-radius: 50%;
}
.tool-container .frame-colour.f-b,
.tool-container .frame-option.f-b {
    background-image: url(/img/designer/border-options/fbb.png);
    margin-right: 38px;
}
.tool-container .frame-colour.f-w,
.tool-container .frame-option.f-w {
    background-image: url(/img/designer/border-options/fwb.png);
    margin-right: 38px;
}
.tool-container .frame-colour.f-b:after,
.tool-container .frame-option.f-b:after {
    content: "Black";
    position: relative;
    top: -3px;
    left: 24px;
    font-size: 12px;
    color: #555;
}
.tool-container .frame-colour.f-w:after,
.tool-container .frame-option.f-w:after {
    content: "White";
    position: relative;
    top: -3px;
    left: 24px;
    font-size: 12px;
    color: #555;
}
.tool-container .frame-colour.selected:after,
.tool-container .frame-option.selected:after {
    color: #e53935;
}

/* ── Exit confirm modal ──────────────────────── */
#cd-exit-modal {
    position: fixed;
    inset: 0;
    z-index: 9960;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cd-exit-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}
.cd-exit-content {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 10px;
    padding: 28px 32px 24px;
    width: 400px;
    max-width: 94vw;
    box-shadow: 0 12px 40px rgba(0,0,0,0.32);
}
.cd-exit-content h6 {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 700;
    color: #1b2838;
}
.cd-exit-content p {
    font-size: 13px;
    color: #555;
    margin: 0 0 20px;
}
.cd-exit-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.cd-exit-footer #cd-exit-leave   { opacity: .75; }
.cd-exit-footer #cd-exit-leave:hover { opacity: 1; }
