/* WC PDF Print Upload - Frontend Styles
 * Aligned with SewDirect theme design system.
 * Uses WordPress/theme CSS custom properties where available.
 */

/* ── Theme compatibility for PDF Print products ───────────────────── */

/* Design tokens, set on the body so all three landing regions inherit them:
 * the "How it works" panel (left column), the upload tool (right column) and
 * the FAQ/cross-sell band (full width below). */
body.wcppu-pdf-print-product {
    --wcppu-primary: var(--wp--preset--color--primary, #116973);
    --wcppu-primary-dark: var(--wp--preset--color--primary-dark, #083339);
    --wcppu-accent: var(--wp--preset--color--secondary, #d0481e);
    --wcppu-ink: var(--wp--preset--color--dark, #1a202c);
    --wcppu-muted: var(--wp--preset--color--text-light, #5a6b7c);
    --wcppu-border: var(--wp--preset--color--border, #e2e8f0);
    --wcppu-surface: var(--wp--preset--color--light, #f1f5f9);
}

/* Keep the theme's two-column hero grid, but this is a print service rather
 * than a catalogue product: hide the gallery (its left-column place is taken by
 * the injected "How it works" panel), the related-images widget, and the
 * SKU / brand chrome. The grid itself is left intact. */
body.wcppu-pdf-print-product .patter-woo-image-gallery,
body.wcppu-pdf-print-product .widget--woo-after-product-images,
body.wcppu-pdf-print-product .sd-sku-number,
body.wcppu-pdf-print-product .sd-brand-logo-wrap,
body.wcppu-pdf-print-product .sd-stock-badge,
body.wcppu-pdf-print-product .stock {
    display: none !important;
}

/* Two equal (50/50) columns: the upload tool on the LEFT, "How it works" on the
 * RIGHT. The theme only turns `.patter_woo_heading` into a grid above its phone
 * breakpoint, so on mobile the container stays a stacked flex column — `order`
 * keeps the tool first there. */
body.wcppu-pdf-print-product .patter_woo_heading {
    grid-template-columns: 1fr 1fr !important;
    align-items: start;
    column-gap: clamp(24px, 4vw, 48px);
}

body.wcppu-pdf-print-product .patter_woo_heading .summary {
    grid-column: 1 !important;
    grid-row: 1 !important;
    order: 1;
}

body.wcppu-pdf-print-product .patter_woo_heading .wcppu-how {
    grid-column: 2 !important;
    grid-row: 1 !important;
    order: 2;
}

/* Let the tool fill its half (the theme caps the summary card at 480px). */
body.wcppu-pdf-print-product .sd-product-card {
    max-width: none !important;
    width: 100%;
}

/* ── Right column: lead + upload tool + trust ─────── */

.wcppu-landing {
    /* Larger base text throughout for an older audience. */
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--wcppu-ink);
}

.wcppu-tool-lead {
    margin: 0 0 20px;
    font-size: 1.1875rem;
    line-height: 1.5;
    color: var(--wcppu-ink);
}

.wcppu-tool-section {
    scroll-margin-top: 24px;
}

/* ── How it works (right column) ──────────────────── */

.wcppu-how {
    background: #ffffff;
    border: 1px solid var(--wcppu-border);
    border-radius: 18px;
    padding: clamp(24px, 3vw, 36px);
    box-shadow: 0 10px 30px rgba(8, 51, 57, 0.07);
}

.wcppu-how-title {
    font-family: var(--wp--preset--font-family--heading-font, 'Outfit', sans-serif);
    font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
    line-height: 1.15;
    font-weight: 700;
    color: var(--wcppu-primary-dark);
    margin: 0 0 6px;
}

.wcppu-how-intro {
    margin: 0 0 28px;
    font-size: 1.0625rem;
    color: var(--wcppu-muted);
}

.wcppu-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

/* The connecting line runs behind the badges (which have a solid fill). */
.wcppu-timeline::before {
    content: '';
    position: absolute;
    left: 27px;
    top: 30px;
    bottom: 30px;
    width: 2px;
    background: var(--wcppu-border);
}

.wcppu-tl-step {
    position: relative;
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.wcppu-tl-step + .wcppu-tl-step {
    margin-top: 26px;
}

.wcppu-tl-badge {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--wcppu-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(8, 51, 57, 0.22);
}

.wcppu-tl-icon {
    width: 26px;
    height: 26px;
}

.wcppu-tl-num {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 11px;
    background: var(--wcppu-accent);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.wcppu-tl-body {
    padding-top: 6px;
}

.wcppu-tl-title {
    margin: 0 0 4px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--wcppu-ink);
}

.wcppu-tl-text {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--wcppu-muted);
}

/* ── Full-width band below the hero (FAQ + cross-sell) ─ */

.wcppu-band {
    margin: clamp(40px, 7vw, 72px) auto 0;
    max-width: var(--wp--style--global--content-size, 1100px);
}

.wcppu-section-title {
    font-family: var(--wp--preset--font-family--heading-font, 'Outfit', sans-serif);
    font-size: clamp(1.5rem, 1rem + 2vw, 2rem);
    line-height: 1.2;
    font-weight: 700;
    color: var(--wcppu-ink);
    text-align: center;
    margin: 0 0 24px;
}

/* CTA buttons (links, so the theme's summary-button width rule never applies). */
.wcppu-cta {
    display: inline-block;
    text-decoration: none;
    text-align: center;
    font-weight: 700;
    line-height: 1.2;
    border-radius: 12px;
    padding: 18px 36px;
    font-size: 1.125rem;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.wcppu-cta:hover,
.wcppu-cta:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(8, 51, 57, 0.18);
}

.wcppu-cta:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 3px;
}

.wcppu-cta-secondary {
    background: #ffffff;
    color: var(--wcppu-primary);
    border: 2px solid #ffffff;
}

.wcppu-cta-secondary:hover,
.wcppu-cta-secondary:focus {
    background: #ffffff;
    color: var(--wcppu-primary-dark);
}

/* ── FAQ ──────────────────────────────────────────── */

.wcppu-faq {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.wcppu-faq-item {
    border: 1px solid var(--wcppu-border);
    border-radius: 12px;
    background: #ffffff;
    margin-bottom: 12px;
    overflow: hidden;
}

.wcppu-faq-q {
    margin: 0;
    font-size: inherit;
}

.wcppu-faq-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    background: none;
    border: 0;
    text-align: left;
    cursor: pointer;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--wcppu-ink);
    font-family: inherit;
}

.wcppu-faq-toggle:focus-visible {
    outline: 2px solid var(--wcppu-primary);
    outline-offset: -2px;
}

.wcppu-faq-icon {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    position: relative;
}

.wcppu-faq-icon::before,
.wcppu-faq-icon::after {
    content: '';
    position: absolute;
    background: var(--wcppu-primary);
    border-radius: 2px;
}

.wcppu-faq-icon::before {
    top: 6px;
    left: 0;
    width: 14px;
    height: 2px;
}

.wcppu-faq-icon::after {
    top: 0;
    left: 6px;
    width: 2px;
    height: 14px;
    transition: transform 0.15s ease;
}

.wcppu-faq-toggle[aria-expanded="true"] .wcppu-faq-icon::after {
    transform: rotate(90deg);   /* collapse the vertical bar → minus sign */
}

.wcppu-faq-a {
    padding: 0 20px 20px;
}

.wcppu-faq-a p {
    margin: 0;
    color: var(--wcppu-muted);
    font-size: 1.0625rem;
    line-height: 1.6;
}

/* ── Cross-sell ───────────────────────────────────── */

.wcppu-crosssell {
    max-width: 760px;
    margin: 44px auto 0;
    text-align: center;
    background: var(--wcppu-primary);
    color: #ffffff;
    border-radius: 18px;
    padding: clamp(28px, 5vw, 44px);
}

.wcppu-crosssell .wcppu-section-title {
    color: #ffffff;
}

.wcppu-crosssell p {
    max-width: 48ch;
    margin: 0 auto 24px;
    font-size: 1.0625rem;
    color: rgba(255, 255, 255, 0.92);
}

@media (max-width: 520px) {
    .wcppu-cta {
        display: block;
        width: 100%;
    }
}

/* ── Wrapper ────────────────────────────────────── */

#wcppu-upload-wrapper {
    margin-bottom: 24px;
    font-family: 'Outfit', sans-serif;
}

/* ── Cart form layout ───────────────────────────── */

.wcppu-cart-form {
    display: flex;
    flex-direction: column;
}

.wcppu-cart-form .single_add_to_cart_button {
    align-self: stretch;
    margin-top: 8px;
}

/* ── Error message ──────────────────────────────── */

#wcppu-error {
    display: none;
    background: #fef0f0;
    border: 1px solid var(--wp--preset--color--secondary, #d0481e);
    color: var(--wp--preset--color--secondary-dark, #b03815);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ── Drop zone ──────────────────────────────────── */

#wcppu-drop-zone {
    border: 2px dashed var(--wp--preset--color--border, #e2e8f0);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    margin-bottom: 16px;
}

#wcppu-drop-zone:hover,
#wcppu-drop-zone.wcppu-drag-over {
    border-color: var(--wp--preset--color--primary, #116973);
    background-color: var(--wp--preset--color--primary-light, #e6f0f1);
}

#wcppu-drop-zone p {
    margin: 0 0 8px;
    color: var(--wp--preset--color--dark-grey, #64748b);
    font-size: 0.875rem;
    line-height: 1.5;
}

#wcppu-drop-zone .wcppu-hint {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--wp--preset--color--muted, #94a3b8);
}

/* ── Upload button ──────────────────────────────── */

#wcppu-upload-btn {
    display: inline-block;
    padding: 12px clamp(1.25rem, 0.5rem + 2vw, 2rem);
    background: var(--wp--preset--color--primary, #116973);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.2;
    transition: background-color 0.2s ease;
}

#wcppu-upload-btn:hover {
    background: var(--wp--preset--color--primary-medium, #0d525a);
}

/* ── File cards ─────────────────────────────────── */

.wcppu-file-card {
    border: 1px solid var(--wp--preset--color--border, #e2e8f0);
    border-radius: 12px;
    margin-bottom: 16px;
    /* overflow visible so tooltips can pop out over the card edge. */
}

/* The host theme forces every <button> inside .woocommerce .summary to
 * width:100%. Scope our widget's buttons back to their natural width so the
 * header, close button and layer controls lay out correctly. The id selectors
 * beat the theme's `.woocommerce .summary button` rule. The add-to-cart button
 * sits outside #wcppu-upload-wrapper, so it keeps the theme's full width. */
#wcppu-upload-wrapper button,
#wcppu-modal button {
    width: auto;
}

.wcppu-file-header {
    padding: 12px 16px;
    background: var(--wp--preset--color--light, #f1f5f9);
    border-bottom: 1px solid var(--wp--preset--color--border, #e2e8f0);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

/* Title row: chevron + filename + close, all on one line. */
.wcppu-file-titlebar {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* The clickable/toggle area (chevron + filename). A <button> when collapsible,
 * a plain container otherwise — styled identically either way. */
.wcppu-file-toggle {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: default;
}

.wcppu-file-card--collapsible .wcppu-file-toggle {
    cursor: pointer;
}

.wcppu-file-toggle:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary, #116973);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ── Accordion chevron (shown only when collapsible) ──── */

.wcppu-file-chevron {
    display: none;
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    align-items: center;
    justify-content: center;
}

.wcppu-file-card--collapsible .wcppu-file-chevron {
    display: inline-flex;
}

.wcppu-file-chevron::before {
    content: '';
    display: block;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--wp--preset--color--primary, #116973);
    border-bottom: 2px solid var(--wp--preset--color--primary, #116973);
    transform: rotate(45deg);      /* points down = expanded */
    transform-origin: center;
    transition: transform 0.15s ease;
    margin-top: -3px;
}

.wcppu-file-card--collapsed .wcppu-file-chevron::before {
    transform: rotate(-45deg);     /* points right = collapsed */
    margin-top: 0;
    margin-left: -3px;
}

.wcppu-file-card--collapsed .wcppu-file-header {
    border-bottom: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.wcppu-file-card--collapsed .wcppu-file-body {
    display: none;
}

.wcppu-file-name {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--wp--preset--color--dark, #1a202c);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Page count sits under the title row, aligned with the filename. */
.wcppu-file-summary {
    margin: 2px 0 0;
    font-size: 0.75rem;
    line-height: 1.3;
    color: var(--wp--preset--color--dark-grey, #64748b);
}

.wcppu-file-card--collapsible .wcppu-file-summary {
    padding-left: 20px;
}

.wcppu-file-status {
    flex: 0 0 auto;
    color: var(--wp--preset--color--dark-grey, #64748b);
    font-size: 0.8125rem;
    font-style: italic;
}

.wcppu-remove-file {
    flex: 0 0 auto;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--wp--preset--color--muted, #94a3b8);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s ease;
}

.wcppu-remove-file:hover {
    color: var(--wp--preset--color--secondary, #d0481e);
}

/* ── Upload progress ────────────────────────────── */

.wcppu-progress {
    height: 3px;
    background: var(--wp--preset--color--border, #e2e8f0);
}

.wcppu-progress-bar {
    height: 100%;
    background: var(--wp--preset--color--primary, #116973);
    width: 0;
    transition: width 0.2s ease;
}

.wcppu-uploading .wcppu-file-header {
    background: var(--wp--preset--color--primary-light, #e6f0f1);
}

/* ── Thumbnail grid ─────────────────────────────── */

.wcppu-thumb-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px 16px;
}

.wcppu-thumb-item {
    position: relative;
    display: flex;
    flex-direction: column;
}

.wcppu-thumb {
    display: block;
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--wp--preset--color--border, #e2e8f0);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.wcppu-thumb:hover,
.wcppu-thumb:focus {
    border-color: var(--wp--preset--color--primary, #116973);
    box-shadow: 0 2px 8px rgba(17, 105, 115, 0.15);
    outline: none;
    transform: translateY(-1px);
}

.wcppu-thumb-canvas-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    background: #f8fafc;
    padding: 8px;
}

.wcppu-thumb-canvas-wrap canvas {
    max-width: 100%;
    height: auto;
    display: block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.wcppu-thumb-placeholder {
    font-size: 0.75rem;
    color: var(--wp--preset--color--muted, #94a3b8);
    font-style: italic;
}

.wcppu-thumb-error {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--wp--preset--color--secondary, #d0481e);
}

.wcppu-thumb-overlay {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--wp--preset--color--light, #f1f5f9);
    border-top: 1px solid var(--wp--preset--color--border, #e2e8f0);
    font-size: 0.75rem;
}

.wcppu-thumb-label {
    font-weight: 600;
    color: var(--wp--preset--color--dark, #1a202c);
}

.wcppu-thumb-size {
    color: var(--wp--preset--color--dark-grey, #64748b);
}

.wcppu-thumb-actions {
    position: relative;
    margin-top: 8px;
    display: flex;
    justify-content: center;
}

/* Remove and Restore share one size so every page has an identical action
 * button. They fill the thumbnail width (the id scope beats the theme's
 * .woocommerce .summary button width rule, and the widget-wide width:auto). */
.wcppu-thumb-remove,
.wcppu-thumb-restore {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    min-height: 34px;
    padding: 6px 10px;
    background: #ffffff;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

#wcppu-upload-wrapper .wcppu-thumb-actions .wcppu-thumb-remove,
#wcppu-upload-wrapper .wcppu-thumb-actions .wcppu-thumb-restore {
    width: 100%;
}

.wcppu-thumb-remove {
    color: var(--wp--preset--color--secondary, #d0481e);
    border: 1px solid var(--wp--preset--color--secondary, #d0481e);
}

.wcppu-thumb-remove:hover,
.wcppu-thumb-remove:focus {
    background: var(--wp--preset--color--secondary, #d0481e);
    color: #ffffff;
    outline: none;
}

.wcppu-thumb-restore {
    color: var(--wp--preset--color--primary, #116973);
    border: 1px solid var(--wp--preset--color--primary, #116973);
}

.wcppu-thumb-restore:hover,
.wcppu-thumb-restore:focus {
    background: var(--wp--preset--color--primary, #116973);
    color: #ffffff;
    outline: none;
}

.wcppu-thumb-remove-icon {
    font-size: 1rem;
    line-height: 1;
}

.wcppu-thumb-remove-label {
    white-space: nowrap;
}

/* ── Coachmark overlay (shown once, click to dismiss) ───── */

#wcppu-coachmark {
    position: fixed;
    inset: 0;
    z-index: 10050;
}

.wcppu-coachmark-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.wcppu-coachmark-card {
    position: fixed;
    width: min(320px, calc(100vw - 24px));
    background: #ffffff;
    color: var(--wp--preset--color--dark, #1a202c);
    border-radius: 12px;
    padding: 16px 18px 14px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.35);
    font-size: 0.875rem;
    line-height: 1.5;
}

.wcppu-coachmark-close {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: var(--wp--preset--color--dark-grey, #64748b);
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.wcppu-coachmark-close:hover,
.wcppu-coachmark-close:focus {
    background: rgba(15, 23, 42, 0.08);
    color: var(--wp--preset--color--secondary, #d0481e);
    outline: none;
}

.wcppu-coachmark-arrow {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #ffffff;
    transform: rotate(45deg);
}

.wcppu-coachmark-card--below .wcppu-coachmark-arrow {
    top: -8px;
    box-shadow: -2px -2px 4px rgba(15, 23, 42, 0.06);
    border-top-left-radius: 3px;
}

.wcppu-coachmark-card--above .wcppu-coachmark-arrow {
    bottom: -8px;
    box-shadow: 2px 2px 4px rgba(15, 23, 42, 0.06);
    border-bottom-right-radius: 3px;
}

.wcppu-coachmark-title {
    margin: 0 0 6px;
    padding-right: 22px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--wp--preset--color--primary, #116973);
}

.wcppu-coachmark-body {
    margin: 0 0 12px;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--wp--preset--color--dark, #1a202c);
}

.wcppu-coachmark-dismiss {
    display: inline-block;
    padding: 8px 14px;
    background: var(--wp--preset--color--primary, #116973);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.wcppu-coachmark-dismiss:hover,
.wcppu-coachmark-dismiss:focus {
    background: var(--wp--preset--color--primary-medium, #0d525a);
    outline: none;
}

/* ── Removed thumbnail state ────────────────────── */

.wcppu-thumb-item-removed .wcppu-thumb {
    opacity: 0.4;
    filter: grayscale(0.6);
}

.wcppu-thumb-removed-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(148, 163, 184, 0.95);
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    pointer-events: none;
}

/* ── Preview-only notice (file has non-printable pages) ─── */

.wcppu-file-notice {
    margin: 0;
    padding: 10px 16px;
    background: var(--wp--preset--color--primary-light, #e6f0f1);
    border-bottom: 1px solid var(--wp--preset--color--border, #e2e8f0);
    color: var(--wp--preset--color--primary-dark, #083339);
    font-size: 0.8125rem;
    line-height: 1.45;
}

/* ── Layers panel ───────────────────────────────── */

.wcppu-layers {
    padding: 12px 16px;
    border-bottom: 1px solid var(--wp--preset--color--border, #e2e8f0);
    background: var(--wp--preset--color--light, #f8fafc);
}

.wcppu-layers-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.wcppu-layers-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wp--preset--color--primary, #116973);
}

.wcppu-layers-toggle-all {
    flex: 0 0 auto;
    background: none;
    border: 1px solid var(--wp--preset--color--primary, #116973);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--wp--preset--color--primary, #116973);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.wcppu-layers-toggle-all:hover {
    background: var(--wp--preset--color--primary, #116973);
    color: #ffffff;
}

.wcppu-layers-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px 16px;
    align-items: start;
}

.wcppu-layer-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--wp--preset--color--dark, #1a202c);
    cursor: pointer;
    margin: 0;
    padding: 4px 6px;
    border-radius: 8px;
    min-width: 0;
    transition: background-color 0.12s ease;
}

.wcppu-layer-toggle:hover {
    background: rgba(17, 105, 115, 0.06);
}

.wcppu-layer-checkbox {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--wp--preset--color--primary, #116973);
}

.wcppu-layer-checkbox:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary, #116973);
    outline-offset: 2px;
}

.wcppu-layer-name {
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wcppu-layers-hint {
    margin: 8px 0 0;
    font-size: 0.75rem;
    color: var(--wp--preset--color--text-light, #5a6b7c);
}

/* ── Non-printable (preview-only) pages ─────────── */

.wcppu-thumb-item-unprintable .wcppu-thumb {
    opacity: 0.55;
    cursor: zoom-in;
}

.wcppu-thumb-item-unprintable .wcppu-thumb-size {
    color: var(--wp--preset--color--secondary, #d0481e);
    font-weight: 600;
}

.wcppu-thumb-unprintable-label {
    margin-top: 8px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--wp--preset--color--text-light, #5a6b7c);
    background: var(--wp--preset--color--light, #f1f5f9);
    border: 1px dashed var(--wp--preset--color--border, #cbd5e1);
    border-radius: 8px;
    padding: 6px 8px;
}

/* ── Modal ──────────────────────────────────────── */

#wcppu-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
}

#wcppu-modal.wcppu-modal-open {
    display: block;
}

.wcppu-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.wcppu-modal-dialog {
    background: #ffffff;
    border-radius: 12px;
    max-width: 960px;
    width: 100%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.wcppu-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--wp--preset--color--border, #e2e8f0);
    background: var(--wp--preset--color--light, #f1f5f9);
}

.wcppu-modal-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--wp--preset--color--dark, #1a202c);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 12px;
}

.wcppu-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--wp--preset--color--dark-grey, #64748b);
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s ease;
}

.wcppu-modal-close:hover {
    color: var(--wp--preset--color--secondary, #d0481e);
}

/* Body row: layers column on the left, preview on the right. */
.wcppu-modal-body {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;          /* allow children to scroll inside the dialog */
    overflow: hidden;
}

/* Layer toggles inside the preview modal — a scrollable left-hand column. */
.wcppu-modal-layers:empty {
    display: none;
}

.wcppu-modal-layers {
    flex: 0 0 220px;
    max-width: 240px;
    overflow-y: auto;
    border-right: 1px solid var(--wp--preset--color--border, #e2e8f0);
    background: var(--wp--preset--color--light, #f8fafc);
}

.wcppu-modal-layers .wcppu-layers {
    border-bottom: none;
    background: transparent;
}

/* One layer per row in the modal column. */
.wcppu-modal-layers .wcppu-layers-list {
    grid-template-columns: 1fr;
}

.wcppu-modal-layers .wcppu-layers-hint {
    display: none;
}

.wcppu-modal-canvas-wrap {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: auto;
    background: #f8fafc;
    min-height: 200px;
}

.wcppu-modal-canvas-wrap canvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.wcppu-modal-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--wp--preset--color--border, #e2e8f0);
    justify-content: flex-end;
}

.wcppu-btn {
    background: none;
    border: 1px solid var(--wp--preset--color--primary, #116973);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.8125rem;
    color: var(--wp--preset--color--primary, #116973);
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.wcppu-btn:hover {
    background: var(--wp--preset--color--primary, #116973);
    color: #ffffff;
}

.wcppu-btn-danger {
    border-color: var(--wp--preset--color--secondary, #d0481e);
    color: var(--wp--preset--color--secondary, #d0481e);
}

.wcppu-btn-danger:hover {
    background: var(--wp--preset--color--secondary, #d0481e);
    color: #ffffff;
}

body.wcppu-modal-lock {
    overflow: hidden;
}

/* Narrow screens: stack the layers column above the preview. */
@media (max-width: 640px) {
    .wcppu-modal-body {
        flex-direction: column;
    }

    .wcppu-modal-layers {
        flex: 0 0 auto;
        max-width: none;
        max-height: 28vh;
        border-right: none;
        border-bottom: 1px solid var(--wp--preset--color--border, #e2e8f0);
    }

    .wcppu-modal-layers .wcppu-layers-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* ── Keyboard focus visibility (accessibility) ──────── */

.wcppu-modal-close:focus-visible,
.wcppu-remove-file:focus-visible,
.wcppu-layers-toggle-all:focus-visible,
.wcppu-thumb-remove:focus-visible,
.wcppu-thumb-restore:focus-visible,
.wcppu-btn:focus-visible,
.wcppu-thumb:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary, #116973);
    outline-offset: 2px;
}

/* ── Summary ────────────────────────────────────── */

#wcppu-summary {
    display: none;
    background: var(--wp--preset--color--primary-light, #e6f0f1);
    border: 1px solid var(--wp--preset--color--primary, #116973);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

#wcppu-summary p {
    margin: 0 0 4px;
    font-size: 0.875rem;
    color: var(--wp--preset--color--dark, #1a202c);
}

/* Total price line — use WooCommerce .price class for consistent styling. */
#wcppu-summary .wcppu-total-line {
    font-size: 0.875rem;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

#wcppu-summary .wcppu-price {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--wp--preset--color--primary-dark, #083339);
}

#wcppu-summary .wcppu-price .woocommerce-price-suffix {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--wp--preset--color--text-light, #5a6b7c);
}

#wcppu-summary .wcppu-pricing-note {
    font-size: 0.75rem;
    color: var(--wp--preset--color--text-light, #5a6b7c);
    margin-top: 8px;
}

/* ── "From" price label on product page ─────────── */

.wcppu-price-from {
    font-size: 0.8em;
    color: var(--wp--preset--color--dark-grey, #64748b);
    font-weight: 400;
}

/* ── Hide default WooCommerce quantity for this type ── */

.product-type-pdf_print .quantity {
    display: none !important;
}
