:root {
    --pcb-primary: #111;
    --pcb-accent: #333;
    --pcb-bg: #fff;
    --pcb-gray: #f5f5f5;
    --pcb-border: #e0e0e0;
    --pcb-success: #4CAF50;
    --pcb-radius: 12px;
    --pcb-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.pcb-container {
    background: var(--pcb-bg);
    border-radius: var(--pcb-radius);
    box-shadow: var(--pcb-shadow);
    padding: 30px;
    max-width: 900px;
    margin: 0 auto;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #333;
}


/* Progress Bar */

.pcb-progress-container {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    margin-bottom: 25px;
    overflow: hidden;
}

.pcb-progress-fill {
    height: 100%;
    background: var(--pcb-primary);
    width: 0%;
    transition: width 0.4s ease;
}


/* Price Bar */

.pcb-price-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border: 1px solid var(--pcb-border);
    border-radius: var(--pcb-radius);
    margin-bottom: 30px;
    position: sticky;
    top: 20px;
    z-index: 90;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.pcb-price-bar span {
    font-weight: 500;
    color: #666;
}

.pcb-current-price {
    font-size: 1.4em;
    color: var(--pcb-primary);
    font-weight: 700;
}


/* Steps */

.pcb-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pcb-step h3 {
    margin: 0 0 25px;
    font-size: 1.5em;
    font-weight: 700;
    color: var(--pcb-primary);
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
}

.pcb-stack {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
}

.pcb-stack-item {
    width: 100%;
}


/* Option Cards Grid */

.pcb-options,
.pcb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}


/* Special case for larger grids (like paper/cover) */

.pcb-grid {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 600px) {
    .pcb-grid {
        grid-template-columns: 1fr;
    }
}


/* Option Card Style */

.pcb-options label:has(input[type="radio"]),
.pcb-options label:has(input[type="checkbox"]),
.pcb-grid label:has(input[type="radio"]),
.pcb-grid label:has(input[type="checkbox"]),
.pcb-sub-options-grid label:has(input[type="radio"]),
.pcb-sub-options-grid label:has(input[type="checkbox"]),
.pcb-sub-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #fff;
    border: 2px solid var(--pcb-border);
    border-radius: var(--pcb-radius);
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 120px;
}

.pcb-options label:has(input[type="radio"]):hover,
.pcb-options label:has(input[type="checkbox"]):hover,
.pcb-grid label:has(input[type="radio"]):hover,
.pcb-grid label:has(input[type="checkbox"]):hover,
.pcb-sub-options-grid label:has(input[type="radio"]):hover,
.pcb-sub-options-grid label:has(input[type="checkbox"]):hover,
.pcb-sub-card:hover {
    border-color: #bbb;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}


/* Default Label Style for non-card labels */

label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    color: #444;
}


/* Hide default radio but keep accessibility */

.pcb-options input[type="radio"],
.pcb-options input[type="checkbox"],
.pcb-grid input[type="radio"],
.pcb-grid input[type="checkbox"],
.pcb-sub-options-grid input[type="radio"],
.pcb-sub-options-grid input[type="checkbox"],
.pcb-sub-card input[type="radio"],
.pcb-sub-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}


/* Selected State */

.pcb-options label:has(input:checked),
.pcb-grid label:has(input:checked),
.pcb-sub-options-grid label:has(input:checked),
.pcb-sub-card:has(input:checked),
.pcb-options label.pcb-selected,
.pcb-grid label.pcb-selected,
.pcb-sub-options-grid label.pcb-selected,
.pcb-sub-card.pcb-selected {
    border-color: var(--pcb-primary);
    background: #fafafa;
    box-shadow: 0 0 0 1px var(--pcb-primary);
}


/* Dim unselected items when selection exists */

.pcb-options.has-selection label:not(.pcb-selected),
.pcb-grid.has-selection label:not(.pcb-selected),
.pcb-sub-options-grid.has-selection label:not(.pcb-selected) {
    opacity: 0.5;
    transform: scale(0.98);
    filter: grayscale(80%);
}

.pcb-options.has-selection label:not(.pcb-selected):hover,
.pcb-grid.has-selection label:not(.pcb-selected):hover,
.pcb-sub-options-grid.has-selection label:not(.pcb-selected):hover {
    opacity: 0.8;
    transform: scale(1);
    filter: grayscale(0%);
}


/* Fallback for older browsers if needed, though :has is well supported now. 
   If not using :has, we rely on JS adding a class or simple styling. 
   Since I cannot easily add JS classes right now, I'll assume :has support or accept standard fallback. */

.pcb-option-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    margin-bottom: 10px;
    border-radius: 4px;
    display: block;
}


/* Inputs within grid (like custom text) */

input[type=date],
input[type=email],
input[type=number],
input[type=password],
input[type=search],
input[type=tel],
input[type=text],
input[type=url],
select,
textarea {
    border: 1px solid rgba(102, 102, 102, 0.24);
    border-radius: 3px;
    padding: .5rem 1rem;
    transition: all .3s;
    width: 100%;
    font-size: 14px;
}


/* Navigation */

.pcb-nav {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.pcb-nav button {
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pcb-prev {
    background: #fff;
    border: 1px solid #ddd;
    color: #555;
}

.pcb-prev:hover {
    background: #f5f5f5;
    color: #333;
}

.pcb-next,
.pcb-submit {
    background: var(--pcb-primary);
    border: 1px solid var(--pcb-primary);
    color: #fff;
    margin-left: auto;
    position: relative;
    overflow: visible;
    /* Push to right */
}

.pcb-next:hover,
.pcb-submit:hover {
    background: #333;
    border-color: #333;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.pcb-submit[disabled] {
    background: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pcb-submit .progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0%;
    background: rgba(255, 255, 255, 0.2);
    transition: width 0.2s linear;
    pointer-events: none;
    z-index: 1;
}

.pcb-submit span {
    position: relative;
    z-index: 2;
}


/* Custom Tweaks */

.pcb-cover-custom {
    grid-column: 1 / -1;
    flex-direction: row !important;
    justify-content: flex-start !important;
    padding: 20px !important;
    gap: 15px;
}

.pcb-cover-custom input[type="text"] {
    width: auto;
    flex: 1;
    margin: 0;
}


/* Summary Section */

.pcb-summary-text {
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.pcb-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.pcb-summary-row:last-child {
    border-bottom: none;
}

.pcb-summary-label {
    font-weight: 600;
    color: #555;
    flex: 1;
    text-align: left;
}

.pcb-summary-value {
    font-weight: 400;
    color: #222;
    text-align: right;
    flex: 1;
}

.pcb-confirmations {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.pcb-confirmations label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    cursor: pointer;
    color: #999;
    font-size: 0.95em;
}

.pcb-confirmations input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--pcb-primary);
}


/* Upload Zone Styles matching reference */

.pcb-upload .pcb-dropzone {
    padding: 60px 40px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    text-align: center;
    color: #212121;
    cursor: pointer;
    background: #ffffff;
    transition: all 0.2s ease;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.pcb-upload .pcb-dropzone:hover,
.pcb-upload .pcb-dropzone.drag {
    border-color: #4CAF50;
    background: #E8F5E9;
}


/* PDF Preview - Dark Theme matching reference */

.pcb-preview {
    display: none;
    margin-top: 20px;
    background: #212121;
    padding: 25px;
    border-radius: 15px;
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.pdf-file-info {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pdf-file-icon {
    background: rgba(255, 255, 255, 0.1);
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    font-size: 28px;
    color: #ffffff;
}

.pdf-file-icon img {
    width: 30px;
    height: 30px;
    filter: brightness(0) invert(1);
}

.pdf-file-details {
    flex: 1;
}

.pdf-filename {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

.file-size {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9em;
}

.pdf-page-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.page-stat-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.page-stat-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
}

.page-stat-item i {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: #ffffff;
    display: block;
}

.stat-number {
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 8px;
    color: #ffffff;
}

.stat-label {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.6);
}


/* Progress Bar */

.loading-progress {
    margin: 20px 0;
}

.progress-text {
    color: #ffffff;
    margin-bottom: 8px;
    font-size: 14px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar .progress {
    height: 100%;
    width: 0;
    background-color: #ffffff;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-count {
    color: #ffffff;
    font-weight: 500;
}


/* PDF Pages Scroll Container */

.pdf-preview-pages {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 15px;
    padding: 20px;
    margin-top: 20px;
    background: #212121;
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.pdf-preview-pages::-webkit-scrollbar {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.pdf-preview-pages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.pdf-preview-pages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.pdf-preview-pages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}


/* Force Grayscale Preview */

.pdf-preview-pages.force-bw-preview canvas {
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}


/* Page Wrapper & Canvas */

.page-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
}

.page-wrapper canvas {
    position: relative;
    display: block;
    height: 280px;
    width: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    background: #ffffff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.page-number {
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    text-align: center;
    margin-top: 10px;
    font-weight: 400;
}


/* Page Info / Color Indicators */

.page-info {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    width: auto;
    height: auto;
}

.page-wrapper:hover .page-info {
    opacity: 1 !important;
}

.page-info.color {
    display: flex !important;
    opacity: 0;
}

.page-info.color .circles {
    position: relative;
    width: 42px;
    height: 12px;
    display: block;
}

.page-info.color .circle {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    mix-blend-mode: normal;
    opacity: 1;
}

.page-info.color .circle:nth-child(1) {
    left: 0;
    background: #00FFFF;
    z-index: 4;
}

.page-info.color .circle:nth-child(2) {
    left: 8px;
    background: #FF00FF;
    z-index: 3;
}

.page-info.color .circle:nth-child(3) {
    left: 16px;
    background: #FFFF00;
    z-index: 2;
}

.page-info.color .circle:nth-child(4) {
    left: 24px;
    background: #000000;
    z-index: 1;
}

.page-info.bw .circles {
    position: relative;
    width: 24px;
    height: 12px;
}

.page-info.bw .circle {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.page-info.bw .circle:first-child {
    left: 0;
    background: white;
    border: 1px solid black;
    z-index: 2;
}

.page-info.bw .circle:last-child {
    left: 8px;
    background: black;
    z-index: 1;
}


/* Change PDF Button */

.change-pdf-button {
    margin: 0px 10px 20px 10px;
    text-align: center;
}

.upload-new-pdf {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.upload-new-pdf:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}


/* Variation Sub-Cards */

.pcb-sub-options-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 10px;
    width: 100%;
}

@media (max-width: 768px) {
    .pcb-sub-options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.pcb-var-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.pcb-var-row:last-child {
    border-bottom: none;
}

.pcb-var-row>div:first-child {
    min-width: 100px;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 0 !important;
}

.pcb-sub-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85em;
    min-height: 40px;
    min-width: 80px;
    position: relative;
}

.pcb-sub-card:hover {
    border-color: #bbb;
    background: #f9f9f9;
}

.pcb-sub-card:has(input:checked) {
    border-color: var(--pcb-primary);
    background: #f0f0f0;
    box-shadow: 0 0 0 1px var(--pcb-primary);
    font-weight: 600;
}

.pcb-sub-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.pcb-variations-area {
    width: 100%;
    margin-top: 20px;
    clear: both;
}

.pcb-variations {
    background: #fbfbfb;
    border: 2px solid var(--pcb-border);
    border-radius: var(--pcb-radius);
    padding: 20px;
    margin-top: 10px;
}


/* Stack Layout */

.pcb-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pcb-stack-item {
    width: 100%;
}

.pcb-group-title {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1.1em;
    color: var(--pcb-primary);
}


/* Summary List Style */

.pcb-summary-list {
    display: flex;
    flex-direction: column;
}

.pcb-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.pcb-summary-row:last-child {
    border-bottom: none;
}

.pcb-summary-label {
    font-weight: 600;
    color: #555;
    width: 40%;
}

.pcb-summary-value {
    font-weight: 400;
    color: #111;
    text-align: right;
    width: 60%;
}


/* PDF Icon in Dropzone */

.pcb-pdf-icon {
    fill: #ccc;
    margin-bottom: 15px;
    transition: fill 0.3s ease;
}

.pcb-dropzone:hover .pcb-pdf-icon {
    fill: #4CAF50;
}


/* White labels in Dark Preview Mode */

.pcb-preview .pcb-summary label {
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    cursor: pointer;
}


/* Disabled Option Style */

.pcb-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
    background-color: #f9f9f9;
    border-color: #eee !important;
}

.pcb-disabled img {
    filter: grayscale(100%);
    opacity: 0.6;
}


/* Note Field */

.pcb-note-field {
    width: 100%;
    margin-top: 10px;
    text-align: left;
}

.pcb-note-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    resize: vertical;
}


/* Toggle Switch Style */

.pcb-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.pcb-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    margin-bottom: 0;
}

.pcb-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.pcb-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.pcb-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.pcb-toggle-slider {
    background-color: var(--pcb-primary);
}

input:checked+.pcb-toggle-slider:before {
    transform: translateX(20px);
}

.pcb-toggle-label {
    color: #fff;
    font-size: 0.9em;
    cursor: pointer;
}


/* Debug Price Popup (Admin Only) */

#pcb-debug-price-box {
    position: fixed;
    top: 150px;
    right: 20px;
    width: 250px;
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    z-index: 9999;
    font-size: 12px;
    line-height: 1.4;
    max-height: 80vh;
    overflow-y: auto;
    opacity: 0.95;
}

#pcb-debug-price-box strong {
    display: block;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-bottom: 5px;
    font-size: 14px;
}