.wc-engraving-frontend-wrapper {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}
.wc-engraving-field-group {
    margin-bottom: 15px;
}
.wc-engraving-field-group > label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}
.wc-engraving-required-asterisk {
    color: #dc3232;
    margin-left: 3px;
    font-weight: bold;
}
.wc-engraving-field-group.has-error input.engraving-input {
    border-color: #dc3232 !important;
    background-color: #fff8f8 !important;
}
.wc-engraving-field-group.has-error .engraving-graphic-swatches {
    padding: 6px;
    border: 1px solid #dc3232;
    border-radius: 6px;
    background-color: #fff8f8;
}
.wc-engraving-field-group.has-error > label {
    color: #dc3232;
}
.field-error-message {
    display: none;
    color: #dc3232;
    font-size: 12px;
    margin-top: 5px;
    font-weight: 500;
}
.text-input-row {
    display: flex;
    gap: 10px;
}
.engraving-input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ddd;
}
.engraving-font-select {
    width: 150px;
    padding: 8px;
}

.engraving-graphic-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.engraving-swatch {
    width: 50px;
    height: 50px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
    background-color: #fff;
    transition: border-color 0.2s;
}
.engraving-swatch:hover {
    border-color: #999;
}
.engraving-swatch.selected {
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

/* Dostosowanie do The7 (lub ogólnie) */
#wc-engraving-live-preview {
    margin-bottom: 20px;
    overflow: hidden;
    border-radius: 5px;
    background: #fff;
}
/* Blokada scrolla strony gdy modal jest otwarty */
body.wc-modal-open {
    overflow: hidden !important;
}

/* Modal Style */
.wc-engraving-modal {
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}
.wc-engraving-modal-content {
    background-color: #fefefe;
    margin: 0 auto;
    border: 1px solid #888;
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    overflow: hidden;
}
.wc-engraving-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}
.wc-engraving-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.wc-engraving-close:hover,
.wc-engraving-close:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}
.wc-engraving-modal-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: #f9f9f9;
}
.wc-engraving-preview-col {
    flex: 2;
    overflow: hidden;
    padding: 20px;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Obrazek w lewej kolumnie - skaluj do dostępnej przestrzeni */
.wc-engraving-preview-col #wc-engraving-live-preview {
    width: 100%;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wc-engraving-preview-col #wc-engraving-live-preview img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    margin: 0 auto;
}
#engraving-svg-canvas {
    display: block !important;
    max-width: 100% !important;
    max-height: 100% !important;
    touch-action: none;
    -ms-touch-action: none;
}
#engraving-svg-canvas image {
    max-width: none !important;
    max-height: none !important;
}
#engraving-svg-canvas text {
    -webkit-text-size-adjust: none !important;
    text-size-adjust: none !important;
}
.wc-engraving-tools-col {
    flex: 1 1 350px;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border-left: 1px solid #eee;
}
.wc-engraving-tools-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    min-height: 0;
}
.wc-engraving-tools-footer {
    flex: 0 0 auto;
    padding: 16px 20px;
    background: #fff;
    border-top: none;
}
/* Przycisk zatwierdzenia - wszystkie style z !important żeby motyw nie mógł ich nadpisać */
.wc-engraving-btn {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    padding: 12px !important;
    background: #28a745 !important;
    background-color: #28a745 !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: bold !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    text-align: center !important;
    box-sizing: border-box !important;
    line-height: 1.4 !important;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4) !important;
    transition: background 0.2s !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}
.wc-engraving-btn:hover,
.wc-engraving-btn:focus {
    background: #218838 !important;
    background-color: #218838 !important;
    color: #fff !important;
    outline: none !important;
}

/* ================================================
   RESPONSIVE - MOBILE (max-width: 768px)
   ================================================ */
@media (max-width: 768px) {

    /* Modal zajmuje cały ekran */
    .wc-engraving-modal {
        align-items: flex-start;
        padding: 0;
    }
    .wc-engraving-modal-content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        height: 100dvh; /* dynamic viewport height - obsługuje pasek adresu Safari */
        border-radius: 0;
        margin: 0;
        border: none;
    }

    /* Header bardziej zwarty */
    .wc-engraving-modal-header {
        padding: 12px 15px;
        flex-shrink: 0;
    }
    .wc-engraving-modal-header h3 {
        font-size: 16px !important;
    }

    /* Body zmienia kierunek na kolumnowy */
    .wc-engraving-modal-body {
        flex-direction: column;
        overflow: hidden;
    }

    /* Podgląd zdjęcia - miniatura na górze, ograniczona wysokość */
    .wc-engraving-preview-col {
        flex: 0 0 auto;
        height: 35vh;
        max-height: 35vh;
        padding: 10px;
        overflow: hidden;
        background: #f0f0f0;
        border-bottom: 1px solid #ddd;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .wc-engraving-preview-col #wc-engraving-live-preview {
        width: 100%;
        height: 100%;
        max-height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
    }
    .wc-engraving-preview-col #wc-engraving-live-preview img {
        max-height: 100%;
        width: auto;
        max-width: 100%;
        object-fit: contain;
        display: block;
        margin: 0 auto;
    }

    /* SVG canvas na mobile - ograniczamy maksymalną wysokość */
    #engraving-svg-canvas {
        max-height: 100% !important;
    }

    /* Kolumna narzędzi - zajmuje resztę */
    .wc-engraving-tools-col {
        flex: 1 1 0;
        min-height: 0;
        max-width: 100%;
        border-left: none;
    }
    .wc-engraving-tools-scroll {
        padding: 15px;
    }

    /* Większe elementy dotykowe */
    .engraving-input {
        padding: 12px 10px;
        font-size: 16px; /* zapobiega auto-zoom na iOS */
        border-radius: 4px;
    }
    .engraving-font-select {
        padding: 12px 8px;
        font-size: 16px;
        width: auto;
        flex: 1;
        min-width: 0;
        max-width: 140px;
    }
    .text-input-row {
        gap: 8px;
    }

    /* Swatche graficzne - większe na dotyk */
    .engraving-swatch {
        width: 56px;
        height: 56px;
        touch-action: manipulation;
    }
    .engraving-graphic-swatches {
        gap: 8px;
    }

    /* Grupy pól - mniejszy margines */
    .wc-engraving-field-group {
        margin-bottom: 12px;
    }

    /* Stopka z przyciskiem */
    .wc-engraving-tools-footer {
        padding: 8px 15px 12px 15px;
    }
    .wc-engraving-btn {
        padding: 14px !important;
        font-size: 16px !important;
    }
}

/* Bardzo małe ekrany (iPhone SE itp.) */
@media (max-width: 375px) {
    .wc-engraving-preview-col {
        height: 28vh;
        max-height: 28vh;
    }
    .engraving-swatch {
        width: 48px;
        height: 48px;
    }
    .engraving-font-select {
        max-width: 120px;
        font-size: 14px;
    }
}

/* ================================================
   BOX: ZATWIERDZONY PROJEKT
   ================================================ */
.wc-engraving-approved-box {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #f0faf4;
    border: 1px solid #b2dfcc;
    border-radius: 8px;
    max-width: 480px;
    box-sizing: border-box;
}

.wc-engraving-approved-thumb-wrap {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #c8e6c9;
    background: #fff;
}

.wc-engraving-approved-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wc-engraving-approved-info {
    flex: 1;
    min-width: 0;
}

.wc-engraving-approved-label {
    margin: 0 0 2px 0;
    font-size: 14px;
    color: #1a7a3e;
    line-height: 1.3;
}

.wc-engraving-approved-hint {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.wc-engraving-approved-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.wc-engraving-action-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    padding: 6px 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    border-radius: 5px !important;
    border: none !important;
    cursor: pointer !important;
    line-height: 1.4 !important;
    transition: background 0.15s, transform 0.1s !important;
    white-space: nowrap;
}

.wc-engraving-action-btn:active {
    transform: scale(0.97);
}

.wc-engraving-action-btn--edit {
    background: #007cba !important;
    color: #fff !important;
}

.wc-engraving-action-btn--edit:hover {
    background: #005a8e !important;
    color: #fff !important;
}

.wc-engraving-action-btn--delete {
    background: #fff !important;
    color: #dc3232 !important;
    border: 1px solid #dc3232 !important;
}

.wc-engraving-action-btn--delete:hover {
    background: #dc3232 !important;
    color: #fff !important;
}

@media (max-width: 480px) {
    .wc-engraving-approved-box {
        max-width: 100%;
        gap: 12px;
    }
    .wc-engraving-approved-thumb-wrap {
        width: 56px;
        height: 56px;
    }
}

/* ================================================
   TOAST: INFORMACJA O ZABLOKOWANYM PRZYCISKU
   ================================================ */
.wc-engraving-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    z-index: 9999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}
.wc-engraving-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}
.wc-engraving-toast-icon {
    font-size: 20px;
}

/* ================================================
   DRAG HINT – animowana wskazówka przeciągania
   ================================================ */


.wce-hint-ripple {
    position: absolute;
    pointer-events: none;
    z-index: 49;
    width: 52px;
    height: 52px;
    margin-left: -26px;
    margin-top: -26px;
    border-radius: 50%;
    border: 2.5px solid rgba(0, 124, 186, 0.65);
    animation: wceRipplePulse 1.4s ease-out infinite;
}

@keyframes wceRipplePulse {
    0%   { transform: scale(0.55); opacity: 1; }
    100% { transform: scale(2.3); opacity: 0; }
}

/* Tooltip na dole obszaru podglądu */
.wce-hint-tooltip {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    pointer-events: none;
    z-index: 51;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 7px 16px;
    border-radius: 20px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s ease;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

.wce-hint-tooltip--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Frontend Zone Controls */
.frontend-controls .bounding-box {
    pointer-events: none;
}
.draggable-zone, .frontend-controls {
    touch-action: none;
}
.frontend-controls .control-point {
    cursor: pointer;
    pointer-events: all;
    transition: stroke 0.2s, stroke-width 0.2s;
    stroke: transparent;
    stroke-width: 0;
}
.frontend-controls .control-point:hover {
    stroke: rgba(0, 124, 186, 0.4);
    stroke-width: 4px;
}
.frontend-controls .resizer {
    cursor: nwse-resize;
}
.frontend-controls .rotator {
    cursor: crosshair;
}
.engraving-fontsize-slider {
    -webkit-appearance: none;
    height: 6px;
    background: #e1e1e1;
    border-radius: 3px;
    outline: none;
}
.engraving-fontsize-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #007cba;
    cursor: pointer;
}
.engraving-fontsize-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #007cba;
    cursor: pointer;
}

@keyframes highlight-slider {
    0% { background-color: #fff3cd; transform: scale(1.02); }
    50% { background-color: #ffeeba; }
    100% { background-color: transparent; transform: scale(1); }
}
.font-size-slider-row {
    transition: all 0.3s ease;
}
.font-size-slider-row.highlighted {
    animation: highlight-slider 1.5s ease-out;
    border-radius: 4px;
    padding: 5px;
    margin-left: -5px;
    margin-right: -5px;
}
