/* -- Core Layout -- */
.model-uploader-container {
    background: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    margin-bottom: 20px;
}

.model-preview-container{
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}

.model-preview-container > *:first-child {
    flex: 2 1 60%;
    min-width: 300px;
}

.model-preview-container > *:last-child {
    flex: 1 1 30%;
    min-width: 300px;
}

/* -- Detected Parts Panel -- */
.detected-parts-panel {
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    padding: 15px;
    margin-bottom: 20px;
}

.detected-parts-panel h4 {
    margin: 0 0 10px 0;
}

.detected-parts-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    min-height: 30px;
}

.part-tag {
    background: #e7e8ea;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
}

/* -- Steps Container -- */
#steps-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* -- Step Card -- */
.config-step {
    background: #fff;
    border: 1px solid #ddd;
    border-left: 4px solid #2271b1;
    padding: 10px;
}

.config-step.ui-sortable-helper {
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    transform: rotate(1deg);
}

.config-step.sortable-placeholder {
    background: #f0f6fc;
    border: 2px dashed #2271b1;
    border-left: 4px solid #2271b1;
    min-height: 100px;
    visibility: visible !important;
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.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;
}

.step-header-left {
    display: flex;
    align-items: center;
}

.step-name-input {
    font-size: 16px;
    font-weight: 600;
    border: 1px solid transparent;
    padding: 5px 10px;
    background: transparent;
    width: 350px;
}

.step-name-input:focus {
    border-color: #2271b1;
    background: #fff;
    outline: none;
}

/* -- Step Description -- */
.step-description{
    padding: 10px;
}
.step-description-input {
    width: 100%;
    border: 1px solid #ddd;
    padding: 8px;
    font-size: 13px;
    resize: vertical;
}

/* -- Step Targets -- */
.step-targets {
    padding: 10px;
}

.step-targets label {
    display: block;
    margin-bottom: 8px;
}

.step-targets small {
    color: #666;
    font-weight: normal;
}

.mesh-select-box {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    min-height: 36px;
    max-height: 100px;
    overflow-y: auto;
}

.mesh-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f0f0f1;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
}

.mesh-checkbox:hover {
    background: #e0e0e1;
}

.mesh-checkbox.selected {
    background: #2271b1;
    color: #fff;
}

.mesh-checkbox input {
    margin: 0;
}

/* -- Options Section -- */
.step-options-container h5 {
    font-size: 13px;
    font-weight: 600;
    padding: 10px;
    display: flex;
    margin: 0px;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* -- Option Card -- */
.option-card {
    background: #fafafa;
    border: 1px solid #b9f5c8;
    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 #00a32a;
    border-left: 3px solid #00a32a;
    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-name-input {
    font-size: 14px;
    font-weight: 500;
    padding: 4px 8px;
    border: 1px solid #ddd;
    width: 250px;
}

.option-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* -- Texture Selection -- */
.option-texture {
    padding: 10px;
    margin-right: 10px;
    border-right: 1px solid #eee;
}

.option-texture label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 8px;
}

.option-texture label small {
    text-transform: none;
    font-weight: normal;
}

.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 -- */
.option-geometry {
    padding: 10px;
}

.option-geometry > label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 8px;
}

.geometry-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.geo-col strong {
    display: block;
    font-size: 10px;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.geo-col.show strong {
    color: #00a32a;
}

.geo-col.hide strong {
    color: #d63638;
}

.mesh-checks {
    max-height: 80px;
    overflow-y: auto;
    background: #fafafa;
    border: 1px solid #ddd;
    padding: 5px;
    font-size: 10px;
}

.mesh-checks label {
    display: block;
    padding: 2px 0;
    cursor: pointer;
}

.mesh-checks label:hover {
    background: #f0f0f0;
}

/* -- 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 Toggle and Collapsed State -- */
.config-step.closed .step-body {
    display: none;
}

.step-toggle-btn {
    cursor: pointer;
    color: #555;
    margin-right: 5px;
    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: flex-start;
    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;
}

/* -- Model Uploader -- */
.model-uploader-container label[style*="font-weight"] {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.model-uploader-container > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.model-uploader-container input[type="text"] {
    width: 100%;
}

#admin-model-preview {
    height: 500px;
    background: #eee;
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* -- Upgrade/Unlock Links -- */
.psc-upgrade-link {
    margin-left: 6px;
    font-size: 12px;
    vertical-align: middle;
    color: #2271b1;
    text-decoration: none;
}

/* -- Disabled Button State -- */
.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button:disabled + .psc-upgrade-link {
    display: inline-block;
    vertical-align: middle;
}

/* -- Lock Icon Styling -- */
.button .dashicons-lock {
    font-size: 13px;
    width: 13px;
    height: 13px;
    vertical-align: text-bottom;
    margin-right: 2px;
}

/* -- Geo Locked Warning -- */
.psc-geo-locked {
    padding: 8px 10px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-left: 3px solid #ffb900;
    border-radius: 3px;
    font-size: 12px;
    color: #3c434a;
    margin-top: 8px;
}

.psc-geo-locked .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    vertical-align: middle;
    color: #ffb900;
    margin-right: 4px;
}

/* -- Category Filter Select -- */
select.button {
    height: auto;
}