/**
 * Customizer Modal Styles
 * Single-flow overlay approach
 */

/* Theme Override — reset accent colors from Hello Elementor / other themes */
.swipe-modal-overlay,
.swipe-modal-overlay button,
.swipe-modal-overlay .dashicons,
.swipe-customize-button-wrapper,
.swipe-customize-button-wrapper button,
.swipe-customize-button-wrapper [data-lucide],
.swipe-metal-wrapper,
.swipe-metal-wrapper button,
.swipe-metal-wrapper .dashicons {
    color: #030303;
}

/* Montserrat for all customizer UI (product page button + modal + sub-modals) */
.swipe-customize-button-wrapper,
.swipe-modal-overlay,
.swipe-sub-modal {
    font-family: 'Montserrat', sans-serif;
}

/* Normalize button radius inside Swipe Metal UI (override theme [type=button]/[type=submit]/button rules) */
.swipe-metal-wrapper button,
.swipe-modal-overlay button,
.swipe-metal-wrapper [type="button"],
.swipe-modal-overlay [type="button"],
.swipe-metal-wrapper [type="submit"],
.swipe-modal-overlay [type="submit"],
.swipe-metal-wrapper .button,
.swipe-modal-overlay .button {
    border-radius: 4px !important;
}

.swipe-modal-overlay a,
.swipe-customize-button-wrapper a,
.swipe-metal-wrapper a {
    color: inherit;
}

/* Customize Button on Product Page — matches modal theme (border-radius 8px, #d9d9d9, Montserrat) */
.swipe-customize-button-wrapper {
    margin: 20px 0;
    padding: 24px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #d9d9d9;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.swipe-customize-trigger {
    width: 100%;
    padding: 12px 36px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    border-radius: 4px !important;
    background: #030303 !important;
    border: none !important;
    color: #fff !important;
    letter-spacing: 0.3px;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease !important;
}

.swipe-customize-trigger:hover {
    background: #222 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.swipe-customize-trigger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.swipe-customize-trigger-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    color: #fff !important; 
}

.swipe-button-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #d9d9d9;
}

.swipe-button-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #555;
    font-size: 14px;
    line-height: 1.4;
}

.swipe-button-feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.swipe-button-feature-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    color: #555;
}

.swipe-button-delivery {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #d9d9d9;
}

.swipe-button-delivery-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.swipe-button-delivery-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    color: #2e7d32;
}

.swipe-button-delivery > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.swipe-delivery-date {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

.swipe-delivery-lead {
    font-size: 12px;
    color: #888;
    line-height: 1.3;
}

/* Full-Screen Modal Overlay */
/* Overflow hidden so only .swipe-modal-content scrolls — required for left column sticky */
.swipe-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    overflow: hidden;
}

.swipe-modal-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: white;
}

/* Modal Header */
.swipe-modal-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: #fff;
    border-bottom: 1px solid #d9d9d9;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.swipe-modal-header h2 {
    margin: 0;
    font-size: 20px;  
    font-weight: 600;
    padding-right: 44px; /* space for close button */
}

/* Close button: absolutely centered in header (desktop 30px from right to match header padding) */
.swipe-modal-overlay .swipe-modal-header .swipe-modal-close {
    position: absolute;
    top: 50%;
    right: 30px;
    left: auto;
    transform: translateY(-50%);
    margin: 0;
}

.swipe-modal-close {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    line-height: 0;
    font-size: 0;
    background: transparent !important;
    border: none !important;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: none !important;
    color: #888888 !important;
    transition: background 0.2s ease;
}

/* Remove screen-reader text from layout so only the icon is centered */
.swipe-modal-close .screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.swipe-modal-close:hover {
    background: rgba(0, 0, 0, 0.04) !important;
}

/* Icon: 14px visual centered in 32px button (avoids overflow / baseline quirks) */
.swipe-close-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 14px;
    height: 14px;
    margin: 0;
    line-height: 0;
    flex-shrink: 0;
}

.swipe-close-icon::before,
.swipe-close-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 2px;
    background-color: #888888;
    transform-origin: center;
}

.swipe-close-icon::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.swipe-close-icon::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Modal Content — no scroll here; each column manages its own overflow */
.swipe-modal-overlay .swipe-modal-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    background: #fff;
}

/* Design Interface (2-column layout) */
.swipe-design-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
}

.swipe-canvas-column {
    background: #fff;
    border-radius: 0;
    padding: 30px 50px 10px 50px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 0;
    border-right: 1px solid #e1e1e1;
    overflow: hidden;
}

.swipe-canvas-header {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.swipe-view-toggle {
    padding: 8px 18px;
    background: transparent !important;
    border: none !important;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500 !important;
    font-size: 14px;
    color: #030303 !important;
    outline: none !important;
    box-shadow: none !important;
    transition: background 0.2s ease, color 0.2s ease;
}

.swipe-view-toggle.active {
    background: #f0f0f0 !important;
    color: #030303 !important;
}

/* Card preview area — JS locks height to prevent layout shift between front/back */
.swipe-card-preview-area {
    position: relative;
    overflow: hidden;
}

.swipe-canvas-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    max-width: 85%;
    margin: 0 auto;
}

.swipe-canvas-wrapper .canvas-container {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    overflow: hidden;
}

/* Floating Edit Bar (inside canvas column) */
.swipe-edit-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #030303;
    border-radius: 8px;
    margin-top: 12px;
}

.swipe-edit-bar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.swipe-edit-bar-select {
    padding: 5px 8px;
    border: 1px solid #444;
    border-radius: 4px;
    font-size: 13px;
    background: #2a2a2a;
    color: #fff;
    flex: 1;
    min-width: 0;
}

.swipe-edit-bar-color {
    width: 34px;
    height: 34px;
    padding: 1px;
    border: 2px solid #444;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    flex-shrink: 0;
}

.swipe-edit-bar .button.button-small {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    white-space: nowrap;
    border-color: #555;
    background: #2a2a2a;
    color: #fff;
    flex-shrink: 0;
}

.swipe-edit-bar .button.button-small:hover {
    background: #444;
    border-color: #666;
    color: #fff;
}

.swipe-edit-bar .button.button-small .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
}

/* Spin animation for background removal loading */
@keyframes swipe-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.swipe-edit-bar .dashicons.spin {
    animation: swipe-spin 1s linear infinite;
}

.swipe-btn-delete-small {
    background: #d63638 !important;
    color: white !important;
    border-color: #d63638 !important;
}

.swipe-btn-delete-small:hover {
    background: #b32d2e !important;
    border-color: #b32d2e !important;
}

.swipe-back-view {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    max-width: 85%;
    margin: 0 auto;
}

.swipe-back-canvas-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    max-width: 100%;
}

.swipe-back-canvas-wrapper .canvas-container {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    overflow: hidden;
}

.card-back-content {
    width: 100%;
    aspect-ratio: 1011 / 638;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    border: none;
    position: relative;
    background-color: #333;
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

/* Back card details (number, expiry, CVV): fixed position; left matches front (30px + 30px padding = 60px from card edge) */
.card-details {
    position: absolute;
    left: 30px;
    bottom: 138px;
    font-family: 'Montserrat', sans-serif !important;
    color: var(--swipe-back-engraved-color, #C0C0C0);
}

.card-details p {
    margin: 8px 0;
}

/* Name on back: separate block below card details so details never move; same left, 90px from bottom to match front */
.card-name-back-wrap {
    position: absolute;
    left: 30px;
    bottom: 90px;
}

/* Back text: same size as front name (34px) so card info and name match; scale matches canvas */
.card-number {
    font-size: calc(34px * var(--swipe-card-scale, 1));
    letter-spacing: 4px;
    font-weight: 500;
}

.card-expiry,
.card-cvv,
.card-name {
    font-size: calc(34px * var(--swipe-card-scale, 1));
    font-weight: 500;
}

/* Name on back: same scale as name on front; 500 to match how front renders */
.card-name {
    font-family: 'Montserrat', sans-serif !important;
    color: var(--swipe-back-engraved-color, #C0C0C0);
    font-size: calc(34px * var(--swipe-card-scale, 1));
    font-weight: 500;
}

/* Controls Column — scrolls independently; left column stays fixed */
.swipe-controls-column {
    background: #fafafa;
    border-radius: 0;
    padding: 30px 30px 15px 30px;
    overflow-y: auto;
}

.swipe-control-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 2px solid #f0f0f0;
    overflow: visible;
}

.swipe-control-section:last-child {
    border-bottom: none;
    margin-bottom: 15px;
    padding-bottom: 12px;
}

.swipe-control-section h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #030303;
}

.swipe-design-notes-disclaimer {
    margin: 0 0 10px 0;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    line-height: 1.4;
}

/* Modal-scoped: control sections, Design Notes, disclaimer, textarea — theme/global CSS cannot override */
#swipe-customizer-modal .swipe-control-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 2px solid #f0f0f0;
    overflow: visible;
}

#swipe-customizer-modal .swipe-control-section:last-child {
    border-bottom: none;
    margin-bottom: 15px;
    padding-bottom: 12px;
}

#swipe-customizer-modal .swipe-control-section h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #030303;
    font-family: 'Montserrat', sans-serif;
}

#swipe-customizer-modal .swipe-design-notes-disclaimer {
    margin: 0 0 10px 0;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    line-height: 1.4;
    font-family: 'Montserrat', sans-serif;
}

#swipe-customizer-modal .swipe-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    color: #030303;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

#swipe-customizer-modal .swipe-textarea::placeholder {
    color: #b0b0b0;
    font-weight: 300;
}

#swipe-customizer-modal .swipe-textarea:focus {
    outline: none;
    border: 1px solid #CFA739;
    box-shadow: none;
}

/* What Happens Next + delivery — scoped under modal so theme/global CSS cannot override */
#swipe-customizer-modal .swipe-how-it-works-section {
    margin-top: 15px;
    margin-bottom: 15px;
    padding-top: 0;
    padding-bottom: 0;
}

#swipe-customizer-modal .swipe-how-it-works-block {
    margin-bottom: 16px;
}

/* What Happens Next: switch content by approach — class on modal so theme cannot override */
#swipe-customizer-modal .swipe-how-it-works-help {
    display: none !important;
}
#swipe-customizer-modal.swipe-approach-design-help .swipe-how-it-works-diy {
    display: none !important;
}
#swipe-customizer-modal.swipe-approach-design-help .swipe-how-it-works-help {
    display: block !important;
}

#swipe-customizer-modal .swipe-how-it-works-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #030303;
    font-family: 'Montserrat', sans-serif;
}

#swipe-customizer-modal .swipe-how-it-works-steps {
    margin: 0 0 12px 0;
    padding-left: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    line-height: 1.5;
    font-family: 'Montserrat', sans-serif;
}

#swipe-customizer-modal .swipe-how-it-works-steps li {
    margin-bottom: 4px;
}

#swipe-customizer-modal .swipe-how-it-works-steps li:last-child {
    margin-bottom: 0;
}

#swipe-customizer-modal .swipe-how-it-works-security {
    margin: 0 0 0 0;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    line-height: 1.4;
    font-family: 'Montserrat', sans-serif;
}

#swipe-customizer-modal .swipe-how-it-works-delivery {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid #e8e8e8;
}

#swipe-customizer-modal .swipe-how-it-works-delivery-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

#swipe-customizer-modal .swipe-how-it-works-delivery-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    color: #555;
}

#swipe-customizer-modal .swipe-how-it-works-delivery > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#swipe-customizer-modal .swipe-how-it-works-delivery-date {
    font-size: 13px;
    color: #333;
    line-height: 1.4;
    font-family: 'Montserrat', sans-serif;
}

#swipe-customizer-modal .swipe-how-it-works-delivery-lead {
    font-size: 13px;
    color: #888;
    line-height: 1.3;
    font-family: 'Montserrat', sans-serif;
}

/* Design Method Toggle */
.swipe-approach-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: #F5F3ED;
    border-radius: 4px;
    padding: 2px;
}

.swipe-approach-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px !important;
    background-color: transparent;
    background-image: linear-gradient(180deg, #F5F3ED 0%, #F5F3ED 100%);
    border: none !important;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #555;
    outline: none !important;
    box-shadow: none !important;
    transition: background 0.25s ease, color 0.25s ease;
    text-align: center;
    flex-wrap: wrap;
}

.swipe-approach-btn:hover {
    box-shadow: none !important;
    color: #555 !important;
    background-image: linear-gradient(180deg, #F5F3ED 0%, #F5F3ED 100%) !important;
}

.swipe-approach-btn.active {
    background-color: transparent;
    background-image: linear-gradient(90deg, #D4AF37 0%, #F5E6A0 100%);
    color: #030303;
    font-weight: 600 !important;
    box-shadow: none !important;
}

.swipe-approach-btn.active:hover {
    background-color: transparent;
    background-image: linear-gradient(90deg, #D4AF37 0%, #F5E6A0 100%) !important;
    color: #030303 !important;
    font-weight: 600 !important;
}

/* Hard-lock colors for all interaction states to avoid theme overrides */
.swipe-approach-btn:not(.active),
.swipe-approach-btn:not(.active):hover,
.swipe-approach-btn:not(.active):focus,
.swipe-approach-btn:not(.active):active {
    color: #555 !important;
    font-weight: 600 !important;
}

.swipe-approach-btn.active,
.swipe-approach-btn.active:hover,
.swipe-approach-btn.active:focus,
.swipe-approach-btn.active:active {
    color: #030303 !important;
    font-weight: 600 !important;
}

.swipe-approach-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: inherit;
}

.swipe-approach-btn .price-badge {
    display: inline-block;
    background: rgba(3, 3, 3, 0.10);
    color: #030303;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    position: relative;
    top: -1px;
}

.swipe-approach-btn.active .price-badge {
    background: rgba(255, 255, 255, 0.25);
}

/* Design Tools */
.swipe-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.swipe-tool-btn {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    min-height: 42px !important;
    height: 42px !important;
    padding: 0 14px !important;
    margin: 0 !important;
    background: white !important;
    border: 1px solid #e0e0e0 !important;
    color: #030303 !important;
    border-radius: 4px !important;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    box-shadow: none !important;
    outline: none !important;
    box-sizing: border-box !important;
}

.swipe-tool-btn > * {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
}

.swipe-tool-btn:hover {
    border-color: #CFA739 !important;
    color: #030303 !important;
}

/* Lucide icons — Design Tools */
.swipe-tool-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
}
.swipe-tool-icon svg,
.swipe-tool-btn svg {
    width: 18px !important;
    height: 18px !important;
    color: inherit;
    flex-shrink: 0;
    display: block !important;
    vertical-align: middle !important;
}

.swipe-radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.swipe-radio-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s ease;
    background: #fff;
    font-family: 'Montserrat', sans-serif;
}

.swipe-radio-card:hover {
    border-color: #d9d9d9;
}

.swipe-radio-card:has(input:checked) {
    border: 1px solid #CFA739;
}

.swipe-radio-card input[type="radio"] {
    margin: 0;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid #CFA739;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.swipe-radio-card input[type="radio"]:checked {
    background: #CFA739;
}

.swipe-radio-card input[type="radio"]:hover {
    border-color: #CFA739;
}

.swipe-radio-card .radio-content {
    flex: 1;
}

.swipe-radio-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #030303;
}

.swipe-radio-card small {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    line-height: 1.55;
}

.swipe-radio-badge {
    flex-shrink: 0;
    background: #030303;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.2;
    box-sizing: border-box;
}

/* Card Type Swatches (single row circles) */
.swipe-card-swatches {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    align-items: flex-start;
    overflow: visible;
}

.swipe-card-swatch-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    cursor: pointer;
}

.swipe-card-swatch {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid #e1e1e1;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
}

.swipe-card-swatch-wrap:hover .swipe-card-swatch {
    transform: scale(1.1);
}

.swipe-card-swatch.selected {
    border: 3px solid #D4AF37;

}

.swipe-card-swatch img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Swatch tooltips — aligned so first/last don't get cut off by container overflow */
.swipe-card-swatch-wrap[data-tooltip] {
    position: relative;
}

.swipe-card-swatch-wrap[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #030303;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
}

/* First swatch: align tooltip left so it doesn't get cut off on the left */
.swipe-card-swatch-wrap[data-tooltip]:first-child::after {
    left: 0;
    transform: translateX(0);
}

/* Last swatch: align tooltip right so it doesn't get cut off on the right */
.swipe-card-swatch-wrap[data-tooltip]:last-child::after {
    left: auto;
    right: 0;
    transform: translateX(0);
}

.swipe-card-swatch-wrap[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #030303;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
}

/* Arrow alignment for first/last swatch tooltips */
.swipe-card-swatch-wrap[data-tooltip]:first-child::before {
    left: 24px;
    transform: translateX(0);
}

.swipe-card-swatch-wrap[data-tooltip]:last-child::before {
    left: auto;
    right: 24px;
    transform: translateX(0);
}

.swipe-card-swatch-wrap[data-tooltip]:hover::after,
.swipe-card-swatch-wrap[data-tooltip]:hover::before {
    opacity: 1;
}

.swipe-swatch-price {
    font-size: 10px;
    color: #666;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.swipe-card-swatch-wrap.out-of-stock {
    cursor: not-allowed;
}

.swipe-card-swatch-wrap.out-of-stock .swipe-card-swatch {
    opacity: 0.35;
    pointer-events: none;
    cursor: not-allowed;
}

.swipe-card-swatch-wrap.out-of-stock:hover .swipe-card-swatch {
    border-color: #ddd;
    transform: none;
}

.swipe-swatch-stock {
    font-size: 9px;
    color: #b32d2e;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.swipe-input,
.swipe-select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    color: #030303;
    background: #fff;
    margin-bottom: 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.swipe-input::placeholder {
    color: #b0b0b0;
    font-weight: 300;
}

.swipe-input:focus,
.swipe-select:focus {
    outline: none;
    border-color: #030303;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.swipe-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    color: #030303;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.swipe-textarea::placeholder {
    color: #b0b0b0;
    font-weight: 300;
}

.swipe-textarea:focus {
    outline: none;
    border: 1px solid #CFA739;
    box-shadow: none;
}

.swipe-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
    cursor: pointer;
}

.field-help {
    display: block;
    color: #666;
    font-size: 12px;
    margin-top: -10px;
    margin-bottom: 15px;
}

.swipe-btn-block {
    width: 100%;
    margin-top: 10px;
}

.swipe-btn-delete {
    background: #d63638 !important;
    color: white !important;
    border-color: #d63638 !important;
}

.swipe-color-input {
    width: 100%;
    height: 40px;
    padding: 2px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 15px;
}

.swipe-checkbox-group {
    display: flex;
    gap: 15px;
    margin: 10px 0;
}

.swipe-radio-group-inline {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px;
}

.swipe-radio-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}

.swipe-radio-inline input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.required {
    color: #d63638;
}

/* Swipe Insure Upsell Card */
.swipe-insure-recommended {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    color: #9a7b2e;
    background: rgba(207, 167, 57, 0.2);
    border-radius: 9999px;
    vertical-align: middle;
}

.swipe-control-section .swipe-insure-recommended {
    font-family: 'Montserrat', sans-serif;
}

.swipe-insure-card {
    display: block;
    cursor: pointer;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    padding: 14px;
    transition: border-color 0.2s ease;
    background: #fff;
    font-family: 'Montserrat', sans-serif;
}

.swipe-insure-card:hover {
    border-color: #d9d9d9;
}

.swipe-insure-card.checked {
    border: 1px solid #CFA739;
    background: #fff;
    box-shadow: none;
}

.swipe-insure-card-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.swipe-insure-checkbox {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    margin: 2px 0 0 0;
    cursor: pointer;
    accent-color: #CFA739;
}

.swipe-insure-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.swipe-insure-name {
    font-weight: 600;
    font-size: 14px;
    color: #030303;
    line-height: 1.3;
}

.swipe-insure-desc {
    font-size: 12px;
    font-weight: 500;
    color: #555;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.swipe-insure-price-badge {
    flex-shrink: 0;
    background: #030303;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.2;
    box-sizing: border-box;
    margin-top: 0;
}

.swipe-insure-card.checked .swipe-insure-price-badge {
    background: #030303;
}

/* Design Help Preview (left column placeholder) */
.swipe-help-preview-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    max-width: 85%;
    margin: 0 auto;
}

.swipe-help-preview-card {
    width: 100%;
    aspect-ratio: 1011 / 638;
    border-radius: 16px;
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    overflow: hidden;
    position: relative;
    background-color: #2c3e50;
    background-size: cover;
    background-position: center;
}

.swipe-help-overlay-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Design Help Controls (right column) */
.swipe-help-description {
    color: #666;
    font-size: 14px;
    margin: 0 0 15px 0;
}

.swipe-file-upload {
    margin: 15px 0;
}

.upload-zone {
    border: 2px dashed #ddd;
    border-radius: 4px;
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fff;
}

.upload-zone:hover {
    border-color: #030303;
    background: #f8f9fa;
}

.upload-zone.upload-zone-dragover {
    border-color: #030303;
    background: #eef1f5;
}

.upload-zone .swipe-upload-icon {
    display: block;
    margin-bottom: 4px;
    color: #999;
}

.upload-zone .swipe-upload-icon svg {
    width: 36px;
    height: 36px;
    stroke-width: 1.5;
}

.upload-zone p {
    margin: 5px 0 2px 0;
    font-size: 13px;
}

.upload-zone small {
    font-size: 11px;
    color: #999;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-top: 6px;
    font-size: 13px;
}

.file-item .file-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item-icon {
    display: inline-flex;
    flex-shrink: 0;
}
.file-item-icon svg {
    width: 18px;
    height: 18px;
    color: #030303;
}
.file-delete-icon {
    display: inline-flex;
}
.file-delete-icon svg {
    width: 16px;
    height: 16px;
    color: #999;
}
.file-item .file-delete:hover .file-delete-icon svg {
    color: #030303;
}

.file-item .file-delete {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}

.file-item .file-delete:hover {
    color: #d63638;
}

.file-item .file-delete .dashicons {
    color: inherit;
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Modal Footer — price + button */
.swipe-modal-footer {
    padding: 14px 30px;
    background: #fff;
    border-top: 1px solid #d9d9d9;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
}

.swipe-footer-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.swipe-price-label {
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.swipe-price-amount {
    font-size: 22px;
    font-weight: 600;
    color: #030303;
}

.swipe-modal-footer .button {
    padding: 12px 30px !important;
    font-size: 16px !important;
}

/* Override WordPress button-primary within plugin scope */
.swipe-modal-overlay .button.button-primary,
.swipe-metal-wrapper .button.button-primary {
    background: #000 !important;
    border-color: #000 !important;
    color: #fff !important;
    border-radius: 4px !important;
    padding: 14px 32px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    font-family: 'Montserrat', sans-serif !important;
    letter-spacing: 0.3px;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    text-transform: none;
    line-height: 1.4;
    cursor: pointer;
}

.swipe-modal-overlay .button.button-primary:hover,
.swipe-metal-wrapper .button.button-primary:hover {
    background: #222 !important;
    border-color: #222 !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.swipe-modal-overlay .button.button-primary:active,
.swipe-metal-wrapper .button.button-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

.swipe-modal-footer .button.button-primary {
    padding: 12px 36px !important;
    font-size: 16px !important;
}

/* AI Generator Sub-Modal */
.swipe-sub-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swipe-sub-modal-content {
    background: white;
    padding: 30px;
    border-radius: 4px;
    max-width: 500px;
    width: 90%;
}

.swipe-sub-modal-content h3 {
    margin-top: 0;
}

.swipe-sub-modal-content textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-family: 'Montserrat', sans-serif;
    color: #030303;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.swipe-sub-modal-content textarea::placeholder {
    color: #555;
    font-weight: 500;
}

.swipe-sub-modal-content textarea:focus {
    outline: none;
    border: 1px solid #CFA739;
    box-shadow: none;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* AI Modal — Expanded Layout */
.swipe-ai-modal-content {
    max-width: 560px;
    padding: 0;
    overflow: hidden;
}

.swipe-ai-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #d9d9d9;
}

.swipe-ai-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #030303;
    font-family: 'Montserrat', sans-serif;
}

/* AI usage counter (e.g. "2/5") in the modal header */
.swipe-ai-usage-counter {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    background: #f0f0f0;
    padding: 3px 10px;
    border-radius: 12px;
    margin-left: auto;
    margin-right: 8px;
    font-family: 'Montserrat', sans-serif;
}
.swipe-ai-usage-counter.swipe-ai-usage-exhausted {
    color: #d63638;
    background: #fce4e4;
}

/* AI limit-reached notice inside modal */
.swipe-ai-limit-notice {
    padding: 14px 20px;
    background: #f9f3e3;
    border-top: 1px solid #e8dcc0;
    text-align: center;
}
.swipe-ai-limit-notice p {
    margin: 0 0 10px;
    font-size: 13px;
    color: #665a2e;
    line-height: 1.4;
}
.swipe-ai-gemini-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: #030303;
    color: #fff;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease;
}
.swipe-ai-gemini-link:hover {
    background: #333;
    color: #fff;
}
.swipe-ai-gemini-link svg {
    width: 14px;
    height: 14px;
}

/* Generate button exhausted state */
#generate-ai.swipe-ai-btn-exhausted {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
}

/* AI modal close — match main customizer header close (transparent, no border, grey) */
.swipe-ai-close {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 4px !important;
    font-size: 24px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    color: #888888 !important;
    box-shadow: none !important;
    outline: none !important;
    transition: background 0.2s ease, color 0.2s ease !important;
}

.swipe-ai-close:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    color: #030303 !important;
    border: none !important;
}

/* Preview Area */
.swipe-ai-preview-area {
    position: relative;
    width: 100%;
    max-height: 280px;
    min-height: 180px;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.swipe-ai-preview-placeholder {
    text-align: center;
    color: #555;
}

.swipe-ai-placeholder-icon {
    display: inline-flex;
    margin-bottom: 10px;
}
.swipe-ai-placeholder-icon svg {
    width: 48px;
    height: 48px;
    color: #555;
}

.swipe-ai-preview-placeholder p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

#ai-preview-image {
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
    transition: opacity 0.3s;
}

.swipe-ai-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(248,248,248,0.85);
}

.swipe-ai-loading-icon {
    display: inline-flex;
}
.swipe-ai-loading-icon svg {
    width: 36px;
    height: 36px;
    color: #030303;
    animation: swipe-spin 1s linear infinite;
    will-change: transform;
}
.swipe-ai-loading-icon svg.spin {
    animation: swipe-spin 1s linear infinite;
}

.swipe-ai-loading p {
    margin: 10px 0 0;
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

/* Prompt Area */
.swipe-ai-prompt-area {
    padding: 16px 20px 0;
}

.swipe-ai-prompt-area textarea {
    margin: 0;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    color: #030303;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
}

.swipe-ai-prompt-area textarea::placeholder {
    color: #555;
}

.swipe-ai-prompt-area textarea:focus {
    outline: none;
    border: 1px solid #CFA739;
    box-shadow: none;
}

/* Action Buttons */
.swipe-ai-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 16px 20px;
    gap: 10px;
}

.swipe-ai-actions-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.swipe-ai-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 4px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    transition: background 0.2s ease, border-color 0.2s ease;
}

/* Generate button — primary (matches customizer primary buttons) */
#generate-ai {
    background: #030303 !important;
    border: 1px solid #030303 !important;
    color: #fff !important;
    padding: 12px 20px !important;
    font-size: 14px !important;
    font-family: 'Montserrat', sans-serif !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    min-height: auto !important;
}

#generate-ai:hover {
    background: #222 !important;
    border-color: #222 !important;
    color: #fff !important;
}

.swipe-ai-generate-icon,
.swipe-ai-add-icon {
    display: inline-flex;
    align-items: center;
}
.swipe-ai-generate-icon svg,
.swipe-ai-add-icon svg {
    width: 16px;
    height: 16px;
    margin-right: 4px;
    color: inherit;
}

#generate-ai.loading .swipe-ai-generate-icon svg {
    animation: swipe-spin 1s linear infinite;
    will-change: transform;
}

/* Only show the icon left of the text; hide theme/duplicate spinner on the right */
#generate-ai::after,
#generate-ai.loading::after {
    display: none !important;
}
#generate-ai .swipe-ai-generate-icon ~ svg,
#generate-ai.loading .swipe-ai-generate-icon ~ svg {
    display: none !important;
}

/* Add to Design: hidden until image has been generated */
#ai-add-to-design {
    display: none !important;
    background: #030303 !important;
    border: 1px solid #030303 !important;
    color: #fff !important;
    padding: 12px 20px !important;
    font-size: 14px !important;
    font-family: 'Montserrat', sans-serif !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    min-height: auto !important;
}

#ai-add-to-design.swipe-ai-add-visible {
    display: inline-flex !important;
}

#ai-add-to-design:hover {
    background: #222 !important;
    border-color: #222 !important;
    color: #fff !important;
}

/* Generate as secondary when image exists (next to Add to Design) */
#generate-ai.swipe-ai-generate-secondary {
    background: #fff !important;
    border: 1px solid #d9d9d9 !important;
    color: #030303 !important;
}

#generate-ai.swipe-ai-generate-secondary:hover {
    background: #f5f5f5 !important;
    border-color: #d9d9d9 !important;
    color: #030303 !important;
}

@media (max-width: 480px) {
    .swipe-ai-modal-content {
        width: 95%;
        max-width: none;
    }

    .swipe-ai-actions {
        flex-direction: column;
    }

    .swipe-ai-actions-right {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Layers Panel — desktop: inside controls column; mobile: under card preview */
.swipe-layers-panel {
    margin-top: 16px;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #d9d9d9;
}

.swipe-layers-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    color: #555;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #d9d9d9;
    background: #fff;
}

/* Lucide — Layers header */
.swipe-layers-header-icon {
    display: inline-flex;
    align-items: center;
}
.swipe-layers-header-icon svg {
    width: 16px;
    height: 16px;
    color: #555;
}

.swipe-layers-list {
    max-height: 300px;
    overflow-y: auto;
}

.swipe-layers-empty {
    padding: 16px 14px;
    color: #555;
    font-size: 12px;
    text-align: center;
    font-style: italic;
}

/* Layer Row — vertical stack: header line + inline controls */
.swipe-layer-row {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
}

.swipe-layer-row:last-child {
    border-bottom: none;
}

.swipe-layer-row:hover {
    background: #fff;
}

.swipe-layer-row.active {
    background: #fff;
    border-left: 3px solid #CFA739;
}

.swipe-layer-row.active:hover {
    background: #fff;
}

/* Header line inside each row: icon + name + delete */
.swipe-layer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
}

.swipe-layer-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Lucide — layer row icon & delete */
.swipe-layer-icon svg {
    width: 16px;
    height: 16px;
    color: #555;
}
.swipe-layer-row.active .swipe-layer-icon svg {
    color: #030303;
}
.swipe-layer-delete-icon {
    display: inline-flex;
}
.swipe-layer-delete-icon svg {
    width: 14px;
    height: 14px;
}

.swipe-layer-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
    font-weight: 500;
}

.swipe-layer-row.active .swipe-layer-name {
    color: #030303;
    font-weight: 600;
}

.swipe-layer-delete {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none !important;
    border: none !important;
    padding: 4px;
    cursor: pointer;
    opacity: 0;
    outline: none !important;
    box-shadow: none !important;
}

.swipe-layer-delete:hover,
.swipe-layer-delete:focus {
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.swipe-layer-row:hover .swipe-layer-delete,
.swipe-layer-row.active .swipe-layer-delete {
    opacity: 1;
}

.swipe-layer-delete-icon svg {
    color: #c04040;
    transition: color 0.15s;
}

.swipe-layer-delete:hover .swipe-layer-delete-icon svg {
    color: #a03030;
}

.swipe-layer-row.active .swipe-layer-delete-icon svg {
    color: #c04040;
}

.swipe-layer-row.active .swipe-layer-delete:hover .swipe-layer-delete-icon svg {
    color: #a03030;
}

/* Lucide — Remove BG button in layer controls */
.swipe-layer-rembg-btn .swipe-rembg-icon {
    display: inline-flex;
    align-items: center;
}
.swipe-layer-rembg-btn .swipe-rembg-icon svg {
    width: 14px;
    height: 14px;
    margin-right: 4px;
}
.swipe-layer-controls .swipe-rembg-icon svg.spin,
.swipe-layer-rembg-btn.loading .swipe-rembg-icon svg {
    animation: swipe-spin 1s linear infinite;
    will-change: transform;
}

/* Hide WP/theme duplicate spinner (::after) and any stale Lucide sibling SVGs */
.swipe-layer-rembg-btn::after,
.swipe-layer-rembg-btn.loading::after {
    display: none !important;
}
.swipe-layer-rembg-btn .swipe-rembg-icon ~ svg {
    display: none !important;
}

/* Inline controls (expand below header when row is active) */
.swipe-layer-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 14px 10px;
}

/* Image layer: buttons in one horizontal row to match strip below card */
.swipe-layer-controls-image {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.swipe-layer-text-edit {
    width: 100%;
}

.swipe-layer-text-input {
    width: 100%;
    height: 40px;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #d9d9d9 !important;
    border-radius: 4px;
    color: #030303;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.swipe-layer-text-input:focus {
    outline: none;
    border: 1px solid #CFA739 !important;
    box-shadow: none;
}

/* Name layer: text input (same style as text layer input) */
.swipe-layer-name-input {
    width: 100%;
    height: 40px;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #d9d9d9 !important;
    border-radius: 4px;
    color: #030303;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.swipe-layer-name-input:focus {
    outline: none;
    border: 1px solid #CFA739 !important;
    box-shadow: none;
}

/* Name layer: placement radios (compact inline row) */
.swipe-layer-placement {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.swipe-layer-placement-option {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #555;
    background: #fff;
    transition: all 0.15s;
    flex: 1;
    justify-content: center;
    box-sizing: border-box;
    font-weight: 500;
}

.swipe-layer-placement-option:hover {
    background: #fff;
    border-color: #d9d9d9;
}

.swipe-layer-placement-option input[type="radio"] {
    display: none;
}

.swipe-layer-placement-option:has(input:checked),
.swipe-layer-placement-option.selected {
    background: #fff;
    border: 1px solid #CFA739;
    color: #030303;
    font-weight: 600;
}

.swipe-layer-text-options {
    display: flex;
    align-items: center;
    gap: 8px;
}

.swipe-layer-select,
.swipe-layer-font-select {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    height: 40px;
    background: #fff;
    border: 1px solid #d9d9d9 !important;
    border-radius: 4px;
    color: #030303;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.swipe-layer-select:focus,
.swipe-layer-font-select:focus {
    outline: none;
    border: 1px solid #CFA739 !important;
    box-shadow: none;
}

.swipe-layer-color {
    width: 34px;
    height: 34px;
    padding: 1px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    flex-shrink: 0;
}

/* Color picker + hex input combo */
.swipe-layer-color-combo {
    display: flex;
    align-items: center;
    border: 1px solid #d9d9d9 !important;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background: #fff;
    height: 40px;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.swipe-layer-color-combo:focus-within {
    border: 1px solid #CFA739 !important;
    box-shadow: none;
}

.swipe-layer-color-combo .swipe-layer-color-input {
    width: 38px;
    height: 38px;
    padding: 0;
    border: none;
    cursor: pointer;
    background: transparent;
    flex-shrink: 0;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.swipe-layer-color-combo .swipe-layer-color-input::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.swipe-layer-color-combo .swipe-layer-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.swipe-layer-color-combo .swipe-layer-color-input::-moz-color-swatch {
    border: none;
    border-radius: 2px;
}

.swipe-layer-hex-input {
    width: 68px;
    padding: 4px 6px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    color: #030303;
    border-left: 1px solid #d9d9d9 !important;
    border-radius: 0%;
    border-bottom: none !important;
    border-top: none !important;
    border-right: none !important;
    text-transform: uppercase;
    background: transparent;
    outline: none;
    box-sizing: border-box;
}

.swipe-layer-hex-input:focus {
    background: transparent;
}

.swipe-layer-hex-input.invalid {
    color: #d63638;
}

/* Image layer buttons: match strip below card (d9d9d9 border, #fff bg, #030303 text, 600 weight) */
/* Do not use !important on display — JS toggles visibility via .show()/.hide() for Remove BG vs Undo */
.swipe-layer-controls-image .button.button-small,
.swipe-layer-controls-image .swipe-layer-rembg-btn,
.swipe-layer-controls-image .swipe-layer-undo-rembg-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    white-space: nowrap;
    border: 1px solid #d9d9d9 !important;
    background: #fff !important;
    color: #030303 !important;
    border-radius: 4px !important;
    cursor: pointer;
    box-shadow: none !important;
}

.swipe-layer-controls-image .button.button-small:hover,
.swipe-layer-controls-image .swipe-layer-rembg-btn:hover,
.swipe-layer-controls-image .swipe-layer-undo-rembg-btn:hover {
    background: #f5f5f5 !important;
    border-color: #ccc !important;
    color: #030303 !important;
}

.swipe-layer-undo-rembg-btn .swipe-rembg-icon {
    display: inline-flex;
    align-items: center;
}

.swipe-layer-undo-rembg-btn .swipe-rembg-icon svg {
    width: 12px;
    height: 12px;
    margin-right: 2px;
    color: inherit;
}

/* Image layer: icon size match strip (12px) */
.swipe-layer-controls-image .swipe-layer-rembg-btn .swipe-rembg-icon svg {
    width: 12px;
    height: 12px;
    margin-right: 2px;
    color: inherit;
}

.swipe-layer-controls .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
}

/* Spin animation for layer controls loading */
.swipe-layer-controls .dashicons.spin {
    animation: swipe-spin 1s linear infinite;
}

/* Layers list scrollbar */
.swipe-layers-list::-webkit-scrollbar {
    width: 4px;
}

.swipe-layers-list::-webkit-scrollbar-track {
    background: transparent;
}

.swipe-layers-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.swipe-layers-list::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Mobile Responsive */
@media (max-width: 1200px) {
    .swipe-modal-overlay .swipe-modal-content {
        overflow-y: auto;
    }

    .swipe-design-view {
        grid-template-columns: 1fr;
        height: auto;
    }

    .swipe-canvas-column {
        border-right: none;
        border-bottom: 1px solid #e1e1e1;
        overflow: visible;
        justify-content: flex-start;
    }

    .swipe-controls-column {
        overflow-y: visible;
    }

    .swipe-canvas-wrapper,
    .swipe-back-view,
    .swipe-help-preview-wrapper {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    /*
     * Mobile layout: overlay scrolls, header + content flow naturally,
     * footer sticks to the bottom.
     */
    .swipe-modal-overlay {
        overflow-y: auto;
    }

    .swipe-modal-container {
        display: block;
        height: auto;
        min-height: 100%;
    }

    /* Header: 20px horizontal padding (matches page padding) */
    .swipe-modal-header {
        position: relative;
        padding: 16px 20px;
    }

    .swipe-modal-header h2 {
        font-size: 18px;
        padding-right: 44px; /* space for close button so title doesn’t overlap */
    }

    /* Close button: slightly in from right so X sits centered in its space */
    .swipe-modal-overlay .swipe-modal-header .swipe-modal-close {
        right: 14px;
    }

    /* Hide text labels in close button on mobile, but keep the X icon (.swipe-close-icon) visible */
    .swipe-modal-close span:not(.dashicons):not(.swipe-close-icon) {
        display: none;
    }

    /* Content: no padding here — columns handle their own 20px */
    .swipe-modal-overlay .swipe-modal-content {
        padding: 0;
        overflow-y: visible;
        flex: none;
    }

    /* Left column: 20px padding on mobile */
    .swipe-canvas-column {
        padding: 20px;
    }

    /* Right column: 20px padding on mobile; half at bottom to reduce space below comments */
    .swipe-controls-column {
        padding: 20px 20px 10px 20px;
    }

    /* Footer — price left, button right on mobile */
    .swipe-modal-overlay .swipe-modal-footer {
        position: sticky;
        bottom: 0;
        z-index: 20;
        padding: 12px 20px;
        justify-content: space-between !important;
    }

    .swipe-modal-overlay .swipe-modal-footer .swipe-footer-price {
        margin-right: auto !important;
    }

    /* Layers section: shown below card on mobile for custom design; hidden for pre-designed (Name Placement section used instead) */
    #swipe-customizer-modal.swipe-modal-pre-designed .swipe-layers-panel {
        display: none !important;
    }
    .swipe-layers-list {
        max-height: 280px;
        overflow-y: auto;
    }

    /* Delete button: icon-sized hit area on mobile (no large padding) */
    #swipe-customizer-modal .swipe-layer-delete {
        padding: 6px;
        min-width: 0;
        width: 28px;
        height: 28px;
        box-sizing: border-box;
    }

    /* Front/Back toggles: 14px on mobile (override any parent/body 16px) */
    .swipe-view-toggle {
        font-size: 14px !important;
    }

    .swipe-approach-toggle {
        grid-template-columns: 1fr;
    }

    .swipe-tools-grid {
        grid-template-columns: 1fr;
    }

    .swipe-card-swatches {
        gap: 8px;
    }

    .swipe-card-swatch {
        width: 40px;
        height: 40px;
    }

    .swipe-insure-card-content {
        flex-wrap: wrap;
    }

    .swipe-insure-price-badge {
        font-size: 12px;
        padding: 5px 10px;
    }

    /* Name Placement: font picker full width on mobile */
    #swipe-customizer-modal .swipe-np-style-row {
        flex-wrap: wrap;
    }
    #swipe-customizer-modal .swipe-np-style-row .swipe-np-field {
        flex: 1 1 100% !important;
        min-width: 0;
    }
    #swipe-customizer-modal .swipe-np-style-row .swipe-np-select {
        width: 100%;
    }

    /* Engraved-only: force Name Placement section and font picker full width on mobile (override global .swipe-np-style-row rules) */
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only #swipe-name-placement-section,
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-name-placement-form,
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-np-name-row,
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-np-style-row {
        width: 100% !important;
        max-width: none !important;
    }
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-np-style-row {
        flex-wrap: wrap !important;
    }
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-np-style-row .swipe-np-field {
        flex: 1 1 100% !important;
        min-width: 0 !important;
    }
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-np-style-row .swipe-np-field:has(.swipe-np-color-combo) {
        display: none !important;
    }
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-np-text-input,
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-np-style-row .swipe-np-select {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Font selector & color picker: 50% width each on mobile */
    .swipe-layer-text-options {
        flex-wrap: wrap;
    }

    .swipe-layer-text-options .swipe-layer-font-select,
    .swipe-layer-text-options .swipe-layer-select,
    .swipe-layer-text-options .swipe-layer-color-combo {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    .swipe-layer-text-options .swipe-layer-color-combo {
        width: auto;
    }

    .swipe-layer-text-options .swipe-layer-color-combo .swipe-layer-hex-input {
        flex: 1;
        min-width: 0;
    }
}

/* Rate Limit Notice */
.swipe-rate-limit-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin: 0 0 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    font-size: 13px;
    line-height: 1.4;
    animation: swipe-notice-in 0.3s ease;
}

.swipe-rate-limit-notice .dashicons {
    flex-shrink: 0;
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #e6a800;
}

@keyframes swipe-notice-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ------------------------------------------------------------------ */
/*  Image guide strip (state-driven: detected / bg_removed / printed)   */
/*  Design system: secondary buttons, message row + button row(s)      */
/* ------------------------------------------------------------------ */
/* ~20px gap between card and banner; transparent background so it doesn’t obscure the card */
.swipe-opaque-image-notice {
    margin: 20px auto 0;
    max-width: 85%;
    width: 100%;
    border-radius: 8px;
    font-size: 12px;
    animation: swipe-notice-in 0.3s ease;
    overflow: hidden;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    #swipe-opaque-image-notice,
    .swipe-opaque-image-notice {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    #swipe-opaque-image-notice .swipe-opaque-btn {
        padding: 5px 8px !important;
        font-size: 11px !important;
    }
    #swipe-opaque-image-notice .swipe-opaque-btn svg {
        width: 11px;
        height: 11px;
    }
}

/* State panel: message on first row, actions on next row(s) */
.swipe-guide-state {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px;
}

/* Message row: icon + text */
.swipe-guide-message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

/* ---- State colours (transparent background overlay; subtle border + icon/text colour) ---- */

/* DETECTED (amber/warning) */
.swipe-opaque-image-notice[data-state="detected"] {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(184, 134, 11, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.swipe-guide-icon-warn {
    color: #b8860b;
}
.swipe-opaque-image-notice[data-state="detected"] .swipe-opaque-notice-text {
    color: #665a2e;
}

/* BG_REMOVED (green/success) */
.swipe-opaque-image-notice[data-state="bg_removed"] {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(46, 125, 50, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.swipe-guide-icon-success {
    color: #2e7d32;
}
.swipe-opaque-image-notice[data-state="bg_removed"] .swipe-opaque-notice-text {
    color: #1b5e20;
}

/* PRINTED (blue/info) */
.swipe-opaque-image-notice[data-state="printed"] {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(21, 101, 192, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.swipe-guide-icon-info {
    color: #1565c0;
}
.swipe-opaque-image-notice[data-state="printed"] .swipe-opaque-notice-text {
    color: #1a3e6e;
}

/* ---- Shared inner elements ---- */
.swipe-opaque-notice-icon {
    flex-shrink: 0;
    line-height: 0;
    margin-top: 1px;
}

.swipe-opaque-notice-icon svg {
    width: 14px;
    height: 14px;
}

.swipe-opaque-notice-text {
    flex: 1;
    min-width: 0;
    line-height: 1.35;
    font-weight: 600;
}

/* Button row(s): wrap on narrow screens */
.swipe-opaque-notice-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* ---- Secondary buttons (design system: d9d9d9 border, 030303 text, 4px radius) ---- */
/* Use !important so WordPress/theme .button styles don't override (grey fill, no border) */
#swipe-opaque-image-notice .swipe-opaque-btn,
.swipe-opaque-image-notice .button.swipe-opaque-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    padding: 6px 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.2;
    border-radius: 4px !important;
    cursor: pointer;
    border: 1px solid #d9d9d9 !important;
    background: #fff !important;
    color: #030303 !important;
    white-space: nowrap;
    box-shadow: none !important;
}

#swipe-opaque-image-notice .swipe-opaque-btn:hover:not(:disabled):not(.loading),
.swipe-opaque-image-notice .button.swipe-opaque-btn:hover:not(:disabled):not(.loading) {
    background: #f5f5f5 !important;
    border-color: #ccc !important;
    color: #030303 !important;
}

#swipe-opaque-image-notice .swipe-opaque-btn:disabled,
#swipe-opaque-image-notice .swipe-opaque-btn.loading,
.swipe-opaque-image-notice .button.swipe-opaque-btn:disabled,
.swipe-opaque-image-notice .button.swipe-opaque-btn.loading {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Looks good! button — slightly green (on every state) */
#swipe-opaque-image-notice .swipe-guide-done-btn,
.swipe-opaque-image-notice .swipe-guide-done-btn {
    background: #e8f5e9 !important;
    border-color: #81c784 !important;
    color: #1b5e20 !important;
}
#swipe-opaque-image-notice .swipe-guide-done-btn:hover:not(:disabled),
.swipe-opaque-image-notice .swipe-guide-done-btn:hover:not(:disabled) {
    background: #c8e6c9 !important;
    border-color: #66bb6a !important;
    color: #1b5e20 !important;
}

/* Printed state: hide Undo BG Removal when no image had BG removed (overrides display !important) */
#swipe-opaque-undo-rembg-printed.swipe-guide-undo-hidden {
    display: none !important;
}

#swipe-opaque-image-notice .swipe-opaque-btn svg {
    width: 12px;
    height: 12px;
    color: inherit;
}

/* ---- Loading spinner for Remove BG button ---- */
.swipe-opaque-btn .swipe-opaque-rembg-icon {
    display: inline-flex;
    line-height: 0;
}

.swipe-opaque-btn .swipe-opaque-rembg-icon svg.spin,
.swipe-opaque-btn.loading .swipe-opaque-rembg-icon svg {
    animation: swipe-spin 1s linear infinite;
}

/* Hide WP/theme duplicate spinner (::after) and stale Lucide sibling SVGs */
.swipe-opaque-remove-bg::after,
.swipe-opaque-remove-bg.loading::after {
    display: none !important;
}
.swipe-opaque-remove-bg .swipe-opaque-rembg-icon ~ svg {
    display: none !important;
}

/* ---- Upload image loading overlay (modal) ---- */
.swipe-modal-container {
    position: relative;
}
.swipe-upload-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
}
.swipe-upload-overlay-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(207, 167, 57, 0.25);
    border-top-color: #CFA739;
    border-radius: 50%;
    animation: swipe-spin 0.9s linear infinite;
}

/* ---- Buy Now loading overlay (full viewport, fixed) ---- */
.swipe-buynow-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
}
.swipe-buynow-overlay-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(207, 167, 57, 0.25);
    border-top-color: #CFA739;
    border-radius: 50%;
    animation: swipe-spin 0.9s linear infinite;
}

/* ---- Layer tab: Replace Photo (match strip secondary style) ---- */
.swipe-layer-controls-image .swipe-layer-replace-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 6px 10px !important;
    border-radius: 4px !important;
    border: 1px solid #d9d9d9 !important;
    background: #fff !important;
    color: #030303 !important;
    box-shadow: none !important;
}
.swipe-layer-controls-image .swipe-layer-replace-btn:hover {
    background: #f5f5f5 !important;
    border-color: #ccc !important;
    color: #030303 !important;
}
.swipe-layer-replace-btn .swipe-rembg-icon {
    display: inline-flex;
    align-items: center;
}
.swipe-layer-replace-btn .swipe-rembg-icon svg {
    width: 12px;
    height: 12px;
    margin-right: 2px;
    color: inherit;
}

/* ---- Layer tab: Crop button (match strip secondary style) ---- */
.swipe-layer-controls-image .swipe-layer-crop-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 6px 10px !important;
    border-radius: 4px !important;
    border: 1px solid #d9d9d9 !important;
    background: #fff !important;
    color: #030303 !important;
    box-shadow: none !important;
}
.swipe-layer-controls-image .swipe-layer-crop-btn:hover {
    background: #f5f5f5 !important;
    border-color: #ccc !important;
    color: #030303 !important;
}
.swipe-layer-crop-btn .swipe-rembg-icon {
    display: inline-flex;
    align-items: center;
}
.swipe-layer-crop-btn .swipe-rembg-icon svg {
    width: 12px;
    height: 12px;
    margin-right: 2px;
    color: inherit;
}

/* Layer image buttons: modal-scoped so theme/global CSS cannot override on live */
#swipe-customizer-modal .swipe-layer-controls-image .button.button-small,
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-rembg-btn,
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-undo-rembg-btn,
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-crop-btn,
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-undo-crop-btn,
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-replace-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    font-family: 'Montserrat', sans-serif !important;
    white-space: nowrap !important;
    border: 1px solid #d9d9d9 !important;
    background: #fff !important;
    color: #030303 !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    box-shadow: none !important;
    appearance: none !important;
}
/* Wider min-width only for Remove BG / Undo BG Removal (longer labels); Crop/Replace stay content-width */
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-rembg-btn,
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-undo-rembg-btn {
    min-width: 120px !important;
}
#swipe-customizer-modal .swipe-layer-controls-image .button.button-small:hover,
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-rembg-btn:hover,
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-undo-rembg-btn:hover,
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-crop-btn:hover,
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-undo-crop-btn:hover,
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-replace-btn:hover {
    background: #f5f5f5 !important;
    border-color: #ccc !important;
    color: #030303 !important;
}

/* Force hide Remove BG vs Undo so only one shows on live (theme cannot override) */
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-rembg-btn.swipe-layer-rembg-hidden,
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-undo-rembg-btn.swipe-layer-rembg-hidden {
    display: none !important;
}

/* Force hide Undo Crop until user has cropped (theme cannot override) */
#swipe-customizer-modal .swipe-layer-controls-image .swipe-layer-undo-crop-btn.swipe-layer-crop-hidden {
    display: none !important;
}

#swipe-customizer-modal .swipe-layer-controls-image .swipe-rembg-icon svg,
#swipe-customizer-modal .swipe-layer-crop-btn .swipe-rembg-icon svg,
#swipe-customizer-modal .swipe-layer-replace-btn .swipe-rembg-icon svg {
    width: 12px !important;
    height: 12px !important;
    margin-right: 2px !important;
    color: inherit !important;
    flex-shrink: 0 !important;
}

/* ---- Layer tab: Undo Crop button (same style) ---- */
.swipe-layer-controls-image .swipe-layer-undo-crop-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 6px 10px !important;
    border-radius: 4px !important;
    border: 1px solid #d9d9d9 !important;
    background: #fff !important;
    color: #030303 !important;
    box-shadow: none !important;
}
.swipe-layer-controls-image .swipe-layer-undo-crop-btn:hover {
    background: #f5f5f5 !important;
    border-color: #ccc !important;
    color: #030303 !important;
}
.swipe-layer-undo-crop-btn .swipe-rembg-icon {
    display: inline-flex;
    align-items: center;
}
.swipe-layer-undo-crop-btn .swipe-rembg-icon svg {
    width: 12px;
    height: 12px;
    margin-right: 2px;
    color: inherit;
}

/* ---- Crop Action Bar (below canvas, visible during crop mode) ---- */
/* Same width and alignment as card preview and opaque-image notice */
.swipe-crop-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: #1a1a1a;
    border-radius: 8px;
    margin-top: 8px;
    max-width: 85%;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
}
.swipe-crop-hint {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
}
.swipe-crop-actions {
    display: flex;
    gap: 8px;
}
.swipe-crop-cancel-btn {
    background: transparent !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.4) !important;
    border-radius: 6px !important;
    padding: 6px 16px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer;
    box-shadow: none !important;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.swipe-crop-cancel-btn:hover {
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.6) !important;
}
.swipe-crop-done-btn {
    background: #CFA739 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 6px 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer;
    box-shadow: none !important;
    transition: background 0.2s ease;
}
.swipe-crop-done-btn:hover {
    background: #b8922e !important;
}

@media (max-width: 640px) {
    .swipe-crop-action-bar {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

/* Hide layers panel controls during crop mode */
.swipe-layers-panel.swipe-crop-active .swipe-layer-row {
    pointer-events: none;
    opacity: 0.5;
}

/* =====================================================
   Name Placement Section (pre-designed, all tools off)
   Mirrors layers-panel styling exactly.
   ===================================================== */
.swipe-name-placement-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.swipe-np-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.swipe-np-row-inline {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.swipe-np-field {
    flex: 1;
    min-width: 0;
}

/* Name text input — matches .swipe-layer-name-input */
.swipe-np-text-input {
    width: 100%;
    height: 40px;
    padding: 6px 10px;
    font-family: inherit;
    font-size: 14px;
    border: 1px solid #d9d9d9 !important;
    border-radius: 4px;
    color: #030303;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.swipe-np-text-input:focus {
    outline: none;
    border: 1px solid #CFA739 !important;
    box-shadow: none;
}

/* Font select — matches .swipe-layer-font-select */
.swipe-np-select {
    width: 100%;
    height: 40px;
    padding: 6px 10px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    border: 1px solid #d9d9d9 !important;
    border-radius: 4px;
    color: #030303;
    background: #fff;
    box-sizing: border-box;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.swipe-np-select:focus {
    outline: none;
    border: 1px solid #CFA739 !important;
    box-shadow: none;
}

/* Color combo — matches .swipe-layer-color-combo */
.swipe-np-color-combo {
    display: flex;
    align-items: center;
    border: 1px solid #d9d9d9 !important;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    height: 40px;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.swipe-np-color-combo:focus-within {
    border: 1px solid #CFA739 !important;
    box-shadow: none;
}

/* Color swatch — matches .swipe-layer-color-input */
.swipe-np-color-picker {
    width: 38px;
    height: 38px;
    padding: 0;
    border: none;
    cursor: pointer;
    background: transparent;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.swipe-np-color-picker::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.swipe-np-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.swipe-np-color-picker::-moz-color-swatch {
    border: none;
    border-radius: 2px;
}

/* Hex input — matches .swipe-layer-hex-input */
.swipe-np-hex-input {
    width: 68px;
    padding: 4px 6px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    color: #030303;
    border-left: 1px solid #d9d9d9 !important;
    border-radius: 0%;
    border-bottom: none !important;
    border-top: none !important;
    border-right: none !important;
    text-transform: uppercase;
    background: transparent;
    outline: none;
    box-sizing: border-box;
}

.swipe-np-hex-input:focus {
    background: transparent;
}

.swipe-np-hex-input.invalid {
    color: #d63638;
}

/* Placement radios — matches .swipe-layer-placement / .swipe-layer-placement-option */
.swipe-np-position-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.swipe-np-position-option {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    background: #fff;
    transition: all 0.15s;
    flex: 1;
    justify-content: center;
    box-sizing: border-box;
}

.swipe-np-position-option:hover {
    background: #fff;
    border-color: #d9d9d9;
}

.swipe-np-position-option input[type="radio"] {
    display: none;
}

.swipe-np-position-option:has(input:checked),
.swipe-np-position-option.selected {
    background: #fff;
    border: 1px solid #CFA739;
    color: #030303;
    font-weight: 600;
}

/* Dim name/font/colour rows when "No Name" is selected */
.swipe-np-disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Hide font/colour row when name is on back (back uses engraved colour only) */
.swipe-np-style-row.swipe-np-style-row-back {
    display: none !important;
}

/* Pre-designed engraved-only: hide colour picker in Name Placement section (engraved only) */
#swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-np-style-row .swipe-np-color-combo {
    display: none !important;
}

/* Engraved-only pre-designed, desktop: name input and font on same row; font picker extends to align with No Name */
@media (min-width: 769px) {
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-name-placement-form {
        flex-direction: row;
        flex-wrap: wrap;
    }
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-name-placement-form > .swipe-np-row:first-child {
        flex: 0 0 100%;
    }
    /* Name row and style row: 50/50 */
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-name-placement-form > .swipe-np-name-row,
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-name-placement-form > .swipe-np-style-row {
        flex: 1 1 0%;
        min-width: 0;
    }
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-np-name-row .swipe-np-text-input {
        min-width: 0;
    }
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-np-style-row {
        display: flex !important;
        flex-direction: row !important;
    }
    /* Hide the colour field wrapper so font field can take full width of style row */
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-np-style-row .swipe-np-field:has(.swipe-np-color-combo) {
        display: none !important;
    }
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-np-style-row .swipe-np-field {
        flex: 1 1 100%;
        min-width: 0;
    }
    #swipe-customizer-modal.swipe-modal-pre-designed.swipe-modal-engraved-only .swipe-np-style-row .swipe-np-select {
        width: 100%;
    }
}

/* Name Placement: keep font picker and colour pick on one line (no stack; modal-scoped for live) */
#swipe-customizer-modal .swipe-np-style-row.swipe-np-row-inline,
.swipe-np-style-row.swipe-np-row-inline {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
}
#swipe-customizer-modal .swipe-np-style-row .swipe-np-field,
.swipe-np-style-row .swipe-np-field {
    flex: 1 1 0% !important;
    min-width: 0 !important;
}
.swipe-np-style-row .swipe-np-color-combo .swipe-np-hex-input {
    flex: 1;
    min-width: 0;
}

