:root {
    --primary-color: #2271b1;
    --secondary-color: #00a32a;
    --error-color: #d63638;
    --bg-color: #fff;
    --border-color: #ddd;
    --text-color: #333;
    --muted-text-color: #666;
}

.wp-core-ui .button-delete {
    color: var(--error-color);
    border-color: var(--error-color);
    min-height: auto;
    line-height: 2.2;
    padding: 0 6px;

    span {
        font-size: 16px;
    }
}

.drcpu-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-color);
}

.model-uploader-inner {
    display: flex;
    gap: 10px;
}

.dprcu_input {
    width: 100%;
}

/* -- Detected Parts Panel -- */
.detected-parts-panel {
    border: 1px solid var(--border-color);
    margin-top: 15px;
    padding: 10px;
}

.detected-parts-panel h4 {
    margin: 0 0 10px 0;
}

.detected-parts-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.part-tag {
    background: #e7e8ea;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
}

/* -- Steps Container -- */
#steps-container {
    display: flex;
    flex-direction: column;
}

/* -- Step Card -- */
.config-step {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-bottom: none;
    padding: 10px 0px;
}

.config-step:last-child {
    border-bottom: 1px solid var(--border-color);
}

.config-step.ui-sortable-helper {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    transform: rotate(1deg);
}

.config-step.sortable-placeholder {
    background: var(--bg-color);
    border: 2px dashed var(--primary-color);
    min-height: 50px;
    visibility: visible !important;
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filler {
    flex-grow: 1;
}

.step-drag-handle {
    cursor: grab;
    padding: 5px 10px;
    margin-right: 10px;
    color: #999;
    font-size: 18px;
}

.step-drag-handle:hover {
    color: #2271b1;
}

.step-drag-handle:active {
    cursor: grabbing;
}


input[type="text"].name-input {
    min-height: auto;
    line-height: 1.2;
    font-size: 16px;
    font-weight: 600;
    border: 1px solid transparent;
    border-bottom: 2px solid var(--border-color);
    padding: 5px 0px;
    background: transparent;
    width: 350px;
}

/* -- Step Description -- */

.step-description-input {
    width: 100%;
    border: 1px solid #ddd;
    padding: 8px;
    font-size: 13px;
    resize: vertical;
}

/* -- Step Targets -- */

.step-targets small {
    color: #666;
    font-weight: normal;
}

/* -- Options Section -- */

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* -- Option Card -- */
.option-card {
    border: 1px solid var(--border-color);
    padding: 12px;
}

.option-card.ui-sortable-helper {
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.15);
    transform: rotate(0.5deg);
}

.option-card.sortable-placeholder {
    background: #f0fff4;
    border: 2px dashed var(--primary-color);
    border-left: 3px solid var(--primary-color);
    min-height: 50px;
    visibility: visible !important;
}

.option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.option-drag-handle {
    cursor: grab;
    padding: 4px 8px;
    margin-right: 8px;
    color: #999;
    font-size: 14px;
}

.option-drag-handle:hover {
    color: #00a32a;
}

.option-drag-handle:active {
    cursor: grabbing;
}

.option-header-left {
    display: flex;
    align-items: center;
}

.option-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* -- Texture Selection -- */

.texture-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    min-height: 50px;
}

.texture-preview img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border: 1px solid #ddd;
}

.texture-preview span {
    font-size: 12px;
}

.texture-preview .no-texture,
.texture-preview-multi .no-texture {
    color: #999;
    font-style: italic;
}

/* Multi-texture preview */
.texture-preview-multi {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    min-height: 50px;
    padding: 8px;
    background: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 4px;
}

.texture-thumb {
    position: relative;
    width: 50px;
    height: 50px;
}

.texture-thumb img,
.texture-thumb .thumb-color-swatch {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 2px solid #ddd;
    border-radius: 4px;
}

.texture-thumb .remove-tex {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #d63638;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
    cursor: pointer;
    display: none;
}

.texture-thumb:hover .remove-tex {
    display: block;
}

.texture-thumb:hover img,
.texture-thumb:hover .thumb-color-swatch {
    border-color: #2271b1;
}

/* -- Geometry Logic -- */
.geometry-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 8px;
}

.step-vis-grid {
    margin-top: 8px;
}

.geo-col strong {
    display: block;
    font-size: 10px;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.select2-container--default .select2-selection--multiple.dprcu-select2 .select2-selection__clear {
    margin: 0px 8px;
    color: var(--error-color);
    font-size: 1.5em;
}

.geo-col.show strong {
    color: var(--secondary-color);
}

.geo-col.hide strong {
    color: var(--error-color);
}


/* Colour-code show/hide columns */
.geo-col.show .select2-selection--multiple.dprcu-select2 .select2-selection__choice {
    background: #d9f0dc;
    border-color: #9ed3a3;
    color: #1a5c1f;
}

.geo-col.hide .select2-selection--multiple.dprcu-select2 .select2-selection__choice {
    background: #fde8e8;
    border-color: #f5b5b5;
    color: #7a1e1e;
}

/* -- Modal -- */
#tex-modal,
#bulk-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    width: 550px;
    max-width: 90%;
    max-height: 75vh;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-wide {
    width: 750px;
}

.modal-head {
    padding: 15px;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
    font-size: 14px;
}

.modal-head small {
    font-weight: normal;
    color: #666;
    margin-left: 10px;
}

.modal-body {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.bulk-count {
    margin-left: auto;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
}

#bulk-modal .modal-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
}

.modal-item {
    border: 2px solid #eee;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s;
    position: relative;
}

.modal-item:hover {
    border-color: #2271b1;
}

.modal-item.selected {
    border-color: #2271b1;
    background: #f0f7fc;
}

.modal-item.selected::after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    background: #2271b1;
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    line-height: 18px;
}

.modal-item img {
    width: 100%;
    height: 70px;
    object-fit: cover;
}

.modal-item span {
    display: block;
    font-size: 10px;
    padding: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-foot {
    padding: 12px 15px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* -- Empty State -- */
.empty-message {
    text-align: center;
    padding: 40px;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    color: #646970;
}


.options-actions {
    padding: 10px 0px;
}

.step-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-top: 2px solid var(--border-color);
    margin-top: 10px;
    padding: 12px;
}

/* -- Step Toggle and Collapsed State -- */
.config-step.closed .step-body {
    display: none;
}

.config-step.closed {
    border-left: 1px solid var(--border-color);
}

.step-toggle-btn {
    padding: 6px;
    cursor: pointer;
    color: #555;
    transition: transform 0.2s ease;
    display: inline-block;
    vertical-align: middle;
}

.config-step:not(.closed) .step-toggle-btn {
    transform: rotate(180deg);
}

/* -- Viewer-Only Toggle -- */
.psc-viewer-only-row {
    margin: 12px 0;
}

.psc-viewer-only-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 3px;
    cursor: pointer;
}

.psc-viewer-only-label input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}

.psc-viewer-only-label small {
    color: #646970;
}

/* -- Camera Toolbar Overlay -- */
.dprcu-cam-toolbar {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

.dprcu-cam-toolbar .button {
    font-size: 11px;
    min-height: 28px;
    line-height: 26px;
    padding: 0 10px;
}

#admin-model-preview {
    position: relative;
    height: 500px;
    background: #eee;
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* -- Category Filter Select -- */
select.button {
    height: auto;
}

/* -- Icon Picker -- */
.icon-preview[src=""] {
    display: none;
}

.icon-preview {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}