.wcpp-options {
    margin: 16px 0;
    padding: 12px;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    background: #fafafa;
}

.wcpp-options h4 {
    margin: 0 0 8px;
}

.wcpp-options label {
    display: block;
    margin: 8px 0 4px;
    font-weight: 600;
}

.wcpp-options .wcpp-inline {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
    font-weight: 400;
}

.wcpp-options .wcpp-size-summary {
    margin: 0 0 6px;
    font-weight: 500;
    max-width: 320px;
}

.wcpp-options .wcpp-varnish-row {
    margin-top: 10px;
}

.wcpp-options input[type="text"],
.wcpp-options select {
    width: 100%;
    max-width: 320px;
}

.wcpp-dimensions {
    display: flex;
    gap: 8px;
    max-width: 320px;
}

.wcpp-dimensions input {
    width: 50%;
}

.wcpp-note {
    margin: 0 0 10px;
    color: #555;
}

.wcpp-cart-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #666;
}

.wcpp-editor-controls {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wcpp-editor-state {
    font-size: 12px;
    color: #444;
}

/* Full-screen busy overlay (save, finalize, image upload) */
.wcpp-editor-busy {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.wcpp-editor-busy[hidden] {
    display: none !important;
}

.wcpp-editor-busy__panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 320px;
    padding: 28px 32px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
    text-align: center;
    color: #334155;
    font-size: 15px;
    line-height: 1.45;
}

.wcpp-editor-busy__spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid #e2e8f0;
    border-top-color: #2271b1;
    animation: wcpp-busy-spin 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes wcpp-busy-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .wcpp-editor-busy__spinner {
        animation: none;
        border-top-color: #2271b1;
        opacity: 0.9;
    }
}

body.wcpp-editor-busy-active {
    overflow: hidden;
}

.wcpp-editor-panel {
    margin-top: 12px;
    padding: 10px;
    border: 1px dashed #ccc;
    background: #fff;
}

.wcpp-editor-panel textarea {
    width: 100%;
    max-width: 700px;
}

.wcpp-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 8px;
}

.wcpp-editor-toolbar-secondary label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 500;
}

.wcpp-editor-toolbar input[type="number"] {
    width: 90px;
}

.wcpp-editor-toolbar select {
    min-width: 110px;
}

.wcpp-editor-toolbar input[type="color"] {
    width: 42px;
    height: 36px;
    padding: 2px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
}

.wcpp-editor-toolbar #wcpp-text-content {
    min-width: 220px;
    min-height: 48px;
    resize: vertical;
    direction: rtl;
}

#wcpp-shell-text-content {
    direction: rtl;
}

.wcpp-editor-toolbar .button.is-active {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.wcpp-editor-toolbar .button {
    min-height: 34px;
}

.wcpp-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 5px 10px;
    background: #f6f7f7;
    cursor: pointer;
    margin: 0;
    font-weight: 400;
}

.wcpp-upload-label input[type="file"] {
    display: none;
}

.wcpp-upload-label.is-wcpp-busy,
label.wcpp-shell-tool-file.is-wcpp-busy {
    opacity: 0.65;
    pointer-events: none;
    cursor: wait;
}

.wcpp-editor-canvas-wrap {
    border: 1px solid #dcdcde;
    background: #fff;
    padding: 8px;
}

.wcpp-editor-canvas {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}

.wcpp-polotno-root {
    width: 100%;
    height: 100%;
    min-height: 70vh;
}

.wcpp-polotno-error {
    max-width: 760px;
    margin: 40px auto;
    padding: 16px;
    border: 1px solid #e5a9a9;
    border-radius: 8px;
    background: #fff3f3;
    color: #7f1d1d;
    line-height: 1.5;
}

.wcpp-editor-canvas-wrap.full {
    height: calc(100vh - 170px);
    overflow: auto;
    border-radius: 6px;
    background: #ffffff;
}

.wcpp-back-note {
    margin: 8px 0;
    font-size: 12px;
    color: #666;
}

.wcpp-editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

body.wcpp-full-editor-page {
    margin: 0;
    background: #f1f3f5;
}

.wcpp-full-editor {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 100vh;
}

body.wcpp-full-editor-page .wcpp-full-editor-geometry-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.wcpp-full-editor-primary-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.wcpp-full-editor-primary-actions .wcpp-editor-state {
    margin: 0;
    font-size: 13px;
    color: #475467;
    flex: 1 1 140px;
}

.wcpp-main-panel {
    padding: 16px;
}

.wcpp-main-panel .wcpp-editor-canvas-wrap {
    margin-top: 10px;
}

/* Admin preset editor: wide layout + dynamic canvas scale */
body.wp-admin .form-table tr.wcpp-preset-editor-row td {
    max-width: none;
}

body.wp-admin .wcpp-admin-preset-editor {
    max-width: min(1600px, calc(100vw - 120px));
    width: 100%;
    box-sizing: border-box;
}

body.wp-admin .wcpp-admin-preset-editor .wcpp-editor-canvas-wrap.wcpp-canvas-scale-to-fit {
    min-height: min(72vh, 780px);
    overflow: auto;
}

.wcpp-design-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-width: 520px;
    margin: 8px 0 12px;
}

.wcpp-design-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin: 0;
    padding: 0;
    border: 2px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    text-align: center;
    font: inherit;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wcpp-design-card:hover {
    border-color: #98a2b3;
}

.wcpp-design-card:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.wcpp-design-card.is-selected {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.wcpp-design-card__media {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 6px 6px 0 0;
    background: #f2f4f7;
}

.wcpp-design-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wcpp-design-card__media--blank,
.wcpp-design-card__media--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcpp-design-card__media--blank::after {
    content: "";
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 2px dashed #98a2b3;
    background: linear-gradient(135deg, #fff 50%, #e4e7ec 50%);
}

.wcpp-design-card__media--placeholder::after {
    content: "—";
    font-size: 1.25rem;
    color: #98a2b3;
    line-height: 1;
}

.wcpp-design-card__title {
    display: block;
    padding: 8px 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    color: #344054;
}

.wcpp-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    grid-template-areas: "wcpp-main wcpp-props";
    gap: 10px;
    margin-top: 10px;
    min-height: 68vh;
}

.wcpp-shell-center {
    grid-area: wcpp-main;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wcpp-shell-right {
    grid-area: wcpp-props;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

body.wp-admin .wcpp-shell {
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas: "wcpp-props wcpp-main";
}

.wcpp-shell-topbar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 6px 8px;
}

.wcpp-shell-topbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.wcpp-shell-topbar-row--tools {
    padding-bottom: 4px;
    border-bottom: 1px solid #eef0f2;
}

.wcpp-shell-topbar-row--edit {
    gap: 6px;
}

.wcpp-shell-tools-sep {
    width: 1px;
    height: 22px;
    background: #d0d5dd;
    margin: 0 2px;
}

.wcpp-shell-tool-btn.button {
    min-width: 30px;
    min-height: 30px;
    padding: 2px 4px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wcpp-shell-tool-btn-text.button {
    min-height: 30px;
    padding: 2px 8px;
    font-size: 12px;
    line-height: 1.2;
}

.wcpp-shell-side-group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.wcpp-shell-side-btn.is-active {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.wcpp-shell-tool-file {
    position: relative;
    cursor: pointer;
    margin: 0;
}

.wcpp-shell-tool-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.wcpp-shell-help {
    margin-inline-start: auto;
    font-size: 12px;
}

.wcpp-shell-help-summary {
    cursor: pointer;
    list-style: none;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid #d0d5dd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #475467;
    background: #f8fafc;
}

.wcpp-shell-help-summary::-webkit-details-marker {
    display: none;
}

.wcpp-shell-help[open] .wcpp-shell-kbd-hint {
    margin: 6px 0 0;
    max-width: 320px;
}

.wcpp-shell-topbar-zoom {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.wcpp-shell-zoom-label {
    font-size: 12px;
    color: #50575e;
    min-width: 3.5ch;
}

.wcpp-shell-topbar-typo {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    font-size: 11px;
}

.wcpp-shell-topbar-end {
    margin-inline-start: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.wcpp-topbar-field {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    white-space: nowrap;
}

.wcpp-topbar-field-label {
    color: #646970;
}

.wcpp-shell-topbar-typo .wcpp-topbar-field select,
.wcpp-shell-topbar-typo .wcpp-topbar-field input[type="number"] {
    max-width: 130px;
}

.wcpp-shell-topbar-typo .wcpp-topbar-field-size .wcpp-inline-size {
    width: auto;
}

.wcpp-shell-topbar-typo .wcpp-topbar-field-size .wcpp-inline-size input[type="number"] {
    min-width: 44px;
    width: 3.5em;
}

.wcpp-topbar-field-color input[type="color"] {
    width: 32px;
    height: 28px;
    padding: 2px;
    vertical-align: middle;
}

.wcpp-toolbar-icon-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.wcpp-editor-toolbar-secondary .wcpp-toolbar-icon-group {
    vertical-align: middle;
}

.wcpp-toolbar-icon-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-sizing: border-box;
}

.wcpp-toolbar-icon-btn .wcpp-toolbar-icon-svg {
    display: block;
    flex-shrink: 0;
}

.wcpp-toolbar-icon-btn.is-active {
    background: #2271b1;
    color: #fff;
    border-color: #135e96;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.wcpp-toolbar-icon-btn.is-active .wcpp-toolbar-icon-svg path {
    fill: currentColor;
}

.wcpp-toolbar-icon-btn:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.wcpp-shell-text-panel {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    background: #f8fafc;
    margin-bottom: 8px;
}

.wcpp-shell-text-panel-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
}

.wcpp-shell-text-panel textarea {
    width: 100%;
    min-height: 64px;
    resize: vertical;
    box-sizing: border-box;
}

.wcpp-workspace-bg {
    flex: 1;
    min-height: 56vh;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    background: #edf1f5;
    padding: 12px;
    overflow: auto;
    box-sizing: border-box;
}

.wcpp-shell-canvas-wrap {
    background: #fff;
    border-radius: 6px;
    min-width: max-content;
    box-sizing: border-box;
}

.wcpp-shell-right label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.wcpp-typo-controls {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    background: #f8fafc;
    margin-bottom: 8px;
}

.wcpp-shape-controls {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    background: #f8fafc;
    margin-bottom: 8px;
}

.wcpp-inline-check {
    justify-content: flex-start !important;
}

.wcpp-typo-controls textarea {
    width: 100%;
    min-height: 52px;
    resize: vertical;
}

.wcpp-inline-size {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.wcpp-inline-size input[type="number"] {
    min-width: 70px;
}

.wcpp-shell-right input[type="number"],
.wcpp-layer-name {
    width: 100%;
}

.wcpp-layers-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 260px;
    overflow: auto;
}

.wcpp-layer-item {
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 6px;
    display: grid;
    gap: 4px;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    background: #fff;
}

.wcpp-layer-item.is-selected {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

@media (max-width: 1200px) {
    .wcpp-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "wcpp-main"
            "wcpp-props";
    }

    body.wp-admin .wcpp-shell {
        grid-template-areas:
            "wcpp-main"
            "wcpp-props";
    }
}

.wcpp-shell-enabled > .wcpp-editor-toolbar {
    display: none;
}

body.wcpp-is-fullscreen .wcpp-full-editor,
body.wcpp-is-fullscreen .wcpp-admin-preset-editor {
    width: 100vw;
    height: 100vh;
    max-width: none !important;
}

body.wcpp-is-fullscreen .wcpp-shell {
    min-height: calc(100vh - 16px);
}

body.wp-admin .wcpp-admin-preset-editor .wcpp-workspace-bg {
    min-height: min(72vh, 780px);
    padding: 12px;
    overflow: auto;
}

body.wp-admin .wcpp-admin-preset-editor .wcpp-shell-canvas-wrap {
    min-width: max-content;
}

.wcpp-shell-kbd-hint {
    margin: 12px 0 0;
    font-size: 12px;
    line-height: 1.45;
    opacity: 0.88;
}

.wcpp-shell-right .wcpp-prop-label {
    display: inline-block;
    min-width: 5.5em;
}

.wcpp-prop-trim-hint {
    margin: 6px 0 10px;
    font-size: 12px;
    line-height: 1.4;
}

.wcpp-shortcode-note {
    margin-top: 8px;
}
