/* NPP Sign Builder v4 – Frontend Cascading */
:root {
    --sb-primary: #7c3aed;
    --sb-primary-dark: #5b21b6;
    --sb-primary-light: #ede9fe;
    --sb-success: #16a34a;
    --sb-bg: #f8fafc;
    --sb-card-bg: #fff;
    --sb-text: #1e293b;
    --sb-text-muted: #64748b;
    --sb-border: #e2e8f0;
    --sb-radius: 12px;
    --sb-radius-sm: 8px;
}

/* ---- Override Woodmart column widths for product layout ---- */
.npp-sb-product-row {
    display: -webkit-flex !important;
    display: flex !important;
    -webkit-flex-wrap: wrap !important;
    flex-wrap: wrap !important;
    gap: 30px !important;
}

.npp-sb-col-gallery {
    -webkit-flex: 0 0 48% !important;
    flex: 0 0 48% !important;
    max-width: 48% !important;
    width: 48% !important;
    -webkit-box-sizing: border-box !important;
    box-sizing: border-box !important;
}

.npp-sb-col-config {
    -webkit-flex: 0 0 48% !important;
    flex: 0 0 48% !important;
    max-width: 48% !important;
    width: 48% !important;
    -webkit-box-sizing: border-box !important;
    box-sizing: border-box !important;
}

.npp-sb-col-extra {
    -webkit-flex: 0 0 0% !important;
    flex: 0 0 0% !important;
    max-width: 0% !important;
    width: 0% !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
}

@media (max-width: 768px) {

    .npp-sb-col-gallery,
    .npp-sb-col-config {
        -webkit-flex: 0 0 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* ---- Ensure WooCommerce tabs (Description, Additional Info) remain visible ---- */
.woocommerce-tabs,
.wc-tabs-wrapper,
.woocommerce-Tabs-panel,
.product .woocommerce-tabs {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-height: none !important;
    overflow: visible !important;
    width: 100% !important;
}

/* Ensure Woodmart product elements below the configurator remain visible */
.product .woocommerce-product-details__short-description,
.product .product_meta,
.product .woocommerce-product-rating {
    display: block !important;
    visibility: visible !important;
}

.npp-sb-configurator {
    position: relative;
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--sb-text);
}

/* ---- Section (one per step) ---- */
.npp-sb-section {
    display: none;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--sb-border);
    animation: sbSlideDown 0.4s ease;
}

.npp-sb-section.visible {
    display: block;
}



@keyframes sbSlideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.npp-sb-section-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--sb-primary);
    background: var(--sb-primary-light);
    padding: 3px 10px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.npp-sb-section-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 14px;
    color: var(--sb-text);
}

/* ---- Cards grid ---- */
.npp-sb-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.npp-sb-card {
    background: var(--sb-card-bg);
    border: 2px solid var(--sb-border);
    border-radius: var(--sb-radius);
    padding: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}

.npp-sb-card:hover {
    border-color: var(--sb-primary);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .08);
    transform: translateY(-2px);
}

.npp-sb-card.selected {
    border-color: var(--sb-primary);
    background: var(--sb-primary-light);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
}

.npp-sb-card-img {
    width: 100%;
    height: 100px;
    object-fit: contain;
    border-radius: var(--sb-radius-sm);
    margin-bottom: 8px;
    background: var(--sb-bg);
}

.npp-sb-card-no-img {
    display: flex;
    align-items: center;
    justify-content: center;
}

.npp-sb-card-no-img .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    color: #ccc;
}

.npp-sb-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
}

.npp-sb-card-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--sb-text);
}

.npp-sb-card-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--sb-primary);
}

.npp-sb-card-sku {
    font-size: 10px;
    color: var(--sb-text-muted);
    font-family: 'Courier New', monospace;
}



/* ---- Bottom bar ---- */
.npp-sb-bottom {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    padding: 18px 0;
    border-top: 2px solid var(--sb-border);
    margin-top: 8px;
    animation: sbSlideDown 0.4s ease;
}

.npp-sb-total {
    font-size: 15px;
    color: var(--sb-text);
    padding: 8px 16px;
    background: var(--sb-bg);
    border-radius: var(--sb-radius-sm);
    border: 1px solid var(--sb-border);
}

.npp-sb-total strong {
    color: var(--sb-primary);
    font-size: 18px;
}

.npp-sb-btn-cart {
    padding: 12px 32px;
    border: none;
    border-radius: var(--sb-radius-sm);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    background: var(--sb-success);
    color: #fff;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.npp-sb-btn-cart:hover {
    background: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, .3);
}

/* ---- Loading ---- */
.npp-sb-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .85);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--sb-radius);
    z-index: 10;
}

.npp-sb-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid var(--sb-border);
    border-top-color: var(--sb-primary);
    border-radius: 50%;
    animation: sbSpin 0.7s linear infinite;
}

@keyframes sbSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- Mobile ---- */
@media (max-width: 600px) {
    .npp-sb-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }

    .npp-sb-card {
        padding: 8px;
    }

    .npp-sb-card-img {
        height: 70px;
    }

    .npp-sb-section-title {
        font-size: 16px;
    }

    .npp-sb-bottom {
        flex-wrap: wrap;
    }

    .npp-sb-total {
        width: 100%;
        text-align: center;
    }

    .npp-sb-btn-cart {
        width: 100%;
        justify-content: center;
    }
}

/* ---- Customization / Upload ---- */
.npp-sb-custom-desc {
    font-size: 14px;
    color: var(--sb-text-muted);
    margin: 0 0 6px;
}

.npp-sb-custom-price-info {
    font-size: 14px;
    color: var(--sb-text);
    margin: 0 0 14px;
}

.npp-sb-custom-price-info strong {
    color: var(--sb-primary);
    font-size: 16px;
}

/* Two-column row: positions + upload */
.npp-sb-custom-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.npp-sb-custom-positions {
    flex: 1;
    min-width: 0;
}

.npp-sb-positions-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--sb-text);
    margin: 0 0 8px;
}

/* Engraving toggle */
.npp-sb-engraving-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--sb-bg);
    border: 2px solid var(--sb-border);
    border-radius: var(--sb-radius);
    margin-bottom: 16px;
}

.npp-sb-toggle-question {
    font-size: 15px;
    font-weight: 600;
    color: var(--sb-text);
}

.npp-sb-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.npp-sb-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.npp-sb-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.npp-sb-slider:before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.npp-sb-switch input:checked+.npp-sb-slider {
    background: var(--sb-primary);
}

.npp-sb-switch input:checked+.npp-sb-slider:before {
    transform: translateX(24px);
}

.npp-sb-engraving-content {
    animation: sbFadeIn 0.3s ease;
}

@keyframes sbFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Position cards – use npp-sb-card styles */
.npp-sb-engraving-box {
    background: var(--sb-card-bg);
    border: 2px solid var(--sb-border);
    border-radius: var(--sb-radius);
    padding: 20px;
}

.npp-sb-position-card img {
    width: 100%;
    height: 100px;
    object-fit: contain;
    border-radius: var(--sb-radius-sm);
    background: var(--sb-bg);
}

.npp-sb-upload-area {
    flex: 1;
    min-width: 0;
}

.npp-sb-upload-dropzone {
    border: 2px dashed var(--sb-border);
    border-radius: var(--sb-radius);
    padding: 20px 16px;
    text-align: center;
    transition: all 0.25s;
    cursor: pointer;
    background: var(--sb-bg);
}

.npp-sb-upload-dropzone:hover,
.npp-sb-upload-dropzone.dragover {
    border-color: var(--sb-primary);
    background: var(--sb-primary-light);
}

.npp-sb-upload-dropzone.uploading {
    opacity: 0.5;
    pointer-events: none;
}

.npp-sb-upload-dropzone .dashicons {
    font-size: 36px;
    width: 36px;
    height: 36px;
    color: var(--sb-primary);
    margin-bottom: 8px;
}

.npp-sb-upload-dropzone p {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--sb-text-muted);
}

.npp-sb-upload-btn {
    display: inline-block;
    padding: 8px 24px;
    background: var(--sb-primary);
    color: #fff;
    border-radius: var(--sb-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.npp-sb-upload-btn:hover {
    background: var(--sb-primary-dark);
}

.npp-sb-upload-formats {
    font-size: 11px;
    color: var(--sb-text-muted);
    margin-top: 10px !important;
}

.npp-sb-upload-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: #f0fdf4;
    border: 2px solid #86efac;
    border-radius: var(--sb-radius);
    animation: sbSlideDown 0.3s ease;
}

.npp-sb-upload-ok {
    color: var(--sb-success);
    font-size: 24px;
    width: 24px;
    height: 24px;
}

#npp-sb-upload-filename {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--sb-text);
    font-family: 'Courier New', monospace;
}

.npp-sb-upload-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
}

.npp-sb-upload-remove:hover {
    background: #fee2e2;
}

.npp-sb-upload-remove .dashicons {
    color: #dc2626;
    font-size: 18px;
    width: 18px;
    height: 18px;
}