/* =========================================================
   SUPERGIRL Product Customize V5.16
   Scope: Product/customize.twig only
   Functionality is intentionally untouched.
   ========================================================= */

body.sg-product-customize-page {
    --sgc-bg: #050505;
    --sgc-surface: #101010;
    --sgc-surface-2: #171717;
    --sgc-surface-3: #202020;
    --sgc-border: rgba(255,255,255,.12);
    --sgc-border-strong: rgba(255,255,255,.22);
    --sgc-text: #ffffff;
    --sgc-muted: #a7a7a7;
    --sgc-accent: #ef6440;
    --sgc-accent-dark: #cf4728;
    --sgc-danger: #ff5b62;
    --sgc-radius: 12px;
    background: var(--sgc-bg);
    color: var(--sgc-text);
    font-family: "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

/* Keep the normal EC-CUBE frame, header and footer, but give this tool full width. */
body.sg-product-customize-page .ec-layoutRole__contents {
    display: block;
    width: 100%;
    max-width: none;
    padding: 0;
    background: var(--sgc-bg);
}
body.sg-product-customize-page .ec-layoutRole__main,
body.sg-product-customize-page .ec-layoutRole__mainWithColumn,
body.sg-product-customize-page .ec-layoutRole__mainBetweenColumn {
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: 0;
    margin: 0;
}
body.sg-product-customize-page .ec-layoutRole__left,
body.sg-product-customize-page .ec-layoutRole__right {
    display: none !important;
}
body.sg-product-customize-page .ec-layoutRole__header,
body.sg-product-customize-page .ec-layoutRole__footer {
    position: relative;
    z-index: 30;
}

body.sg-product-customize-page .pz-page,
body.sg-product-customize-page .pz-page * {
    box-sizing: border-box;
}

body.sg-product-customize-page .pz-page {
    position: relative;
    min-height: 760px;
    padding: 34px clamp(14px, 2.8vw, 44px) 64px;
    overflow: hidden;
    color: var(--sgc-text);
    background:
        radial-gradient(circle at 12% 0%, rgba(239,100,64,.16), transparent 28%),
        radial-gradient(circle at 92% 16%, rgba(255,255,255,.06), transparent 24%),
        linear-gradient(180deg, #0a0a0a 0%, #050505 58%, #000 100%);
}
body.sg-product-customize-page .pz-page::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .28;
    background-image:
        linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 34px 34px;
}
body.sg-product-customize-page .pz-page > * {
    position: relative;
    z-index: 1;
}

/* Page title / action bar */
body.sg-product-customize-page .pz-header {
    max-width: 1440px;
    min-height: 86px;
    margin: 0 auto 20px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid var(--sgc-border);
    border-radius: var(--sgc-radius);
    background: rgba(16,16,16,.88);
    box-shadow: 0 18px 50px rgba(0,0,0,.32);
    backdrop-filter: blur(12px);
}
body.sg-product-customize-page .pz-title {
    min-width: 0;
    margin: 0;
    color: var(--sgc-text);
    font-size: clamp(20px, 2vw, 30px);
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: .02em;
}
body.sg-product-customize-page .pz-title::before {
    content: "CUSTOM DESIGN";
    display: block;
    margin-bottom: 6px;
    color: var(--sgc-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .2em;
}
body.sg-product-customize-page .pz-title span {
    display: block;
    max-width: 760px;
    margin-top: 7px;
    overflow: hidden;
    color: var(--sgc-muted);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body.sg-product-customize-page .pz-headerActions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    flex-wrap: wrap;
}

/* Main editor grid */
body.sg-product-customize-page .pz-layout {
    max-width: 1440px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 300px minmax(420px, 1fr) 300px;
    gap: 16px;
    align-items: start;
}
body.sg-product-customize-page .pz-panel,
body.sg-product-customize-page .pz-canvasPanel {
    min-width: 0;
    border: 1px solid var(--sgc-border);
    border-radius: var(--sgc-radius);
    background: linear-gradient(180deg, rgba(24,24,24,.98), rgba(13,13,13,.98));
    box-shadow: 0 18px 54px rgba(0,0,0,.34);
}
body.sg-product-customize-page .pz-panel {
    position: sticky;
    top: 18px;
    max-height: calc(100vh - 36px);
    padding: 16px;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--sgc-accent) #171717;
}
body.sg-product-customize-page .pz-panel::-webkit-scrollbar {
    width: 6px;
}
body.sg-product-customize-page .pz-panel::-webkit-scrollbar-track {
    background: #171717;
}
body.sg-product-customize-page .pz-panel::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: var(--sgc-accent);
}
body.sg-product-customize-page .pz-canvasPanel {
    min-height: 920px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 10%, rgba(239,100,64,.08), transparent 24%),
        linear-gradient(180deg, #151515, #0b0b0b);
}

/* Tool sections */
body.sg-product-customize-page .pz-section {
    padding: 0 0 16px;
    margin: 0 0 16px;
    border-bottom: 1px solid var(--sgc-border);
}
body.sg-product-customize-page .pz-section:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: 0;
}
body.sg-product-customize-page .pz-heading {
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--sgc-text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: .04em;
}
body.sg-product-customize-page .pz-heading::before {
    content: "";
    width: 4px;
    height: 14px;
    margin-right: 8px;
    border-radius: 999px;
    background: var(--sgc-accent);
}
body.sg-product-customize-page .pz-heading {
    justify-content: flex-start;
}
body.sg-product-customize-page .pz-note {
    margin: 7px 0 0;
    color: var(--sgc-muted);
    font-size: 11px;
    line-height: 1.65;
}
body.sg-product-customize-page .pz-row {
    margin-bottom: 10px;
}
body.sg-product-customize-page .pz-row label {
    display: block;
    margin-bottom: 6px;
    color: var(--sgc-muted);
    font-size: 11px;
    font-weight: 600;
}

/* Fields */
body.sg-product-customize-page .pz-input,
body.sg-product-customize-page .pz-select,
body.sg-product-customize-page .pz-number,
body.sg-product-customize-page .pz-textarea {
    width: 100%;
    border: 1px solid var(--sgc-border-strong);
    border-radius: 8px;
    outline: none;
    background: #090909;
    color: var(--sgc-text);
    font-size: 12px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
body.sg-product-customize-page .pz-input,
body.sg-product-customize-page .pz-select,
body.sg-product-customize-page .pz-number {
    height: 38px;
    padding: 0 10px;
}
body.sg-product-customize-page .pz-textarea {
    min-height: 76px;
    padding: 10px 11px;
    resize: vertical;
    line-height: 1.6;
}
body.sg-product-customize-page .pz-input:focus,
body.sg-product-customize-page .pz-select:focus,
body.sg-product-customize-page .pz-number:focus,
body.sg-product-customize-page .pz-textarea:focus {
    border-color: var(--sgc-accent);
    background: #0d0d0d;
    box-shadow: 0 0 0 3px rgba(239,100,64,.14);
}
body.sg-product-customize-page .pz-textarea::placeholder {
    color: #6f6f6f;
}
body.sg-product-customize-page .pz-select option {
    color: #fff;
    background: #111;
}
body.sg-product-customize-page .pz-color {
    width: 100%;
    height: 38px;
    padding: 4px;
    border: 1px solid var(--sgc-border-strong);
    border-radius: 8px;
    background: #090909;
    cursor: pointer;
}
body.sg-product-customize-page .pz-grid2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
body.sg-product-customize-page .pz-grid3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}
body.sg-product-customize-page .pz-btns {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

/* Buttons */
body.sg-product-customize-page .pz-btn,
body.sg-product-customize-page .pz-chip {
    appearance: none;
    border: 1px solid var(--sgc-border-strong);
    outline: none;
    color: #f4f4f4;
    background: #202020;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}
body.sg-product-customize-page .pz-btn {
    min-height: 38px;
    padding: 8px 11px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 11px;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
}
body.sg-product-customize-page .pz-chip {
    min-height: 32px;
    padding: 6px 8px;
    border-radius: 999px;
    font-size: 10px;
    line-height: 1.25;
}
body.sg-product-customize-page .pz-btn:hover,
body.sg-product-customize-page .pz-chip:hover {
    border-color: var(--sgc-accent);
    background: #292929;
    color: #fff;
    transform: translateY(-1px);
}
body.sg-product-customize-page .pz-btn:focus-visible,
body.sg-product-customize-page .pz-chip:focus-visible {
    box-shadow: 0 0 0 3px rgba(239,100,64,.2);
}
body.sg-product-customize-page .pz-btn.primary,
body.sg-product-customize-page .pz-btn.gold {
    border-color: var(--sgc-accent);
    background: var(--sgc-accent);
    color: #fff;
    box-shadow: 0 9px 24px rgba(239,100,64,.22);
}
body.sg-product-customize-page .pz-btn.primary {
    min-width: 170px;
    min-height: 44px;
    padding-inline: 18px;
    font-size: 12px;
}
body.sg-product-customize-page .pz-btn.primary:hover,
body.sg-product-customize-page .pz-btn.gold:hover {
    border-color: #ff7958;
    background: #ff7958;
}
body.sg-product-customize-page .pz-btn.danger {
    border-color: rgba(255,91,98,.45);
    background: rgba(255,91,98,.09);
    color: #ff858a;
}
body.sg-product-customize-page .pz-btn.danger:hover {
    border-color: var(--sgc-danger);
    background: var(--sgc-danger);
    color: #fff;
}
body.sg-product-customize-page .pz-btn.block {
    width: 100%;
}
body.sg-product-customize-page .pz-chip.active {
    border-color: var(--sgc-accent);
    background: var(--sgc-accent);
    color: #fff;
}

/* Front / back tabs */
body.sg-product-customize-page .pz-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    padding: 4px;
    border: 1px solid var(--sgc-border);
    border-radius: 9px;
    background: #090909;
}
body.sg-product-customize-page .pz-tab {
    flex: 1;
    min-height: 38px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sgc-muted);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
body.sg-product-customize-page .pz-tab:hover {
    color: #fff;
}
body.sg-product-customize-page .pz-tab.active {
    color: #fff;
    background: var(--sgc-accent);
    box-shadow: 0 7px 18px rgba(239,100,64,.2);
}

/* Canvas workspace */
body.sg-product-customize-page .pz-stageOuter {
    width: 100%;
    min-height: 860px;
    padding: 56px 18px 24px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    background-color: #0b0b0b;
    background-image:
        linear-gradient(45deg, rgba(255,255,255,.03) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255,255,255,.03) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255,255,255,.03) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.03) 75%);
    background-size: 22px 22px;
    background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}
body.sg-product-customize-page .pz-canvasBox {
    width: 100%;
    align-items: flex-start;
    justify-content: center;
}
body.sg-product-customize-page .pz-stage {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 360px;
    height: 900px;
    transform: scale(var(--pz-stage-scale, 1));
    transform-origin: top center;
}
body.sg-product-customize-page .pz-stage .canvas-container {
    border-radius: 22px;
    box-shadow: 0 24px 70px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.1);
}
body.sg-product-customize-page .pz-stage .lower-canvas,
body.sg-product-customize-page .pz-stage .upper-canvas {
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 22px;
    touch-action: none;
}
body.sg-product-customize-page .pz-stage .lower-canvas {
    background: #fff;
}
body.sg-product-customize-page .pz-stage .upper-canvas {
    background: transparent;
}
body.sg-product-customize-page .pz-guide {
    pointer-events: none;
    position: absolute;
    inset: 0;
    z-index: 3;
}
body.sg-product-customize-page .pz-outline {
    position: absolute;
    inset: 10px;
    border: 2px solid rgba(239,100,64,.52);
    border-radius: 22px;
    box-shadow: inset 0 0 42px rgba(239,100,64,.08);
}
body.sg-product-customize-page .pz-safe {
    position: absolute;
    inset: 28px;
    border: 1px dashed rgba(239,100,64,.62);
    border-radius: 16px;
}
body.sg-product-customize-page .pz-sideLabel {
    position: absolute;
    left: 50%;
    top: 18px;
    z-index: 4;
    transform: translateX(-50%);
    min-width: 82px;
    padding: 7px 15px;
    border: 1px solid rgba(239,100,64,.55);
    border-radius: 999px;
    color: #fff;
    background: rgba(5,5,5,.9);
    box-shadow: 0 9px 22px rgba(0,0,0,.32);
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    letter-spacing: .08em;
}

/* Layers */
body.sg-product-customize-page .pz-layerList {
    max-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    overflow-y: auto;
    overflow-x: hidden;
}
body.sg-product-customize-page .pz-layer {
    min-height: 38px;
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--sgc-border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #e7e7e7;
    background: #0b0b0b;
    font-size: 11px;
    text-align: left;
    cursor: pointer;
}
body.sg-product-customize-page .pz-layer:hover {
    border-color: var(--sgc-accent);
}
body.sg-product-customize-page .pz-layer.active {
    border-color: var(--sgc-accent);
    color: #fff;
    background: rgba(239,100,64,.18);
}
body.sg-product-customize-page .pz-layer span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body.sg-product-customize-page .pz-layer small {
    flex: 0 0 auto;
    color: inherit;
    font-size: 9px;
    opacity: .72;
}

body.sg-product-customize-page #productClassId,
body.sg-product-customize-page #imageFile,
body.sg-product-customize-page #frontJson,
body.sg-product-customize-page #backJson,
body.sg-product-customize-page #frontPng,
body.sg-product-customize-page #backPng {
    display: none;
}

/* Tablet */
@media (max-width: 1240px) {
    body.sg-product-customize-page .pz-layout {
        grid-template-columns: 270px minmax(380px, 1fr) 270px;
        gap: 12px;
    }
    body.sg-product-customize-page .pz-panel {
        padding: 13px;
    }
}

@media (max-width: 1040px) {
    body.sg-product-customize-page .pz-page {
        padding-inline: 18px;
    }
    body.sg-product-customize-page .pz-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "canvas canvas"
            "tools edit";
        align-items: start;
    }
    body.sg-product-customize-page .pz-layout > .pz-panel:first-child {
        grid-area: tools;
    }
    body.sg-product-customize-page .pz-canvasPanel {
        grid-area: canvas;
        min-height: 870px;
    }
    body.sg-product-customize-page .pz-layout > .pz-panel:last-child {
        grid-area: edit;
    }
    body.sg-product-customize-page .pz-panel {
        position: static;
        max-height: none;
    }
    body.sg-product-customize-page .pz-stageOuter {
        min-height: 800px;
    }
}

/* Mobile */
@media (max-width: 700px) {
    body.sg-product-customize-page .pz-page {
        min-height: 0;
        padding: 18px 10px 42px;
        overflow: hidden;
    }
    body.sg-product-customize-page .pz-header {
        min-height: 0;
        margin-bottom: 12px;
        padding: 15px;
        align-items: stretch;
        flex-direction: column;
    }
    body.sg-product-customize-page .pz-title {
        font-size: 20px;
    }
    body.sg-product-customize-page .pz-title span {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    body.sg-product-customize-page .pz-headerActions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }
    body.sg-product-customize-page .pz-headerActions .pz-btn.primary {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
    }
    body.sg-product-customize-page .pz-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "canvas"
            "tools"
            "edit";
        gap: 12px;
    }
    body.sg-product-customize-page .pz-panel,
    body.sg-product-customize-page .pz-canvasPanel {
        width: 100%;
        border-radius: 10px;
    }
    body.sg-product-customize-page .pz-canvasPanel {
        min-height: 690px;
        padding: 10px;
    }
    body.sg-product-customize-page .pz-stageOuter {
        min-height: 650px;
        padding: 52px 6px 12px;
    }
    body.sg-product-customize-page .pz-grid2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    body.sg-product-customize-page .pz-grid3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    body.sg-product-customize-page .pz-btn {
        min-height: 42px;
    }
    body.sg-product-customize-page .pz-chip {
        min-height: 36px;
    }
}

@media (max-width: 420px) {
    body.sg-product-customize-page .pz-page {
        padding-inline: 8px;
    }
    body.sg-product-customize-page .pz-grid3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    body.sg-product-customize-page .pz-headerActions {
        gap: 7px;
    }
}
