/* ======================================================
   Woo Greeting Card Designer - Moonpig-Style Card Editor
   @package WooGreetingCardDesigner
   @since 1.3.0
====================================================== */

/* ==================================================
    NEW COMPONENT STYLES (Smart Greeting Editor)
    ==================================================*/

/* View mode tabs (Inside / Cover) */
.wgcd-view-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    padding: 0 20px;
    margin-top: 16px;
}

.wgcd-tab-btn {
    padding: 8px 24px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s ease;
}

.wgcd-tab-btn:first-child {
    border-radius: 6px 0 0 6px;
    border-right: none;
}

.wgcd-tab-btn:last-child {
    border-radius: 0 6px 6px 0;
}

.wgcd-tab-btn:hover {
    background: #eeeeee;
    color: #333;
}

.wgcd-tab-btn.active {
    background: linear-gradient(135deg, #ffffff 0%, #f8f8f8 100%);
    color: #1a237e;
    font-weight: 600;
    border-color: #1a237e;
}


/* ==================================================
   SMART ZONES OVERLAY — positioned to match .wgcd-card-interior-right exactly
   DOM location: direct child of .wgcd-greeting-card (avoids stacking-context conflicts)
   This creates a precise coordinate system identical to interior-right.
   ==================================================*/
.wgcd-smart-zones {
    position: absolute;
    top: 0;
    left: 403px;              /* matches .wgcd-card-interior-right */
    width: 417px;             /* matches .wgcd-card-interior-right */
    height: 100%;
    z-index: 100;             /* above Fabric canvas (z-index ~10-50) */
    pointer-events: none;     /* wrapper ignores events, zones override */
    overflow: visible;        /* don't clip zone buttons */
}

/* Each smart zone: dashed blue border, light blue background */
.wgcd-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    border: 2.5px dashed #2196F3;
    border-radius: 10px;
    background: rgba(33, 150, 243, 0.07);
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s ease;
    user-select: none;
    white-space: nowrap;
    /* Auto-size so it doesn't cover greeting text */
    max-width: 85%;
}

.wgcd-zone:hover {
    background: rgba(33, 150, 243, 0.14);
    border-color: #1976D2;
    transform: scale(1.03);
    box-shadow: 0 3px 12px rgba(33, 150, 243, 0.2);
}

.wgcd-zone-icon {
    font-size: 18px;
    font-weight: 700;
    color: #1976D2;
    line-height: 1;
}

.wgcd-zone-label {
    font-size: 13px;
    font-weight: 600;
    color: #1565C0;
    letter-spacing: 0.2px;
}

/* Heading zone — near top of the right page */
.wgcd-zone-heading {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
}

/* Closing zone — near bottom of the right page */
.wgcd-zone-closing {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
}

/* ==================================================
    FLOATING TOOLBAR (premium polish)
    Larger border radius, stronger shadow, better spacing.
    ==================================================*/
.wgcd-floating-toolbar {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%) translateY(calc(100% + 16px));
    display: flex;
    align-items: stretch;
    gap: 10px;
    padding: 14px 18px;
    background: #1e1e2e;
    border-radius: 16px;
    box-shadow:
        0 12px 48px rgba(0, 0, 0, 0.45),
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.wgcd-floating-toolbar.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Toolbar sections with proper gaps and dividers */
.wgcd-floating-toolbar .wgcd-toolbar-section {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.wgcd-floating-toolbar .wgcd-toolbar-section:last-child {
    border-right: none;
}

/* Visible labels above controls */
.wgcd-toolbar-label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    margin-bottom: 3px;
    white-space: nowrap;
}

/* Font selector in floating toolbar — visible on dark bg */
.wgcd-floating-toolbar .wgcd-font-selector {
    flex-direction: column !important;
}

.wgcd-floating-toolbar .wgcd-font-selector select {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    min-width: 110px;
    max-width: 140px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.wgcd-floating-toolbar .wgcd-font-selector select:hover {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.18);
}

.wgcd-floating-toolbar .wgcd-font-selector select:focus {
    border-color: #7c4dff;
    box-shadow: 0 0 0 2px rgba(124, 77, 255, 0.25);
}

.wgcd-floating-toolbar .wgcd-font-selector select option {
    background: #2a2a3a;
    color: #ffffff;
}

/* Size control section */
.wgcd-floating-toolbar .wgcd-size-control {
    flex-direction: column !important;
    gap: 4px !important;
    min-width: 76px;
    align-items: center;
}

.wgcd-floating-toolbar .wgcd-size-display {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    line-height: 1;
}

.wgcd-floating-toolbar .wgcd-size-control input[type="range"] {
    width: 72px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

/* Colour section */
.wgcd-floating-toolbar .wgcd-colour-swatches {
    flex-direction: column !important;
    gap: 5px !important;
}

.wgcd-floating-toolbar .wgcd-colour-swatches input[type="color"] {
    width: 30px;
    height: 30px;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    background: rgba(255, 255, 255, 0.08);
    transition: border-color 0.2s ease, transform 0.15s ease;
}

.wgcd-floating-toolbar .wgcd-colour-swatches input[type="color"]:hover {
    border-color: rgba(255, 255, 255, 0.35);
    transform: scale(1.08);
}

.wgcd-floating-toolbar .wgcd-colour-swatches input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.wgcd-swatch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.wgcd-swatch {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.wgcd-swatch:hover {
    transform: scale(1.25);
    border-color: rgba(255, 255, 255, 0.45);
}

/* Toggle / align buttons in floating toolbar */
.wgcd-floating-toolbar .wgcd-toggle-group button,
.wgcd-floating-toolbar .wgcd-align-group button {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #ffffff;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.15s ease;
}

.wgcd-floating-toolbar .wgcd-toggle-group button:hover,
.wgcd-floating-toolbar .wgcd-align-group button:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.25);
}

.wgcd-floating-toolbar .wgcd-toggle-group button.active,
.wgcd-floating-toolbar .wgcd-align-group button.active {
    background: #7c4dff;
    border-color: #9c6fff;
    box-shadow: 0 2px 8px rgba(124, 77, 255, 0.35);
}

/* ==================================================
   EDITOR FOOTER (simplified — primary action on right)
   ==================================================*/
.wgcd-editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    gap: 12px;
}

/* Primary "Accept Design" button — green gradient, larger */
.wgcd-btn-primary {
    background: linear-gradient(135deg, #43a047 0%, #66bb6a 100%) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    padding: 12px 28px !important;
    box-shadow:
        0 3px 10px rgba(67, 160, 71, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

.wgcd-btn-primary:hover {
    background: linear-gradient(135deg, #388e3c 0%, #43a047 100%) !important;
    box-shadow:
        0 6px 20px rgba(67, 160, 71, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

/* Tooltip for advanced link */
.wgcd-advanced-link[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: #333;
    color: #fff;
    font-size: 11px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 200;
    pointer-events: none;
}

/* ==================================================
   END NEW COMPONENT STYLES
   ==================================================*/

/* ==================================================
   MODAL OVERLAY
=================================================*/
.wgcd-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.88) 0%, rgba(20,15,10,0.92) 100%);
    z-index: 999999;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: wgcd_fadeIn 0.3s ease-in-out;
}

@keyframes wgcd_fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.wgcd-modal-overlay.wgcd-active {
    display: flex;
}

/* ==================================================

.wgcd-editor-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #3a2e1f;
    letter-spacing: -0.3px;
}

.wgcd-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0 4px;
    transition: all 0.2s;
    border-radius: 6px;
}

.wgcd-modal-close:hover {
    color: #333;
    background: rgba(0,0,0,0.06);
}

/* ==================================================
   CARD STAGE (perspective container)
=================================================*/
.wgcd-card-stage {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 540px;
    overflow: hidden;
    background: linear-gradient(180deg, #f5efe5 0%, #ede6d8 100%);
    padding: 30px 40px;
    position: relative;
}

/* ==================================================
   THE GREETING CARD (complete folded card)
=================================================*/
.wgcd-greeting-card {
    position: relative;
    width: 820px;
    height: 520px;
    transition: transform 0.3s ease;
}

/* ==================================================
   LAYER 1: INSIDE PAGES (bottom layer, always visible)
==================================================*/
.wgcd-card-inside-pages {
    position: absolute;
    top: 0;
    left: 0;
    width: 403px;
    height: 100%;
    background: #faf6ed;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.03);
    z-index: 1;
}

/* Inside left page - subtle paper texture (400px wide portrait) */
.wgcd-card-interior-left {
    width: 400px;
    height: 100%;
    background:
        repeating-linear-gradient(
            to bottom,
            transparent,
            transparent 28px,
            rgba(200,190,170,0.12) 28px,
            rgba(200,190,170,0.12) 29px
        ),
        linear-gradient(to right, #f2ebe0 0%, #faf6ed 40%);
}

/* Spine / fold line (textured) at x=398px */
.wgcd-spine-line {
    position: absolute;
    left: 398px;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        #d9cdb8 4%,
        #e5d9c5 12%,
        #dfD3bc 25%,
        #cfbfa6 40%,
        #c4b397 50%,
        #cfbfa6 60%,
        #dfD3bc 75%,
        #e5d9c5 88%,
        #d9cdb8 96%,
        transparent 100%
    );
    box-shadow:
        -1px 0 3px rgba(0,0,0,0.07),
        1px 0 3px rgba(0,0,0,0.05);
}

/* ==================================================
   INSIDE-RIGHT (fixed position on right side of container)
==================================================*/
.wgcd-card-interior-right {
    position: absolute;
    left: 403px;
    top: 0;
    width: 417px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

/* Canvas inside the interior right page */
.wgcd-card-interior-right canvas {
    border: 1px dashed #ddd5c5;
    border-radius: 2px;
    background: rgba(255,255,255,0.6);
}

/* ==================================================
   LAYER 2: FRONT COVER (two-face 3D card layer)
   Cover sits on RIGHT side of card, spine at LEFT edge
==================================================*/
.wgcd-card-cover {
    position: absolute;
    top: 0;
    left: 400px;
    width: 420px;
    height: 100%;
    z-index: 10;

    /* SPINE at LEFT edge of cover div = fold point */
    transform-origin: left center;

    /* Enable true 3D rendering for dual faces */
    transform-style: preserve-3d;

    transition: transform 0.85s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

/* ==================================================
   COVER FACES (shared by front and back)
=================================================*/
.wgcd-cover-face-front,
.wgcd-cover-face-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    /* KEY: when face rotates past 90°, hide the back side */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* ==================================================
   FRONT FACE (product image, visible when closed)
==================================================*/
.wgcd-cover-face-front {
    transform: rotateY(0deg) translateZ(2px);
    z-index: 10;
    border-radius: 0 6px 6px 0;
}

/* Cover front image container */
.wgcd-cover-front-image {
    width: 100%;
    height: 100%;
    overflow: hidden;
    box-shadow:
        3px 2px 15px rgba(0,0,0,0.2),
        inset 0 0 30px rgba(0,0,0,0.02);
}

.wgcd-cover-front-image img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    object-position: center;
    display: block;
    transition: filter 0.3s ease;
}

/* Hover brightness on cover */
.wgcd-card-cover:hover .wgcd-cover-front-image img {
    filter: brightness(1.04);
}

/* ==================================================
   BACK FACE (cream interior of cover, visible when open)
=================================================*/
.wgcd-cover-face-back {
    transform: rotateY(180deg) translateZ(2px);
    background: #f5f0e5; /* cream/paper color on inside of cover */
    z-index: 5;
}

/* ==================================================
   COVER SHADOW (depth illusion, stays with front face)
=================================================*/
.wgcd-cover-shadow {
    position: absolute;
    top: 0; right: 0;
    width: 35px; height: 100%;
    background: linear-gradient(to left, rgba(0,0,0,0.2), transparent);
    pointer-events: none;
    z-index: 11;

    /* Shadow stays with front face (hidden when cover flips) */
    backface-visibility: hidden;
    transform: rotateY(0deg) translateZ(3px);
}

/* ==================================================
   OPEN STATE (cover rotates around spine to reveal inside)
=================================================*/
.wgcd-greeting-card.open .wgcd-card-cover {
    transform: rotateY(-180deg);
}

/* When open, shadow moves with cover to right edge */
.wgcd-greeting-card.open .wgcd-cover-shadow {
    background: linear-gradient(to right, rgba(0,0,0,0.12), transparent);
    left: 0;
    right: auto;
}

/* When card is open, cover must not block interior pages */
.wgcd-greeting-card.open .wgcd-card-cover {
    opacity: 0;
    pointer-events: none;
    z-index: 0;
}

/* When card is open, inside-pages rise above cover to reveal canvas */
.wgcd-greeting-card.open .wgcd-card-inside-pages {
    z-index: 20;
}

/* ==================================================
   CLICK HINT (shown when card is closed)
=================================================*/
.wgcd-card-hint {
    position: absolute;
    top: 50%;
    left: calc(75% - 15px);
    transform: translate(-50%, -50%);
    color: #5a4a38;
    font-size: 15px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.92);
    padding: 12px 24px;
    border-radius: 30px;
    pointer-events: none;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    letter-spacing: 0.3px;
}

.wgcd-card-hint.visible {
    opacity: 1;
}

/* Fade out hint after card is opened */
.wgcd-greeting-card.open ~ .wgcd-card-hint {
    opacity: 0 !important;
}

/* ==================================================
   TEXT FORMATTING TOOLBAR (shown when text selected) — legacy inline style
==================================================*/
.wgcd-text-toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 12px 28px;
    background: linear-gradient(180deg, #f8f3ea 0%, #f0e9db 100%);
    border-top: 1px solid #e5ddd0;
    border-bottom: 1px solid #e5ddd0;
    flex-wrap: wrap;
    animation: wgcd_fadeInToolbar 0.25s ease-in-out;
}

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

.wgcd-toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Toolbar select */
.wgcd-text-toolbar select#wgcdFontFamily {
    padding: 7px 12px;
    border: 1px solid #d5ccbe;
    border-radius: 6px;
    font-size: 13px;
    background: #ffffff;
    color: #3a2e1f;
    cursor: pointer;
    min-width: 140px;
    transition: border-color 0.2s;
}

.wgcd-text-toolbar select#wgcdFontFamily:focus {
    outline: none;
    border-color: #2563eb;
}

/* Toolbar number input (font size) */
.wgcd-text-toolbar input[type="number"]#wgcdFontSize {
    width: 60px;
    padding: 7px 8px;
    border: 1px solid #d5ccbe;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
    background: #ffffff;
    color: #3a2e1f;
    transition: border-color 0.2s;
}

.wgcd-text-toolbar input[type="number"]#wgcdFontSize:focus {
    outline: none;
    border-color: #2563eb;
}

/* Toolbar color picker */
.wgcd-text-toolbar input[type="color"]#wgcdTextColor {
    width: 36px;
    height: 36px;
    padding: 2px;
    border: 1px solid #d5ccbe;
    border-radius: 6px;
    cursor: pointer;
    background: #ffffff;
    transition: border-color 0.2s, transform 0.2s;
}

.wgcd-text-toolbar input[type="color"]#wgcdTextColor:hover {
    border-color: #2563eb;
    transform: scale(1.08);
}

/* Toggle buttons (bold, italic, underline) */
.wgcd-toggle-group button {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d5ccbe;
    border-radius: 6px;
    background: #ffffff;
    font-size: 14px;
    cursor: pointer;
    color: #3a2e1f;
    transition: all 0.2s;
}

.wgcd-toggle-group button:hover {
    border-color: #2563eb;
    background: #f0f4ff;
}

.wgcd-toggle-group button.active {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
}

/* Alignment buttons */
.wgcd-align-group button {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d5ccbe;
    border-radius: 6px;
    background: #ffffff;
    font-size: 16px;
    cursor: pointer;
    color: #3a2e1f;
    transition: all 0.2s;
}

.wgcd-align-group button:hover {
    border-color: #2563eb;
    background: #f0f4ff;
}

.wgcd-align-group button.active {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
}

/* ==================================================
   TOOLBAR (main)
==================================================*/
.wgcd-toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 18px 28px;
    background: linear-gradient(180deg, #f8f3ea 0%, #f0e9db 100%);
    border-top: 1px solid #e5ddd0;
    flex-wrap: wrap;
}

/* Toolbar divider */
.wgcd-toolbar-divider {
    width: 1px;
    height: 28px;
    background: #d5ccbe;
    margin: 0 4px;
}

/* Individual button */
.wgcd-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 22px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.wgcd-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.wgcd-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.wgcd-btn-open {
    background: linear-gradient(135deg, #6db86b 0%, #4CAF50 100%);
    color: #ffffff;
}

.wgcd-btn-open:hover {
    background: linear-gradient(135deg, #7cc57a 0%, #43a047 100%);
}

.wgcd-btn-text {
    background: linear-gradient(135deg, #5b9bd5 0%, #2196F3 100%);
    color: #ffffff;
}

.wgcd-btn-text:hover {
    background: linear-gradient(135deg, #6fa8df 0%, #1e88e5 100%);
}

.wgcd-btn-save {
    background: linear-gradient(135deg, #f0a040 0%, #FF9800 100%);
    color: #ffffff;
}

.wgcd-btn-save:hover {
    background: linear-gradient(135deg, #f5ae55 0%, #f57c00 100%);
}

.wgcd-btn-close {
    background: linear-gradient(135deg, #8a8a8a 0%, #616161 100%);
    color: #ffffff;
}

.wgcd-btn-close:hover {
    background: linear-gradient(135deg, #9e9e9e 0%, #424242 100%);
}

/* ==================================================
   STATUS / FEEDBACK AREA
=================================================*/
.wgcd-editor-status {
    text-align: center;
    padding: 14px 28px;
    font-size: 14px;
    border-top: 1px solid #e5ddd0;
    background: #faf8f4;
}

.wgcd-editor-status.wgcd-success {
    color: #2e7d32;
    background: #e8f5e9;
}

.wgcd-editor-status.wgcd-error {
    color: #c62828;
    background: #ffebee;
}

/* ==================================================
   LOADING SPINNER
=================================================*/
.wgcd-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: wgcd_spin 0.6s linear infinite;
}

@keyframes wgcd_spin {
    to { transform: rotate( 360deg ); }
}

/* ==================================================
   RESPONSIVE - TABLET (<=900px)
=================================================*/
@media ( max-width: 900px ) {
    .wgcd-card-editor {
        max-width: 720px;
    }

    .wgcd-card-stage {
        height: 440px;
        padding: 24px 32px;
    }

    .wgcd-greeting-card {
        width: 620px;
        height: 420px;
    }

    .wgcd-toolbar {
        gap: 8px;
    }

    .wgcd-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* ==================================================
   RESPONSIVE - MOBILE (<=640px)
=================================================*/
@media ( max-width: 640px ) {
    .wgcd-modal-overlay {
        padding: 0;
    }

    .wgcd-card-editor {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .wgcd-editor-header {
        padding: 14px 20px;
    }

    .wgcd-editor-title {
        font-size: 16px;
    }

    .wgcd-card-stage {
        flex: 1;
        min-height: 280px;
        max-height: 45vh;
        padding: 12px;
    }

    .wgcd-greeting-card {
        width: 360px;
        height: 225px;
    }

    .wgcd-card-interior-right canvas {
        max-width: 168px !important;
        max-height: 210px !important;
    }

    /* Hide hint on mobile */
    .wgcd-card-hint {
        display: none;
    }

    .wgcd-toolbar {
        padding: 10px 14px;
        gap: 6px;
        flex-wrap: wrap;
    }

    .wgcd-toolbar-divider {
        display: none;
    }

    .wgcd-btn {
        flex: 1;
        min-width: 80px;
        padding: 9px 8px;
        font-size: 12px;
        justify-content: center;
    }

    .wgcd-editor-status {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* ==================================================
   RESPONSIVE - SMALL MOBILE (<=400px)
=================================================*/
@media ( max-width: 400px ) {
    .wgcd-greeting-card {
        width: 310px;
        height: 195px;
    }

    .wgcd-card-interior-right canvas {
        max-width: 142px !important;
        max-height: 178px !important;
    }

    .wgcd-editor-title {
        font-size: 14px;
    }

    .wgcd-btn {
        min-width: 70px;
        padding: 7px 5px;
        font-size: 11px;
    }
}

/* ==================================================
   ACCESSIBILITY - Focus styles
=================================================*/
.wgcd-btn:focus-visible,
.wgcd-modal-close:focus-visible {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
}

/* ==================================================
   PREMIUM PRODUCT PAGE CTA BUTTON
   ✨ Personalise Your Card button styling
================================================== */

/* Main wrapper for premium CTA button row */
.wgcd-product-button {
    margin-top: 20px;
    text-align: center;
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Premium blue pill-shaped CTA button */
.wgcd-premium-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 60px;
    padding: 18px 45px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.3px;
    color: #ffffff !important;
    text-decoration: none !important;
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 40%, #60a5fa 100%);
    border: none;
    border-radius: 999px;
    box-shadow:
        0 4px 15px rgba(37, 99, 235, 0.3),
        0 2px 6px rgba(37, 99, 235, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    font-family: inherit;
}

/* Subtle shine overlay on button */
.wgcd-premium-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.12) 50%,
        transparent 100%
    );
    transition: left 0.6s ease;
}

.wgcd-premium-cta:hover::before {
    left: 100%;
}

/* Hover state — darker blue + lift */
.wgcd-premium-cta:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 40%, #3b82f6 100%);
    transform: translateY(-3px);
    box-shadow:
        0 8px 25px rgba(37, 99, 235, 0.4),
        0 4px 12px rgba(37, 99, 235, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Active/pressed state */
.wgcd-premium-cta:active {
    transform: translateY(-1px);
    box-shadow:
        0 3px 12px rgba(37, 99, 235, 0.3),
        0 1px 4px rgba(37, 99, 235, 0.2);
}

/* Focus visible for accessibility */
.wgcd-premium-cta:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: 3px;
}

/* Sparkle + text icon styling */
.wgcd-premium-cta-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 22px;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
    transition: transform 0.3s ease;
}

.wgcd-premium-cta:hover .wgcd-premium-cta-icon {
    transform: scale(1.1) rotate(-5deg);
}

.wgcd-premium-cta-text {
    display: inline;
    transition: letter-spacing 0.3s ease;
}

.wgcd-premium-cta:hover .wgcd-premium-cta-text {
    letter-spacing: 0.8px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .wgcd-premium-cta {
        padding: 15px 35px;
        font-size: 18px;
        min-height: 52px;
        width: 100%;
        max-width: 400px;
    }

    .wgcd-premium-cta-icon {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .wgcd-premium-cta {
        padding: 13px 28px;
        font-size: 16px;
        min-height: 48px;
        gap: 8px;
    }

    .wgcd-premium-cta-icon {
        font-size: 18px;
    }
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect( 0, 0, 0, 0 );
    white-space: nowrap;
    border: 0;
}

/*


/* ==========================================================
   WGCD EDITOR POLISH — clean, greeting-card focused UI
   ========================================================== */
.wgcd-card-editor {
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
    overflow: hidden;
}

.wgcd-editor-header {
    padding: 16px 22px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.wgcd-editor-title {
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.wgcd-modal-close {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    transition: transform .15s ease, background-color .15s ease;
}

.wgcd-modal-close:hover {
    transform: scale(1.05);
}

.wgcd-view-tabs {
    gap: 6px;
    padding: 8px;
    border-radius: 12px;
}

.wgcd-tab-btn {
    min-width: 92px;
    border-radius: 9px;
    font-weight: 600;
    transition: transform .15s ease, box-shadow .15s ease;
}

.wgcd-tab-btn:hover {
    transform: translateY(-1px);
}

.wgcd-smart-zones .wgcd-zone {
    border-radius: 12px;
    border-width: 1px;
    box-shadow: 0 5px 18px rgba(0,0,0,.08);
    backdrop-filter: blur(4px);
}

.wgcd-floating-toolbar {
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    box-shadow: 0 14px 38px rgba(0,0,0,.18);
    border: 1px solid rgba(0,0,0,.08);
}

.wgcd-floating-toolbar select,
.wgcd-floating-toolbar input[type="range"],
.wgcd-floating-toolbar input[type="color"] {
    cursor: pointer;
}

#wgcdFontFamily {
    min-width: 190px;
    padding: 8px 10px;
    border-radius: 9px;
}

.wgcd-toolbar-section button {
    min-width: 34px;
    min-height: 34px;
    border-radius: 8px;
}

.wgcd-swatch {
    width: 23px;
    height: 23px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
    transition: transform .12s ease;
}

.wgcd-swatch:hover {
    transform: scale(1.15);
}

.wgcd-btn {
    border-radius: 10px;
    font-weight: 650;
}

.wgcd-btn-primary {
    box-shadow: 0 6px 16px rgba(0,0,0,.12);
}

@media (max-width: 700px) {
    .wgcd-floating-toolbar {
        gap: 8px;
        padding: 10px;
    }

    #wgcdFontFamily {
        min-width: 145px;
        max-width: 180px;
    }
}


/* ==========================================================
   WGCD UX FEATURES — Undo/Redo, Delete, Greeting Styles
   ========================================================== */
.wgcd-history-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-right: auto;
}

.wgcd-history-btn {
    appearance: none;
    border: 1px solid rgba(0,0,0,.14);
    background: #fff;
    border-radius: 9px;
    padding: 8px 12px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
}

.wgcd-history-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.09);
}

.wgcd-history-btn:disabled {
    opacity: .38;
    cursor: default;
}

.wgcd-style-presets {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.wgcd-style-presets button {
    width: auto;
    min-width: 0;
    padding: 6px 9px;
    font-size: 12px;
    white-space: nowrap;
}

.wgcd-style-presets button[data-wgcd-greeting-style="elegant"] {
    font-family: Georgia, serif;
    font-style: italic;
}

.wgcd-style-presets button[data-wgcd-greeting-style="modern"] {
    font-family: "Trebuchet MS", sans-serif;
}

.wgcd-style-presets button[data-wgcd-greeting-style="handwritten"] {
    font-family: "Segoe Script", "Brush Script MT", cursive;
}

.wgcd-style-presets button[data-wgcd-greeting-style="classic"] {
    font-family: Garamond, Georgia, serif;
}

.wgcd-delete-text {
    width: auto !important;
    padding: 6px 10px !important;
    white-space: nowrap;
}

.wgcd-delete-text:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

@media (max-width: 850px) {
    .wgcd-editor-footer {
        flex-wrap: wrap;
        gap: 10px;
    }

    .wgcd-history-controls {
        order: 1;
    }

    .wgcd-style-presets {
        width: 100%;
    }
}


/* Keep formatting controls clear of the text being edited.
   Closing text is near the bottom, so its toolbar moves to the top. */
.wgcd-floating-toolbar.wgcd-toolbar-top {
    top: 12px;
    bottom: auto;
    transform: translateX(-50%) translateY(calc(-100% - 16px));
}

.wgcd-floating-toolbar.wgcd-toolbar-top.visible {
    transform: translateX(-50%) translateY(0);
}

.wgcd-floating-toolbar.wgcd-toolbar-bottom {
    top: auto;
    bottom: 12px;
}


/* ==========================================================
   CLEAN WHITE CARD INTERIOR
   The inside artwork must print exactly white: no paper tint,
   texture, centre rule, gradient, inset shadow or canvas border.
   ========================================================== */
.wgcd-card-inside-pages,
.wgcd-card-interior-left,
.wgcd-card-interior-right,
.wgcd-card-interior-right .canvas-container,
.wgcd-card-interior-right .lower-canvas {
    background: #ffffff !important;
    background-image: none !important;
    box-shadow: none !important;
}

/* Fabric's upper canvas is the interaction layer ABOVE the rendered text.
   It must stay transparent or it will cover greetings/headings/closings. */
.wgcd-card-interior-right .upper-canvas {
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
}

.wgcd-card-interior-right canvas,
.wgcd-card-interior-right .lower-canvas,
.wgcd-card-interior-right .upper-canvas {
    border: 0 !important;
    border-radius: 0 !important;
}

/* The old decorative spine is visual chrome only; remove it from the
   personalisation view so the inside spread is completely clean. */
.wgcd-spine-line {
    display: none !important;
    background: none !important;
    box-shadow: none !important;
}


/* =========================================================
   Curated greeting-card colour palette
   ========================================================= */
.wgcd-colour-swatches {
    min-width: 210px;
}
#wgcdSwatchRow.wgcd-swatch-row,
.wgcd-swatch-row {
    display: grid;
    grid-template-columns: repeat(8, 26px);
    gap: 7px;
    margin-top: 8px;
    align-items: center;
}
.wgcd-colour-swatch {
    width: 26px;
    height: 26px;
    min-width: 26px;
    padding: 0 !important;
    margin: 0 !important;
    border: 2px solid #fff !important;
    border-radius: 50% !important;
    box-shadow: 0 0 0 1px rgba(0,0,0,.18), 0 2px 4px rgba(0,0,0,.10);
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
}
.wgcd-colour-swatch:hover,
.wgcd-colour-swatch:focus {
    transform: scale(1.16);
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2271b1, 0 3px 7px rgba(0,0,0,.16);
}
.wgcd-colour-swatch.is-selected {
    transform: scale(1.10);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2271b1, 0 3px 7px rgba(0,0,0,.16);
}
#wgcdTextColor {
    width: 42px;
    height: 34px;
    padding: 2px;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}
@media (max-width: 720px) {
    #wgcdSwatchRow.wgcd-swatch-row,
    .wgcd-swatch-row {
        grid-template-columns: repeat(8, 24px);
        gap: 6px;
    }
    .wgcd-colour-swatch {
        width: 24px;
        height: 24px;
        min-width: 24px;
    }
}


/* Digital cards are personalisation-first.
   This is only a visual fallback for themes that hard-code a Woo cart form.
   Server-side validation still blocks unaccepted designs. */
body.wgcd-digital-product .summary form.cart:not(.wgcd-allow-cart-form) {
    display: none !important;
}
body.wgcd-digital-product .wgcd-product-button {
    display: block !important;
}


/* ============================================================
   ARTMOOP v1.8.0 SAFE RESPONSIVE EDITOR
   Desktop > 1024px: original editor.
   Tablet/phone <= 1024px: one portrait card page, full viewport.
   ============================================================ */

body.wgcd-touch-open {
    overflow: hidden !important;
}

@media screen and (max-width: 1024px) {
    #wgcdModalOverlay.wgcd-modal-overlay.wgcd-active {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        height: 100dvh !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: stretch !important;
        justify-content: stretch !important;
        overflow: hidden !important;
        background: #f5efe5 !important;
    }

    #wgcdModalOverlay > .wgcd-card-editor {
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        max-height: none !important;
        margin: 0 !important;
        border-radius: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    #wgcdModalOverlay .wgcd-editor-header {
        flex: 0 0 auto !important;
        min-height: 46px !important;
        padding: 7px 12px !important;
        box-sizing: border-box !important;
    }

    #wgcdModalOverlay .wgcd-view-tabs {
        flex: 0 0 auto !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 5px 8px !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        box-sizing: border-box !important;
    }

    #wgcdModalOverlay .wgcd-tab-btn {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 42px !important;
        padding: 7px !important;
        font-size: 15px !important;
    }

    /* One scrolling region: card first, its own toolbar immediately below. */
    #wgcdModalOverlay .wgcd-card-stage {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 8px 6px 14px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: center !important;
        gap: 10px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    /* Touch devices show ONE portrait page rather than an 820px spread. */
    #wgcdModalOverlay #wgcdCard.wgcd-greeting-card {
        position: relative !important;
        flex: 0 0 520px !important;
        width: 420px !important;
        min-width: 420px !important;
        max-width: 420px !important;
        height: 520px !important;
        min-height: 520px !important;
        max-height: 520px !important;
        margin: 0 auto var(--wgcd-touch-gap, 0px) !important;
        transform: scale(var(--wgcd-touch-scale, 1)) !important;
        transform-origin: top center !important;
        perspective: none !important;
    }

    /* Inside: keep only the editable right-hand page. */
    #wgcdModalOverlay #wgcdCard .wgcd-card-inside-pages {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 420px !important;
        height: 520px !important;
        overflow: hidden !important;
    }

    #wgcdModalOverlay #wgcdCard .wgcd-card-interior-left,
    #wgcdModalOverlay #wgcdCard .wgcd-spine-line {
        display: none !important;
    }

    #wgcdModalOverlay #wgcdCard #wgcdInsideRight.wgcd-card-interior-right {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 420px !important;
        height: 520px !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* Cover occupies the same portrait page. */
    #wgcdModalOverlay #wgcdCard #wgcdCardCover.wgcd-card-cover {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 420px !important;
        height: 520px !important;
        transform-origin: left center !important;
    }

    /* Add Heading / Add Closing remain attached to the editable page. */
    #wgcdModalOverlay #wgcdCard #wgcdZoneButtons.wgcd-smart-zones {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 420px !important;
        height: 520px !important;
    }

    #wgcdModalOverlay .wgcd-zone {
        min-height: 44px !important;
        max-width: 88% !important;
        padding: 10px 18px !important;
        touch-action: manipulation;
    }

    /*
     * IMPORTANT: this is the EXISTING toolbar and all existing controls.
     * Nothing is cloned, removed or recreated.
     */
    #wgcdModalOverlay #wgcdFloatingToolbar.wgcd-floating-toolbar,
    #wgcdModalOverlay #wgcdFloatingToolbar.wgcd-floating-toolbar.visible,
    #wgcdModalOverlay #wgcdFloatingToolbar.wgcd-toolbar-top,
    #wgcdModalOverlay #wgcdFloatingToolbar.wgcd-toolbar-bottom {
        position: relative !important;
        inset: auto !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        bottom: auto !important;
        transform: none !important;
        flex: 0 0 auto !important;
        width: min(760px, calc(100% - 4px)) !important;
        max-width: 760px !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 auto !important;
        padding: 10px !important;
        flex-wrap: wrap !important;
        align-items: stretch !important;
        justify-content: center !important;
        gap: 8px !important;
        box-sizing: border-box !important;
        z-index: 20 !important;
    }

    #wgcdModalOverlay #wgcdFloatingToolbar.wgcd-floating-toolbar.visible {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    #wgcdModalOverlay #wgcdFloatingToolbar .wgcd-toolbar-section {
        flex: 1 1 130px !important;
        min-width: 0 !important;
        max-width: none !important;
        border-right: 0 !important;
        padding: 4px !important;
        box-sizing: border-box !important;
    }

    #wgcdModalOverlay #wgcdFloatingToolbar .wgcd-font-selector {
        flex-basis: 210px !important;
    }

    #wgcdModalOverlay #wgcdFloatingToolbar .wgcd-colour-swatches {
        flex-basis: 260px !important;
    }

    #wgcdModalOverlay #wgcdFloatingToolbar select {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 44px !important;
        font-size: 16px !important;
    }

    #wgcdModalOverlay #wgcdFloatingToolbar button {
        min-width: 42px !important;
        min-height: 42px !important;
        touch-action: manipulation;
    }

    #wgcdModalOverlay #wgcdSwatchRow.wgcd-swatch-row {
        max-width: 100% !important;
        grid-template-columns: repeat(8, 28px) !important;
        gap: 6px !important;
    }

    /* Footer stays visible but never overlays the card. */
    #wgcdModalOverlay .wgcd-editor-footer {
        position: relative !important;
        flex: 0 0 auto !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 7px 10px calc(7px + env(safe-area-inset-bottom)) !important;
        box-sizing: border-box !important;
        z-index: 30 !important;
    }

    #wgcdModalOverlay #wgcdBtnAcceptDesign {
        min-height: 46px !important;
    }

    #wgcdModalOverlay .wgcd-history-btn {
        min-height: 42px !important;
    }

    #wgcdModalOverlay .wgcd-card-hint {
        display: none !important;
    }
}

@media screen and (max-width: 599px) {
    #wgcdModalOverlay .wgcd-editor-header {
        min-height: 40px !important;
        padding: 5px 8px !important;
    }

    #wgcdModalOverlay .wgcd-editor-title {
        font-size: 15px !important;
    }

    #wgcdModalOverlay .wgcd-view-tabs {
        padding: 4px 5px !important;
    }

    #wgcdModalOverlay .wgcd-card-stage {
        padding: 5px 2px 10px !important;
        gap: 7px !important;
    }

    #wgcdModalOverlay #wgcdFloatingToolbar.wgcd-floating-toolbar.visible {
        width: calc(100% - 4px) !important;
        padding: 7px !important;
        gap: 5px !important;
    }

    #wgcdModalOverlay #wgcdFloatingToolbar .wgcd-toolbar-section {
        flex: 1 1 calc(50% - 5px) !important;
    }

    #wgcdModalOverlay #wgcdFloatingToolbar .wgcd-colour-swatches,
    #wgcdModalOverlay #wgcdFloatingToolbar .wgcd-style-presets {
        flex-basis: 100% !important;
    }

    #wgcdModalOverlay #wgcdSwatchRow.wgcd-swatch-row {
        grid-template-columns: repeat(6, 28px) !important;
    }

    #wgcdModalOverlay .wgcd-editor-footer {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 5px !important;
        padding: 6px 7px calc(6px + env(safe-area-inset-bottom)) !important;
    }

    #wgcdModalOverlay #wgcdBtnAcceptDesign {
        width: 100% !important;
    }

    #wgcdModalOverlay .wgcd-history-controls {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 5px !important;
    }

    #wgcdModalOverlay .wgcd-history-btn {
        width: 100% !important;
    }
}


/* ============================================================
   ARTMOOP v1.8.1 — PORTRAIT VIEWPORT FIX
   Touch editor consumes the full portrait viewport.
   ============================================================ */
@media screen and (max-width: 1024px) {
    html, body.wgcd-touch-open {
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    body #wgcdModalOverlay.wgcd-modal-overlay.wgcd-active {
        position: fixed !important;
        inset: 0 !important;
        width: 100dvw !important;
        height: 100dvh !important;
        min-width: 100dvw !important;
        min-height: 100dvh !important;
        max-width: none !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body #wgcdModalOverlay.wgcd-active > .wgcd-card-editor {
        position: absolute !important;
        inset: 0 !important;
        width: 100dvw !important;
        height: 100dvh !important;
        min-width: 0 !important;
        min-height: 0 !important;
        max-width: none !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        display: grid !important;
        grid-template-rows: auto auto minmax(0, 1fr) auto !important;
        grid-template-columns: minmax(0, 1fr) !important;
        overflow: hidden !important;
    }

    body #wgcdModalOverlay .wgcd-editor-header {
        grid-row: 1 !important;
    }

    body #wgcdModalOverlay .wgcd-view-tabs {
        grid-row: 2 !important;
    }

    /*
     * Critical: remove desktop fixed/landscape sizing from the stage.
     * This row gets every remaining pixel between tabs and footer.
     */
    body #wgcdModalOverlay .wgcd-card-stage {
        grid-row: 3 !important;
        position: relative !important;
        inset: auto !important;
        width: 100% !important;
        height: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        max-width: none !important;
        max-height: none !important;
        flex: none !important;
        margin: 0 !important;
        padding: 6px 4px 14px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
        align-self: stretch !important;
        justify-self: stretch !important;
    }

    body #wgcdModalOverlay .wgcd-editor-footer {
        grid-row: 4 !important;
    }

    /*
     * Keep the logical card 420x520, but JS scales it from the actual
     * full-width portrait stage. This does not alter saved coordinates.
     */
    body #wgcdModalOverlay #wgcdCard.wgcd-greeting-card {
        width: 420px !important;
        height: 520px !important;
        min-width: 420px !important;
        min-height: 520px !important;
        max-width: 420px !important;
        max-height: 520px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        transform-origin: top center !important;
    }
}

@media screen and (max-width: 599px) and (orientation: portrait) {
    body #wgcdModalOverlay .wgcd-card-stage {
        width: 100dvw !important;
        padding-left: 2px !important;
        padding-right: 2px !important;
    }
}
