/*==================================================
    TEMPLATE PREVIEW (product page "Template" tab)
    Guide colours match the artwork upload editor:
    pink bleed zone, pink cut line, blue dashed safe area.
==================================================*/

.np-tpl{
    --tpl-pink:#e7287c;
    --tpl-blue:#2873ba;
    --tpl-border:#ebe8f5;
}

/* Title + orientation */
.np-tpl-toolbar{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    margin-bottom:18px;
}
.np-tpl-title h4{
    margin:0 0 4px;
    font-size:22px;
    color:var(--header);
}
.np-tpl-title p{
    margin:0;
    font-size:14px;
    color:#555b6d;
}
.np-tpl-orient{
    display:inline-flex;
    padding:4px;
    border:1px solid var(--tpl-border);
    border-radius:30px;
    background:#f6f4ff;
}
.np-tpl-orient .orientation-btn{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:8px 18px;
    border:0;
    border-radius:30px;
    background:transparent;
    color:var(--header);
    font-size:14px;
    font-weight:600;
    transition:background-color .2s, color .2s;
}
.np-tpl-orient .orientation-btn.active{
    background:var(--theme);
    color:#fff;
}
.np-tpl-orient .orientation-btn:disabled{
    opacity:.5;
    cursor:not-allowed;
}

/* Preview card */
.template-preview-card{
    overflow:hidden;
    background:#fff;
    border:1px solid var(--tpl-border);
    border-radius:16px;
    box-shadow:0 8px 24px rgba(9,5,47,.06);
}
.template-svg-wrapper{
    display:flex;
    align-items:center;
    justify-content:center;
    width:100%;
    height:520px;
    padding:10px;
    background:
        linear-gradient(90deg, rgba(9,5,47,.035) 1px, transparent 1px) 0 0 / 24px 24px,
        linear-gradient(rgba(9,5,47,.035) 1px, transparent 1px) 0 0 / 24px 24px,
        #fafafe;
}
#templateSVG{
    width:100%;
    height:100%;
}

/* Guides */
.bleed-zone{
    fill:rgba(231,40,124,.16);
    stroke:rgba(231,40,124,.45);
    stroke-width:1.5;
    stroke-dasharray:6 5;
}
.cut-line{
    fill:#fff;
    stroke:var(--tpl-pink);
    stroke-width:2.5;
}
.safe-line{
    fill:none;
    stroke:var(--tpl-blue);
    stroke-width:2;
    stroke-dasharray:8 6;
}
#bleedRect,
#cutRect,
#safeRect{
    transition:all .3s ease;
}
.template-design-text{
    fill:#b9b6c8;
    font-weight:700;
    letter-spacing:.08em;
}
.template-empty{
    fill:#8a8fa0;
    font-size:22px;
    font-weight:600;
}
.dimension-line{
    stroke:#4a4f63;
    stroke-width:1.5;
}
.measurement{
    fill:var(--header);
    font-size:18px;
    font-weight:700;
}

/* Legend */
.np-tpl-legend{
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    gap:10px 26px;
    padding:14px 16px;
    border-top:1px solid var(--tpl-border);
    font-size:14px;
    font-weight:600;
    color:#555b6d;
}
.np-tpl-legend span{
    display:inline-flex;
    align-items:center;
    gap:8px;
}
.np-tpl-legend span::before{
    content:"";
    display:inline-block;
    width:22px;
    height:0;
    border-top:3px solid;
}
.np-tpl-legend .lg-bleed::before{
    height:12px;
    border:1px dashed rgba(231,40,124,.55);
    background:rgba(231,40,124,.16);
}
.np-tpl-legend .lg-cut::before{
    border-color:var(--tpl-pink);
}
.np-tpl-legend .lg-safe::before{
    border-color:var(--tpl-blue);
    border-top-style:dashed;
}

/* Sizes */
.template-info{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:14px;
    margin-top:18px;
}
.template-info > div{
    padding:14px 16px;
    border:1px solid var(--tpl-border);
    border-radius:14px;
    background:#fff;
}
.template-info span{
    display:block;
    margin-bottom:4px;
    font-size:13px;
    color:#6b7080;
}
.template-info strong{
    font-size:17px;
    color:var(--header);
}

/* Responsive */
@media (max-width:991px){
    .template-svg-wrapper{
        height:420px;
    }
}
@media (max-width:767px){
    .template-svg-wrapper{
        height:320px;
    }
    .template-info{
        grid-template-columns:1fr;
    }
    .measurement{
        font-size:26px;
    }
    .template-empty{
        font-size:30px;
    }
    .np-tpl-title h4{
        font-size:19px;
    }
}
@media (max-width:575px){
    .template-svg-wrapper{
        height:260px;
    }
    .np-tpl-orient{
        width:100%;
    }
    .np-tpl-orient .orientation-btn{
        flex:1;
        justify-content:center;
        padding:8px 10px;
    }
    /* SVG text is in viewBox units, so it needs larger values on a narrow screen */
    .measurement{
        font-size:34px;
    }
    .template-empty{
        font-size:38px;
    }
}
