.memorial-designer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.memorial-designer-container * {
    box-sizing: border-box;
}

.memorial-designer-container .designer-preview {
    display: flex;
    gap: 30px;
    background: #f5f5f5;
    padding: 20px;
    border-radius: 10px;
}

.memorial-designer-container .preview-area {
    flex: 1;
    position: relative;
    min-height: 600px;
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    isolation: isolate;
    z-index: 1;
}

.memorial-designer-container .designer-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    isolation: isolate;
}

.memorial-designer-container .designer-layer img,
.memorial-designer-container .designer-layer .designer-text,
.memorial-designer-container .designer-layer .designer-epitaph {
    pointer-events: auto;
    z-index: 10 !important;
}

.memorial-designer-container .designer-active {
    outline: 3px solid #007cba !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 2px rgba(0,124,186,0.3) !important;
    z-index: 15 !important;
}

.memorial-designer-container .base-image {
    max-width: 100%;
    max-height: 600px;
    object-fit: contain;
}

.memorial-designer-container .designer-controls-panel {
    width: 350px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.memorial-designer-container .designer-menu h3 {
    font-size: 16px;
    margin: 20px 0 10px;
    color: #333;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
    font-weight: bold;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.memorial-designer-container .menu-item {
    padding: 8px 12px !important;
    margin: 6px 0 !important;
    background: #f5f5f5 !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #333 !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
}

.memorial-designer-container .menu-item:hover {
    background: #e8e8e8 !important;
    border-color: #ccc !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
}

.memorial-designer-container .menu-item.active {
    background: #007cba !important;
    color: white !important;
    border-color: #005a87 !important;
    box-shadow: 0 2px 4px rgba(0,124,186,0.3) !important;
}

.memorial-designer-container .designer-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.memorial-designer-container .designer-actions h3 {
    font-size: 16px;
    margin: 0 0 15px;
    color: #333;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.memorial-designer-container .action-btn {
    display: block;
    width: 100%;
    padding: 10px 15px;
    margin-bottom: 10px;
    border: none;
    border-radius: 6px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.memorial-designer-container .action-btn .dashicons {
    margin-right: 10px;
    font-size: 16px;
    vertical-align: middle;
}

.memorial-designer-container .download-btn {
    background: #2e7d32;
    color: white;
}
.memorial-designer-container .download-btn:hover {
    background: #1b5e20;
}

.memorial-designer-container .print-btn {
    background: #1565c0;
    color: white;
}
.memorial-designer-container .print-btn:hover {
    background: #0d47a1;
}

.memorial-designer-container .email-btn {
    background: #e65100;
    color: white;
}
.memorial-designer-container .email-btn:hover {
    background: #bf360c;
}

.memorial-designer-container .cart-btn {
    background: #6a1b9a;
    color: white;
}
.memorial-designer-container .cart-btn:hover {
    background: #4a148c;
}

.clear-all-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.clear-all-btn {
    background: #c62828;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.clear-all-btn:hover {
    background: #b71c1c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.clear-all-btn .dashicons {
    font-size: 18px;
}

/* ===== ПОПАП ВЫБОРА ЭЛЕМЕНТОВ (ОБЩИЕ СТИЛИ) ===== */
.designer-popup {
    display: none;
    position: fixed;
    background: #222;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    z-index: 99;
    width: 380px;
    max-width: 85vw;
    color: white;
    margin: 0;
    will-change: top, left;
}

.designer-popup.show {
    display: block;
}

.designer-popup .popup-header {
    padding: 10px 14px;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.designer-popup .popup-title {
    font-size: 14px;
    font-weight: bold;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.designer-popup .popup-close {
    background: none;
    border: none;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

.designer-popup .popup-close:hover {
    color: white;
}

.designer-popup .popup-content {
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.popup-loading {
    text-align: center;
    padding: 30px;
    color: #ccc;
    font-size: 14px;
}

.designer-popup .designer-item {
    background: #333;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.designer-popup .designer-item:hover {
    border-color: #007cba;
    background: #3a3a3a;
    transform: translateY(-2px);
}

.designer-popup .designer-item img {
    width: 100%;
    height: 70px;
    object-fit: contain;
    margin-bottom: 4px;
    background: #444;
    border-radius: 4px;
}

.designer-popup .designer-item .item-price {
    color: #cccccc !important;
    font-size: 12px;
    font-weight: 500;
    display: block;
    margin-top: 2px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.designer-popup .no-items {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: #999;
}

/* ===== РЕЖИМ ЭПИТАФИИ: ВЕРТИКАЛЬНЫЙ СПИСОК, УМЕНЬШЕННЫЕ КНОПКИ ===== */
.designer-popup.epitaph-mode .popup-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    padding: 8px !important;
    max-height: 380px !important;
}

.designer-popup.epitaph-mode .designer-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    background: #2a2a2a !important;
    border: 1px solid #555 !important;
    border-radius: 6px !important;
    padding: 5px !important;
    margin: 0 !important;
    transition: all 0.2s ease;
}

.designer-popup.epitaph-mode .designer-item img {
    width: 100% !important;
    height: auto !important;
    max-height: 60px !important;
    object-fit: contain !important;
    margin-bottom: 3px !important;
    background: #333;
    border-radius: 4px;
}

.designer-popup.epitaph-mode .designer-item .item-price {
    margin-top: 2px !important;
    font-size: 11px !important;
    font-weight: normal !important;
    color: #cccccc !important;
}

.designer-popup.epitaph-mode .custom-text-item {
    background: #2c3e50 !important;
    border-color: #f39c12 !important;
    padding: 8px !important;
}

.designer-popup.epitaph-mode .custom-text-item .custom-icon {
    font-size: 22px !important;
    margin-bottom: 2px !important;
}

.designer-popup.epitaph-mode .custom-text-item .item-price {
    color: #f39c12 !important;
    font-size: 12px !important;
}

/* ===== ПОПАП ВЫБОРА ШРИФТА ===== */
.font-popup {
    width: 320px !important;
    max-width: 85vw !important;
}

.font-popup .popup-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
}

.font-item {
    background: #333;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.font-item:hover {
    background: #3a3a3a;
    border-color: #007cba;
    transform: translateY(-2px);
}

.font-preview {
    font-size: 20px;
    margin: 0;
    color: white;
    text-align: center;
    padding: 4px;
}

/* ===== МОДАЛЬНОЕ ОКНО EMAIL ===== */
.designer-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.designer-modal.show {
    display: block;
}

.designer-modal .modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 30px;
    border-radius: 10px;
    width: 400px;
    max-width: 90%;
    position: relative;
}

.designer-modal .close-modal {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.designer-modal .close-modal:hover {
    color: #333;
}

.designer-modal h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.designer-modal input[type="email"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.designer-modal input[type="email"]:focus {
    border-color: #007cba;
    outline: none;
}

.designer-modal button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.designer-modal button[type="submit"]:hover {
    background: #45a049;
}

/* ===== ТЕКСТОВЫЕ ЭЛЕМЕНТЫ (БЕЛЫЙ, ПРОЗРАЧНЫЙ ФОН) ===== */
.memorial-designer-container .designer-text,
.memorial-designer-container .designer-epitaph {
    position: absolute;
    cursor: move;
    user-select: none;
    background: transparent !important;
    color: #ffffff !important;
    padding: 4px 8px;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

.memorial-designer-container .designer-text {
    font-size: 24px;
    text-align: center;
    min-width: 80px;
    white-space: nowrap;
    display: inline-block;
}

.memorial-designer-container .designer-text[contenteditable="true"] {
    cursor: text;
    background: transparent !important;
    outline: none;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

.memorial-designer-container .designer-epitaph {
    font-size: 18px;
    text-align: center;
    font-style: italic;
}

.memorial-designer-container .designer-layer img {
    position: absolute;
    cursor: move;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.resize-handles-wrapper {
    position: absolute;
    pointer-events: none;
    z-index: 20 !important;
}

.resize-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background-color: #ffffff;
    border: 2px solid #007cba;
    border-radius: 3px;
    pointer-events: auto;
    cursor: pointer;
    z-index: 20;
    transition: all 0.1s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.resize-handle:hover {
    background-color: #007cba;
    transform: scale(1.2);
}

.resize-handle-nw {
    top: -7px;
    left: -7px;
    cursor: nw-resize;
}

.resize-handle-ne {
    top: -7px;
    right: -7px;
    cursor: ne-resize;
}

.resize-handle-se {
    bottom: -7px;
    right: -7px;
    cursor: se-resize;
}

.resize-handle-sw {
    bottom: -7px;
    left: -7px;
    cursor: sw-resize;
}

.delete-element-btn {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    background: #c62828;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 25 !important;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    line-height: 1;
}

.delete-element-btn:hover {
    background: #b71c1c;
    transform: translateX(-50%) scale(1.1);
}

/* ===== ЗАЩИТА ШАПКИ САЙТА ===== */
header,
.site-header,
.main-header,
#masthead,
.navbar,
.top-bar,
.sticky-header,
.fixed-header,
.header,
#header,
.site-header__wrapper,
.header-wrapper,
.page-header {
    position: relative;
    z-index: 1000 !important;
}
/* Стили для кнопки "Свой вариант" - светло-серые */
.designer-popup.epitaph-mode .custom-text-item {
    background: #2c3e50 !important;
    border-color: #cccccc !important;  /* светло-серая обводка */
    padding: 8px !important;
}

.designer-popup.epitaph-mode .custom-text-item .custom-icon {
    font-size: 22px !important;
    margin-bottom: 2px !important;
    color: #cccccc !important; /* светло-серый значок */
}

.designer-popup.epitaph-mode .custom-text-item .item-price {
    color: #cccccc !important; /* светло-серая цена */
    font-size: 12px !important;
}
/* Многострочные текстовые поля (даты и эпитафия) */
.designer-text.multiline-text {
    white-space: pre-wrap !important;
    word-break: break-word;
    min-width: 120px;
    max-width: 350px;
    width: auto;
    text-align: center;
    line-height: 1.4;
}

/* Чтобы переносы строк корректно отображались и не ломали позиционирование */
.designer-text.multiline-text[contenteditable="true"] {
    white-space: pre-wrap !important;
    word-break: break-word;
}