/* Mobile Frontend Styles - Optimized for Smartphones */

/* Hide Merchant buy now button, express checkout, and quantity on product pages */
/* Includes WooCommerce Payments and Stripe Express Checkout elements */
.single-product .merchant-buy-now-button,
.single-product .merchant-custom-buy-now-button,
.single-product [class*="expresscheckout"],
.single-product .wcpay-payment-request-wrapper,
.single-product .stripe-express-checkout-element,
.single-product #stripe-express-checkout-element,
.single-product .payment-request-button,
.single-product iframe[id*="__privateStripeController"],
.single-product iframe[name*="__privateStripeController"],
.single-product .quantity {
    display: none !important;
}

/* Mobile Warning Button in Toolbox - Second row, full width */
.rwpc-mobile-warnings-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: #ff6b6b;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    /* Now positioned in toolbox, not canvas area */
    width: 100%;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.rwpc-mobile-warnings-button:active {
    background: #e65a5a;
    transform: scale(0.98);
}

.rwpc-mobile-warnings-button .warning-icon {
    font-size: 16px;
}

.rwpc-mobile-warnings-button .warning-count {
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

/* Warnings Popup Overlay for Mobile */
.rwpc-warnings-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.rwpc-warnings-popup-overlay.collapsed {
    display: none;
}

.rwpc-warnings-popup-content {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.rwpc-warnings-popup-content h4 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

.rwpc-warnings-popup-content .rwpc-warnings-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 30px;
    color: #666;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.rwpc-warnings-popup-content .rwpc-warnings-popup-close:active {
    color: #333;
}

.rwpc-warning-template-group {
    margin-bottom: 15px;
}

.rwpc-warning-template-name {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin: 0 0 8px 0;
}

.rwpc-warning-item {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
}

.rwpc-warning-message {
    font-size: 13px;
    color: #333;
    margin-bottom: 8px;
}

.rwpc-warning-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.rwpc-warning-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.rwpc-warning-show {
    background: #0073aa;
    color: #fff;
}

.rwpc-warning-show:active {
    background: #005177;
}

.rwpc-warning-info {
    background: #f0f0f0;
    color: #333;
}

.rwpc-warning-info:active {
    background: #e0e0e0;
}

.rwpc-warning-ignore {
    background: #6c757d;
    color: #fff;
}

.rwpc-warning-ignore:active {
    background: #5a6268;
}

/* Freeze page scrolling when designer is open */
body.rwpc-designer-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Customize Button - Full width mobile */
.rwpc-customize-button-wrapper {
    margin: 15px 0;
}

.rwpc-customize-button.button,
.rwpc-customize-button {
    width: 100% !important;
    padding: 16px 30px !important;
    font-size: 18px !important;
    font-weight: bold !important;
    background: #28a745 !important;
    background-color: #28a745 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: background 0.3s !important;
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3) !important;
    -webkit-tap-highlight-color: transparent !important;
    text-transform: none !important;
    line-height: 1.2 !important;
}

.rwpc-customize-button.button:active,
.rwpc-customize-button:active {
    background: #218838 !important;
    background-color: #218838 !important;
    transform: scale(0.98);
    color: #fff !important;
}

/* Customizer Modal - Full screen on mobile */
.rwpc-customizer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 999999;
}

.rwpc-customizer-modal.active {
    display: flex;
}

.rwpc-customizer-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header - Compact mobile */
.rwpc-customizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 12px;
    background: #333;
    color: #fff;
    flex-shrink: 0;
    min-height: 20px;
}

.rwpc-customizer-title {
    font-size: 12px;
    margin: 0;
    font-weight: 600;
}

.rwpc-close-customizer {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

/* Main Content - Stacked layout for mobile */
.rwpc-customizer-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Toolbar - Fixed height on mobile for compact layout */
.rwpc-customizer-toolbar {
    width: 100%;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    overflow: visible;
    padding: 8px;
    flex-shrink: 0;
    position: relative; /* Enable absolute positioning for children */
    /* Minimum height for 2 rows: row 1 (36px) + gap (8px) + row 2 (36px) + padding (16px) = 96px */
    min-height: 96px;
}

/* Container for side-by-side tool groups */
.rwpc-toolbar-groups-container {
    display: flex;
    gap: 8px;
    margin-bottom: 0; /* Remove bottom margin - problem button spacing handled separately */
    position: relative;
}

.rwpc-tool-group {
    margin-bottom: 8px; /* Consistent spacing - same as horizontal gap */
}

/* Design tools and elements list panel side-by-side on mobile */
.rwpc-design-tools,
.rwpc-elements-list-panel {
    flex: 1;
    margin-bottom: 0;
    min-width: 0; /* Allow flex items to shrink below content size */
}

/* Shorten the header text to fit side by side */
.rwpc-design-tools h3,
.rwpc-elements-list-panel h3 {
    font-size: 12px;
    padding: 8px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Style design tools header like elements list panel - green background */
.rwpc-design-tools > h3,
.rwpc-design-tools.collapsed > h3 {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 6px;
    background: #28a745 !important;
    color: #fff;
    border-radius: 4px;
    -webkit-tap-highlight-color: transparent;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rwpc-design-tools > h3:hover,
.rwpc-design-tools.collapsed > h3:hover {
    background: #218838 !important;
}

.rwpc-design-tools > h3:active,
.rwpc-design-tools.collapsed > h3:active {
    background: #1e7e34 !important;
}

.rwpc-design-tools > h3::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.3s;
    flex-shrink: 0;
    margin-left: 4px;
}

.rwpc-design-tools.collapsed > h3::after {
    transform: rotate(-90deg);
}

.rwpc-tool-group h3 {
    font-size: 13px;
    margin: 0 0 8px 0;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: #f0f0f0;
    border-radius: 4px;
    -webkit-tap-highlight-color: transparent;
}

.rwpc-tool-group h3:hover {
    background: #e8e8e8;
}

.rwpc-tool-group h3::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.3s;
    flex-shrink: 0;
    margin-left: 4px;
}

.rwpc-tool-group.collapsed h3::after {
    transform: rotate(-90deg);
}

.rwpc-tool-group .rwpc-tool-group-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.rwpc-tool-group.collapsed .rwpc-tool-group-content {
    max-height: 0 !important;
}

/* When design tools are expanded, show content as full-screen overlay (like elements list) */
.rwpc-toolbar-groups-container .rwpc-design-tools .rwpc-tool-group-content {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: none;
    padding: 20px;
    overflow-y: auto;
}

.rwpc-toolbar-groups-container .rwpc-design-tools:not(.collapsed) .rwpc-tool-group-content {
    display: block;
}

/* Inner content box for design tools overlay */
.rwpc-toolbar-groups-container .rwpc-design-tools .rwpc-design-tools-inner {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* Close button for design tools overlay */
.rwpc-toolbar-groups-container .rwpc-design-tools .rwpc-tool-group-content::before {
    content: '×';
    position: fixed;
    top: 10px;
    right: 10px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    z-index: 10001;
}

/* Touch-optimized buttons */
.rwpc-tool-button {
    display: block;
    width: 100%;
    padding: 12px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    font-size: 15px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.rwpc-tool-button:active {
    background: #e0e0e0;
    transform: scale(0.98);
}

.rwpc-tool-button.active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* Canvas Area - Optimized for touch */
.rwpc-canvas-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

.rwpc-canvas-wrapper {
    position: relative;
    margin: 10px;
    touch-action: none;
}

.rwpc-canvas-background {
    max-width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.rwpc-canvas {
    position: absolute;
    border: 2px dashed #0073aa;
    overflow: visible;
    touch-action: none;
    opacity: 0; /* Hidden initially, shown after proper positioning */
    transition: opacity 0.2s ease-in;
}

.rwpc-canvas.ready {
    opacity: 1; /* Show after positioning is complete */
}

.rwpc-canvas.boundary-warning {
    border: 3px solid #ff0000;
}

.rwpc-canvas.circle {
    border-radius: 50%;
}

/* Canvas Elements - Larger touch targets */
.rwpc-canvas-element {
    position: absolute;
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    min-width: 30px;
    min-height: 30px;
}

.rwpc-canvas-element.selected {
    outline: 3px solid #0073aa;
    outline-offset: 3px;
}

.rwpc-canvas-element img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.rwpc-canvas-element.text {
    white-space: pre;
    overflow: visible;
    display: inline-block;
    word-wrap: normal;
    line-height: 1.2;
}

/* Overflow handling */
.rwpc-canvas-element::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: transparent;
    transition: background 0.3s;
    z-index: 10;
}

.rwpc-canvas-element.text::after {
    z-index: -1;
}

.rwpc-canvas-element.outside-bounds::after {
    background: rgba(255, 0, 0, 0.4);
}

/* Touch-optimized resize handles - Smaller visible size but larger touch area for mobile */
.rwpc-resize-handle {
    position: absolute;
    width: 72px;  /* Smaller visible size (was 108px) */
    height: 72px;
    background: #fff;
    border: 4px solid #0073aa;
    border-radius: 50%;
    z-index: 20;
    -webkit-tap-highlight-color: transparent;
}

/* Add larger touch detection area using ::after pseudo-element */
.rwpc-resize-handle::after {
    content: '';
    position: absolute;
    top: -20%;  /* Extend touch area by 10% on each side (total 20% larger) */
    left: -20%;
    right: -20%;
    bottom: -20%;
    border-radius: 50%;
}

.rwpc-resize-handle.nw { top: -36px; left: -36px; }
.rwpc-resize-handle.ne { top: -36px; right: -36px; }
.rwpc-resize-handle.sw { bottom: -36px; left: -36px; }
.rwpc-resize-handle.se { bottom: -36px; right: -36px; }

/* Rotation handle - 2x Larger for touch (132px) */
.rwpc-rotate-handle {
    position: absolute;
    top: -164px;
    left: 50%;
    transform: translateX(-50%);
    width: 132px;
    height: 132px;
    background: #fff;
    border: 4px solid #0073aa;
    border-radius: 50%;
    z-index: 20;
    -webkit-tap-highlight-color: transparent;
}

.rwpc-rotate-handle::before {
    content: '↻';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 84px;
    color: #0073aa;
    font-weight: bold;
}

/* Delete handle - Mobile optimized for touch - positioned below element center - 2x larger (132px) */
.rwpc-delete-handle {
    position: absolute;
    bottom: -164px;
    left: 50%;
    transform: translateX(-50%);
    width: 132px;
    height: 132px;
    background: #dc3545;
    border: 4px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s;
}

.rwpc-delete-handle:active {
    background: #c82333;
    transform: translateX(-50%) scale(0.95);
}

.rwpc-delete-handle::before {
    content: '🗑️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 72px;
}

/* Template Navigation - Mobile optimized */
.rwpc-template-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 12px;
    background: #f5f5f5;
    border-top: 1px solid #ddd;
    gap: 10px;
    flex-wrap: wrap;
}

.rwpc-template-nav-group {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.rwpc-template-nav-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.rwpc-template-nav-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: center;
}

.rwpc-template-title {
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

.rwpc-template-page-info {
    font-size: 12px;
    color: #666;
}

/* Touch-optimized navigation buttons */
.rwpc-prev-template,
.rwpc-next-template {
    padding: 10px 16px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    min-height: 44px;
    min-width: 44px;
    -webkit-tap-highlight-color: transparent;
}

.rwpc-prev-template:active,
.rwpc-next-template:active {
    background: #4da6ff;
    transform: scale(0.96);
}

.rwpc-prev-template:disabled,
.rwpc-next-template:disabled {
    visibility: hidden;
}

/* Action buttons - Mobile optimized */
/* On mobile, use simpler quantity controls without wrapper since +/- buttons are hidden */
.rwpc-quantity-controls {
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: none;
    padding: 0;
    min-height: 44px;
}

.rwpc-quantity-btn {
    width: 36px;
    height: 36px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 4px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.rwpc-quantity-btn:active {
    background: #e0e0e0;
    transform: scale(0.95);
}

.rwpc-quantity-btn:disabled {
    background: #f8f8f8;
    color: #ccc;
    cursor: not-allowed;
}

/* Hide +/- buttons on mobile, show native spinner instead */
.rwpc-quantity-btn.rwpc-quantity-plus,
.rwpc-quantity-btn.rwpc-quantity-minus {
    display: none;
}

.rwpc-order-quantity {
    width: 60px;
    padding: 8px 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    text-align: center;
    background: #fff;
    min-height: 40px;
    /* Show native spinner arrows on mobile */
    -moz-appearance: auto;
    -webkit-appearance: auto;
    appearance: auto;
}

/* Show native spinner arrows */
.rwpc-order-quantity::-webkit-outer-spin-button,
.rwpc-order-quantity::-webkit-inner-spin-button {
    -webkit-appearance: auto;
    appearance: auto;
    opacity: 1;
    height: auto;
}

.rwpc-save-button,
.rwpc-cancel-button,
.rwpc-finish-design-button {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    min-height: 44px;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.rwpc-save-button {
    background: #28a745;
    color: #fff;
}

.rwpc-save-button:active {
    background: #218838;
    transform: scale(0.96);
}

.rwpc-save-button:disabled {
    background: #ccc;
    color: #666;
}

.rwpc-cancel-button {
    background: #6c757d;
    color: #fff;
}

.rwpc-cancel-button:active {
    background: #5a6268;
    transform: scale(0.96);
}

.rwpc-finish-design-button {
    background: #28a745;
    color: #fff;
}

.rwpc-finish-design-button:active:not(.disabled) {
    background: #218838;
    transform: scale(0.96);
}

.rwpc-finish-design-button.disabled {
    background: #ccc;
    color: #666;
}

.rwpc-reset-design-button {
    padding: 10px 16px;
    background: #ff6b6b;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    display: none; /* Hidden on mobile */
}

.rwpc-reset-design-button:active {
    background: #b30000;
    transform: scale(0.96);
}

/* Fee Summary - Mobile compact - Hidden by default, shown in popup */
.rwpc-fee-summary {
    padding: 8px 10px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 100%;
    margin-bottom: 8px;
    display: none; /* Hidden on mobile, shown in desktop sidebar */
}

/* Mobile price info button - shown left of quantity */
.rwpc-mobile-price-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.rwpc-mobile-price-info:active {
    background: #e8e8e8;
}

.rwpc-mobile-price-info .rwpc-info-icon {
    width: 22px;
    height: 22px;
    background: #0073aa;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
}

.rwpc-mobile-price-info .rwpc-price-total {
    color: #0073aa;
    font-weight: bold;
}

/* Price popup overlay */
.rwpc-price-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.rwpc-price-popup-overlay.collapsed {
    display: none;
}

.rwpc-price-popup-content {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 400px;
    width: 100%;
    position: relative;
}

.rwpc-price-popup-content h4 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

.rwpc-price-popup-content .rwpc-price-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 30px;
    color: #666;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.rwpc-price-popup-content .rwpc-price-popup-close:active {
    color: #333;
}

.rwpc-price-popup-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rwpc-price-popup-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #666;
    padding: 8px 0;
}

.rwpc-price-popup-item.subtotal {
    padding-top: 12px;
    border-top: 2px solid #ddd;
    margin-top: 8px;
}

.rwpc-price-popup-item.total {
    font-weight: bold;
    font-size: 16px;
    color: #333;
    padding-top: 12px;
    border-top: 2px solid #ddd;
    margin-top: 8px;
}

.rwpc-price-popup-item.cost-per-item {
    font-size: 14px;
    color: #666;
    padding-top: 8px;
}

.rwpc-price-popup-label {
    flex: 1;
}

.rwpc-price-popup-value {
    font-weight: bold;
    color: #0073aa;
}


.rwpc-fee-summary h4 {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: #333;
    font-weight: 600;
}

.rwpc-fee-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rwpc-fee-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
}

.rwpc-fee-item.subtotal {
    padding-top: 4px;
    border-top: 1px solid #ddd;
    margin-top: 2px;
}

.rwpc-fee-item.total {
    font-weight: bold;
    font-size: 13px;
    color: #333;
    padding-top: 4px;
    border-top: 1px solid #ddd;
    margin-top: 2px;
}

.rwpc-fee-label {
    flex: 1;
}

.rwpc-fee-value {
    font-weight: bold;
    color: #0073aa;
}

/* Zoom controls - Mobile positioned at bottom left, 1/4 smaller */
.rwpc-zoom-controls {
    position: absolute !important;
    bottom: 15px !important;
    left: 15px !important;
    transform: none !important;
    background: rgba(51, 51, 51, 0.9) !important;
    padding: 7px 11px !important;
    border-radius: 19px !important;
    z-index: 100 !important;
    display: flex !important;
    align-items: center !important;
    gap: 9px !important;
}

.rwpc-zoom-controls button {
    background: transparent !important;
    border: 2px solid #fff !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: bold !important;
    width: 30px !important;
    height: 30px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    -webkit-tap-highlight-color: transparent !important;
}

.rwpc-zoom-controls button:active {
    background: rgba(255, 255, 255, 0.2) !important;
}

.rwpc-zoom-controls .rwpc-zoom-level {
    color: #fff !important;
    font-size: 12px !important;
    font-weight: bold !important;
    min-width: 38px !important;
    text-align: center !important;
}

/* Property Panel - Mobile optimized - shown as clickable button in canvas area */
/* Property panel button appears at top of canvas area when an element is selected */
.rwpc-property-panel {
    position: absolute; /* Positioned at top of canvas area */
    width: auto;
    min-width: 200px;
    z-index: 500; /* Above canvas content but below overlays */
    display: none;
    margin: 0;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.rwpc-property-panel.active {
    display: block;
}

/* Property panel header - matches design-tools h3 styling */
.rwpc-property-panel > h3 {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #28a745 !important;
    color: #fff;
    border-radius: 6px;
    -webkit-tap-highlight-color: transparent;
    font-size: 13px;
    margin: 0;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rwpc-property-panel > h3:hover {
    background: #218838 !important;
}

.rwpc-property-panel > h3:active {
    background: #1e7e34 !important;
}

.rwpc-property-panel > h3::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.3s;
    flex-shrink: 0;
    margin-left: 8px;
}

.rwpc-property-panel.collapsed > h3::after {
    transform: rotate(-90deg);
}

/* Property panel content - shown as overlay when expanded */
.rwpc-property-panel .rwpc-properties-content {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: none;
    padding: 20px;
    overflow-y: auto;
}

.rwpc-property-panel:not(.collapsed) .rwpc-properties-content {
    display: block;
}

/* Inner content box for property panel overlay */
.rwpc-property-panel .rwpc-properties-content > form,
.rwpc-property-panel .rwpc-properties-content > div {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* Close button for property panel overlay */
.rwpc-property-panel .rwpc-properties-content::before {
    content: '×';
    position: fixed;
    top: 10px;
    right: 10px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    z-index: 10001;
}

.rwpc-property-panel .rwpc-close-properties {
    display: none; /* Hide inline close button when using overlay */
}

.rwpc-property-panel label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    font-size: 13px;
}

.rwpc-property-panel input,
.rwpc-property-panel select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    min-height: 44px;
}

.rwpc-property-panel button {
    width: 100%;
    padding: 12px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.rwpc-property-panel button:active {
    background: #c0392b;
    transform: scale(0.98);
}

/* Elements List - Touch optimized */
/* Elements list - Touch optimized - Initially collapsed on mobile */
.rwpc-elements-list-panel {
    margin-bottom: 0; /* Spacing is controlled by toolbar container */
}

/* Make elements panel header clickable and show it as a bar */
.rwpc-elements-list-panel > h3 {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 6px;
    background: #0073aa;
    color: #fff;
    border-radius: 4px;
    -webkit-tap-highlight-color: transparent;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rwpc-elements-list-panel > h3:hover {
    background: #005a87;
}

.rwpc-elements-list-panel > h3::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.3s;
    flex-shrink: 0;
    margin-left: 4px;
}

.rwpc-elements-list-panel.collapsed > h3::after {
    transform: rotate(-90deg);
}

/* Elements list content - shown as overlay when expanded */
.rwpc-elements-list-panel .rwpc-tool-group-content {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: none;
    padding: 20px;
    overflow-y: auto;
}

.rwpc-elements-list-panel:not(.collapsed) .rwpc-tool-group-content {
    display: block;
}

/* Inner content box for elements list overlay */
.rwpc-elements-list-panel .rwpc-tool-group-content .rwpc-elements-list {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* Close button for overlay */
.rwpc-elements-list-panel .rwpc-tool-group-content::before {
    content: '×';
    position: fixed;
    top: 10px;
    right: 10px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    z-index: 10001;
}

.rwpc-elements-list {
    max-height: 200px;
    overflow-y: auto;
}

.rwpc-element-list-item {
    padding: 10px;
    margin-bottom: 6px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.rwpc-element-list-item:active {
    background-color: #e8e8e8 !important;
}

.rwpc-drag-handle {
    cursor: move;
    color: #666;
    font-size: 20px;
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
    min-width: 30px;
}

.rwpc-element-label {
    flex: 1;
    user-select: none;
    -webkit-user-select: none;
}

/* Element control buttons - Larger for touch */
.rwpc-element-reorder-buttons {
    display: flex;
    gap: 6px;
}

.rwpc-element-move-up,
.rwpc-element-move-down,
.rwpc-element-delete {
    background: #e0e0e0;
    color: #666;
    border: none;
    border-radius: 6px;
    padding: 8px;
    font-size: 14px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.rwpc-element-move-up:active,
.rwpc-element-move-down:active,
.rwpc-element-delete:active {
    background: #d0d0d0;
    transform: scale(0.95);
}

/* Boundary Warning - Mobile */
.rwpc-boundary-warning-message {
    position: absolute !important;
    top: 10px !important;
    left: 10% !important;
    right: 10% !important;
    width: 80% !important;
    transform: none !important;
    background: #ff9800 !important;
    color: #000000 !important;
    padding: 10px 20px !important;
    border-radius: 6px !important;
    z-index: 1100 !important; /* Above property panel (z-index 1000) but below full-screen overlays */
    font-size: 14px !important;
    white-space: normal !important;
    font-weight: bold !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    word-wrap: break-word !important;
    text-align: center !important;
}

/* Loading Overlay */
.rwpc-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rwpc-loading-box {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 80%;
}

.rwpc-loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e0e0e0;
    border-top: 5px solid #333;
    border-radius: 50%;
    animation: rwpc-spin 1s linear infinite;
}

@keyframes rwpc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.rwpc-loading-message {
    margin-top: 20px;
    color: #333;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
}

/* Cart Popup */
.rwpc-cart-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rwpc-cart-popup-box {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 80%;
}

.rwpc-cart-icon {
    margin-bottom: 20px;
    animation: rwpc-cart-bounce 0.6s ease-in-out;
}

@keyframes rwpc-cart-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.rwpc-cart-message {
    color: #333;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
}

/* Notification Popup */
.rwpc-notification-popup {
    min-width: 250px;
    max-width: 90%;
}

/* Library Browser - Mobile grid */
.rwpc-library-browser {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
}

.rwpc-library-item {
    border: 2px solid #ddd;
    padding: 4px;
    border-radius: 6px;
    min-height: 70px;
    -webkit-tap-highlight-color: transparent;
}

.rwpc-library-item:active {
    border-color: #0073aa;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transform: scale(0.98);
}

.rwpc-library-item img {
    width: 100%;
    height: auto;
}

/* Hide desktop-only elements on mobile */
.rwpc-cost-sidebar {
    display: none;
}

/* Sortable placeholder */
.rwpc-sortable-placeholder {
    background: #e0e0e0 !important;
    border: 2px dashed #999 !important;
    visibility: visible !important;
    height: 44px !important;
    margin-bottom: 6px !important;
}

/* Tutorial - Mobile optimized */
.rwpc-tutorial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.rwpc-tutorial-overlay.active {
    display: flex;
}

.rwpc-tutorial-content {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    max-width: 90%;
    text-align: center;
}

.rwpc-tutorial-content h2 {
    margin: 0 0 15px 0;
    font-size: 18px;
}

.rwpc-tutorial-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    gap: 10px;
}

.rwpc-tutorial-nav button {
    padding: 10px 20px;
    min-height: 44px;
    border-radius: 6px;
    -webkit-tap-highlight-color: transparent;
}

/* Cart edit buttons */
.rwpc-edit-design-wrapper {
    text-align: center;
    margin-top: 10px;
}

.rwpc-mini-cart-edit-wrapper {
    text-align: center;
    margin-top: 8px;
    clear: both;
    display: block;
}

.rwpc-edit-cart-design,
.woocommerce-mini-cart .rwpc-mini-cart-edit-btn {
    display: inline-block !important;
    padding: 10px 16px !important;
    min-height: 44px !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Improve scrolling on iOS */
.rwpc-customizer-toolbar,
.rwpc-elements-list,
.rwpc-library-browser {
    -webkit-overflow-scrolling: touch;
}

/* Prevent text selection during drag */
.rwpc-canvas-element.dragging,
.rwpc-canvas-element.resizing {
    user-select: none;
    -webkit-user-select: none;
}

/* Hide quantity controls for Einrichtungspauschale (setup fee product) in mini cart and cart */
.woocommerce-mini-cart .mini_cart_item[data-product_slug="rwpc-einrichtungspauschale"] .quantity,
.woocommerce-mini-cart .mini_cart_item[data-product_slug="rwpc-einrichtungspauschale"] input.qty,
.woocommerce-mini-cart .mini_cart_item[data-product_slug="rwpc-einrichtungspauschale"] .merchant-quantity-input,
.woocommerce-mini-cart .mini_cart_item[data-product_slug="rwpc-einrichtungspauschale"] .merchant-quantity-minus,
.woocommerce-mini-cart .mini_cart_item[data-product_slug="rwpc-einrichtungspauschale"] .merchant-quantity-plus,
.woocommerce-mini-cart .mini_cart_item[data-product_slug="rwpc-einrichtungspauschale"] .js-update-quantity,
.woocommerce-mini-cart .mini_cart_item[data-product_slug="rwpc-einrichtungspauschale"] .js-merchant-quantity-btn,
.woocommerce-cart .rwpc-setup-fee-item .quantity,
.woocommerce-cart .rwpc-setup-fee-item input.qty,
.woocommerce-cart .rwpc-setup-fee-item .merchant-quantity-input,
.woocommerce-cart .rwpc-setup-fee-item .merchant-quantity-minus,
.woocommerce-cart .rwpc-setup-fee-item .merchant-quantity-plus {
    display: none !important;
}

/* Show design count for setup fee items */
.rwpc-setup-fee-design-count {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}
