.csd-wrapper {
    margin: 0px auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    position: relative;
    max-width: 1400px;
}

/* Canvas Controls */
.csd-canvas-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
}

.csd-zoom-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.csd-canvas-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #495057;
    font-size: 14px;
    transition: all 0.2s ease;
    padding: 0;
}

.csd-canvas-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
    transform: translateY(-1px);
}

.csd-canvas-btn:active {
    transform: translateY(0);
    background: #dee2e6;
}

.csd-zoom-display {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    min-width: 40px;
    text-align: center;
    padding: 0 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Canvas Container Positioning */
.csd-canvas-container {
    position: relative;
}

/* Debug Panel Styles */
.csd-debug-separator {
    margin: 15px 0 10px 0 !important;
    border-top: 2px solid #4ecdc4;
    padding-top: 10px !important;
}

.csd-debug-separator .csd-debug-label {
    color: #4ecdc4 !important;
    font-size: 14px !important;
}

/* Quantity Row Container */
.csd-quantity-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 5px;
}

/* Quantity Controls */
.csd-quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.csd-quantity-btn {
    background: #4ecdc4;
    color: white;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.csd-quantity-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.csd-quantity-btn:active {
    transform: translateY(0);
    background: #004c70;
}

.csd-quantity-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

#csd-quantity {
    font-size: 16px;
    font-weight: bold;
}

/* Quantity Pricing Section */
.csd-quantity-pricing {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex: 1;
}

.csd-quantity-info {
    font-size: 14px;
    color: #495057;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.csd-per-piece-price {
    font-size: 13px;
    font-weight: bold;
    color: #4ecdc4;
    margin: 0;
    white-space: nowrap;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#csd-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.csd-loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

.csd-controls {
    margin-bottom: 20px;
}

/* Stili per le sezioni */
.csd-section {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e1e1e1;
    margin-bottom: 10px;

}

.csd-section-header {
    background: linear-gradient(135deg,rgb(216, 216, 216) 0%,rgb(206, 206, 206) 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 7px 7px 0 0;
    margin: 0;
}

.csd-section-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
   
.csd-section-content {
    padding: 10px;
}

.csd-section:last-child {
    margin-bottom: 0;
}

/* File Upload Button Styles */
.csd-file-upload-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.csd-file-upload-button {
    display: flex;
    /* flex-direction: column; */
    align-items: center;
    justify-content: center;
    padding: 10px 10px;
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
    /* min-width: 280px; */
    /* min-height: 80px; */
    width: 100%;
}

.csd-file-upload-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
    background: linear-gradient(135deg, #5dd4cd 0%, #4fb3a4 100%);
}

.csd-file-upload-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(78, 205, 196, 0.3);
}

.csd-file-upload-button i {
    font-size: 28px;
    color: white;
    margin-bottom: 8px;
}

.csd-file-upload-button .upload-main-text {
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    text-align: center;
}

.csd-file-upload-button .upload-sub-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 400;
    text-align: center;
    line-height: 1.3;
    max-width: 250px;
}

/* File Upload Button - Stato con file selezionato */
.csd-file-upload-button.file-selected {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.csd-file-upload-button.file-selected:hover {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

.csd-file-upload-button.file-selected i {
    color: #fff;
}

/* File Upload Button - Stato "Nuovo file" */
.csd-file-upload-button.new-file-button {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
    cursor: pointer;
}

.csd-file-upload-button.new-file-button:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
    transform: translateY(-2px);
}

.csd-file-upload-button.new-file-button i {
    color: #fff;
}

/* File Preview rimosso - non necessario */

#csd-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #495057;
}

#csd-file-info .file-icon {
    font-size: 20px;
    color: #28a745;
}

#csd-file-info .file-details {
    flex: 1;
}

#csd-file-info .file-name {
    font-weight: 600;
    color: #343a40;
    margin-bottom: 2px;
}

#csd-file-info .file-size {
    font-size: 12px;
    color: #6c757d;
}

/* Drag and Drop Enhancement */
.csd-file-upload-button.drag-over {
    background: linear-gradient(135deg, #5dade2 0%, #3498db 100%);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    transform: scale(1.02);
}


.csd-control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.csd-control-group select,
.csd-control-group textarea,
.csd-control-group input[type="number"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 0;
}

.csd-control-group textarea {
    min-height: 50px;
    resize: vertical;
}

.csd-control-row {
    display: flex;
    gap: 15px;

}

.csd-control-item {
    flex: 1;
}

.csd-line-height input,
.csd-letter-spacing input {
    width: 100%;
}

.csd-align-buttons {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.csd-align-btn {
    font-size: 20px;
    cursor: pointer;
    color: #555;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s;
}

.csd-align-btn:hover {
    background-color: #f0f0f0;
}

.csd-align-btn.active {
    color: #4ecdc4;
    border-color: #4ecdc4;
    background-color: rgba(0, 115, 170, 0.1);
}

.csd-range-info {
    font-size: 12px;
    color: #666;
    margin-left: 10px;
}

/* Stili per tipi di stencil */
/* Stili per il grid delle icone dei tipi di stencil */
.csd-icon-grid {
    display: flex;
    flex-direction: row;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.csd-stencil-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    text-align: center;
    position: relative;
    height: 140px;
    justify-content: center;
    width: 150px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.csd-stencil-type-card:hover {
    border-color: #4ecdc4;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.15);
    transform: translateY(-2px);
}

.csd-stencil-type-card.selected {
    border-color: #4ecdc4;
    background: #f0f8ff;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.2);
}

.csd-type-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.csd-stencil-type-card.selected .csd-type-icon {
    background: #4ecdc4;
    color: #fff;
}

.csd-type-icon img {
    max-width: 50px;
    max-height: 50px;
    object-fit: contain;
}

.csd-type-icon i {
    font-size: 32px;
    color: #666;
}

.csd-stencil-type-card.selected .csd-type-icon i {
    color: #fff;
}

.csd-type-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
}

.csd-stencil-type-card.selected .csd-type-label {
    color: #4ecdc4;
    font-weight: 600;
}

/* Fallback per stili legacy */
.csd-stencil-types {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.csd-radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    transition: all 0.3s;
    flex: 1;
    min-width: 120px;
}

.csd-radio-label:hover {
    border-color: #4ecdc4;
    background-color: #f9f9f9;
}

.csd-radio-label input[type="radio"] {
    margin-right: 8px;
    width: auto;
}

.csd-radio-label input[type="radio"]:checked {
    accent-color: #4ecdc4;
}

.csd-radio-label input[type="radio"]:checked + span {
    font-weight: bold;
    color: #4ecdc4;
}

.csd-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.csd-actions button {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #4ecdc4;
    color: white;
    transition: all 0.3s;
    font-size: 16px;
    font-weight: bold;
}

.csd-actions button:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.csd-actions button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#csd-konva-container, #csd-gallery-container {
    width: 100%;
    border-radius: 4px;
}

#csd-gallery-container {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

#csd-gallery-main-image {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
}

/* Gallery thumbnails - OTTIMIZZATA PER ANDARE A CAPO */
.csd-gallery-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    padding: 10px 0;
    justify-content: flex-start;
}

.csd-thumb {
    flex: 0 0 calc(20% - 8px);
    min-width: 80px;
    max-width: 80px;
    height: 80px;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
}

.csd-thumb:hover {
    border-color: #4ecdc4;
    transform: scale(1.05);
}

.csd-thumb.active {
    border-color: #4ecdc4;
    box-shadow: 0 0 10px rgba(0, 115, 170, 0.5);
}

.csd-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.csd-canvas-thumb {
    flex-direction: column;
    font-size: 11px;
    color: #555;
    /* text-align: center; */
    padding: 5px;
}

.csd-canvas-thumb i {
    font-size: 24px;
    margin-bottom: 5px;
}

.csd-canvas-container {
    position: relative;
}

.csd-dimensions-info {
    text-align: center;
    padding: 15px 0;
    font-size: 16px;
    color: #333;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin-top: 10px;
}

.csd-dimensions-info .file-dimensions {
    color: #ff6b6b;
}

.csd-dimensions-info .total-dimensions {
    color: #4ecdc4;
}

.csd-ruler-legend {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

.file-ruler-indicator {
    color: #ff6b6b;
    font-weight: bold;
    border-bottom: 2px dashed #ff6b6b;
    padding-bottom: 2px;
}

.total-ruler-indicator {
    color: #4ecdc4;
    font-weight: bold;
    border-bottom: 2px solid #4ecdc4;
    padding-bottom: 2px;
}

.csd-info {
    margin-top: 10px;
    text-align: center;
    position: relative;
}

.csd-info span {
    font-weight: bold;
}

.csd-info-lungo {
    margin-top: 10px;
    padding-right: 10px;
    padding-left: 10px;
    text-align: center;
    color: #fff;
    background-color: #4ecdc4;
    padding: 15px 0;
    font-weight: bold;
    font-size: 25px;
    border-radius: 8px;
}

.csd-estimated-cost {
    position: absolute;
    top: 0px;
    right: 0px;
    background-color: #4ecdc4;
    padding: 10px 20px;
    border-radius: 0 0 0 24px;
    font-weight: bold;
    font-size: 22px;
    color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.csd-estimated-cost small,
.csd-estimated-cost-lungo small {
    font-size: 14px;
    margin-left: 5px;
}

.csd-icons {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 998;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
}

.csd-icon {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #495057;
    transition: all 0.2s ease;
    font-size: 14px;
}

.csd-icon:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #343a40;
}

/* Stati attivo/inattivo per le quote */
.csd-icon.quotes-on,
.csd-canvas-btn.quotes-on {
    background: #007bff;
    border-color: #0056b3;
    color: white;
}

.csd-icon.quotes-off,
.csd-canvas-btn.quotes-off {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
}

.csd-icon.quotes-on:hover,
.csd-canvas-btn.quotes-on:hover {
    background: #0056b3;
    border-color: #004085;
}

.csd-icon.quotes-off:hover,
.csd-canvas-btn.quotes-off:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* Demo Warning Message */
.csd-demo-warning {
    margin: 15px 0;
    padding: 15px 20px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    display: none; /* Nascosto per default */
    align-items: flex-start;
    gap: 12px;
}

/* Mostra il messaggio demo quando è attivo */
.csd-demo-warning.show-demo-message {
    display: flex;
}

.csd-demo-warning i.fas {
    color: #856404;
    font-size: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.csd-demo-warning p {
    margin: 0;
    color: #856404;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 400;
}

.csd-demo-warning strong {
    font-weight: 600;
    color: #664d03;
}

.csd-promo-text {
    text-align: center;
    padding: 15px 10px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #fff3cd;
    border-radius: 8px;
    margin: 15px 0;
}

/* Desktop: side by side layout for dimensions sections */
@media (min-width: 769px) {
    .csd-dimensions-desktop-row {
        display: flex;
        gap: 20px;
        align-items: flex-start;
    }
    
    .csd-dimensions-section {
        flex: 1;
    }
}

/* Stili per il riepilogo dimensioni */
.csd-total-dimensions-display {
    text-align: center;
    /* padding: 10px; */
    /* background: #f8f9fa; */
    /* border: 1px solid #e9ecef; */
    /* border-radius: 4px; */
    font-size: 14px;
    color: #495057;
}

#csd-total-width, #csd-total-height {
    font-weight: bold;
    color: #4ecdc4;
}

/* Debug pricing section - only visible to admins */
.csd-debug-pricing {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border: 2px solid #c23616;
    margin-top: 15px;
}

.csd-section.csd-debug-pricing {
    position: fixed;
    top: 89px;
    right: 10px;
    width: 250px;
    z-index: 9999;
}

.csd-debug-pricing .csd-section-header {
    background: rgba(0, 0, 0, 0.2);
    color: white;
    padding: 4px 8px;
    /* margin: -15px -15px 15px -15px; */
    border-radius: 8px 8px 0 0;
}

.csd-debug-pricing .csd-section-header h4 {
    color: white;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.csd-debug-info {
    background: rgba(255, 255, 255, 0.95);
    padding: 4px 8px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.2;
}

.csd-debug-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    border-bottom: 1px dotted #ddd;
}

.csd-debug-row:last-child {
    border-bottom: none;
}

.csd-debug-label {
    font-weight: bold;
    color: #333;
}

.csd-debug-value {
    color: #4ecdc4;
    font-weight: normal;
}

.csd-debug-calculation {
    background: #f0f8ff;
    padding: 8px;
    border-radius: 4px;
    margin: 8px 0;
    border: 1px solid #b3d9ff;
}

.csd-debug-total {
    background: #e8f5e8;
    padding: 8px;
    border-radius: 4px;
    border: 2px solid #28a745;
    font-size: 14px;
    font-weight: bold;
}

.csd-debug-total .csd-debug-label,
.csd-debug-total .csd-debug-value {
    font-weight: bold;
    color: #155724;
}

/* OTTIMIZZAZIONI MOBILE */
@media (max-width: 768px) {
    .csd-wrapper {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 10px;
    }

    .csd-canvas-container {
        order: 1;
    }

    .csd-control-group {
        order: 2;
    }

    .csd-controls {
        padding: 15px;
    }

    #csd-konva-container {
        height: auto !important;
        aspect-ratio: 1 / 1;
    }

    .csd-control-row {
        flex-direction: column;
        gap: 10px;
    }

    .csd-control-item {
        width: 100%;
    }

    .csd-align-buttons {
        justify-content: center;
    }

    .csd-align-btn {
        flex: 1;
        text-align: center;
        padding: 12px;
        font-size: 18px;
    }
    
    /* Responsive per grid icone - 2 colonne su mobile */
    .csd-icon-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        justify-items: center;
    }
    
    .csd-stencil-type-card {
        padding: 15px 10px;
        height: 110px;
        justify-content: center;
        width: 100%;
        max-width: 140px;
        flex-shrink: 0;
        box-sizing: border-box;
    }
    
    .csd-type-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 8px;
    }
    
    .csd-type-icon img {
        max-width: 42px;
        max-height: 42px;
    }
    
    .csd-type-icon i {
        font-size: 28px;
    }
    
    .csd-type-label {
        font-size: 12px;
    }

    /* Fallback legacy */
    .csd-stencil-types {
        flex-direction: column;
    }

    .csd-radio-label {
        width: 100%;
        padding: 15px;
    }

    /* Ottimizzazioni gallery per mobile */
    .csd-gallery-thumbnails {
        justify-content: center;
    }

    .csd-thumb {
        flex: 0 0 calc(33.333% - 7px);
        height: 70px;
    }

    .csd-canvas-thumb {
        font-size: 10px;
    }

    .csd-canvas-thumb i {
        font-size: 20px;
    }

    /* Dimensioni info mobile */
    .csd-dimensions-info {
        font-size: 14px;
        padding: 10px;
    }
    
    .csd-ruler-legend {
        font-size: 12px;
        margin-top: 8px;
    }

    /* Prezzi mobile */
    .csd-estimated-cost {
        position: absolute;
        top: 0;
        right: 0;
        display: inline-block;
        font-size: 20px;
    }

    .csd-info-lungo {
        font-size: 22px;
        padding: 12px 0;
    }

    /* Pulsanti mobile */
    .csd-actions button {
        padding: 12px 15px;
        font-size: 15px;
    }

    /* Icone mobile */
    .csd-icons {
        top: 5px;
        left: 5px;
    }

    .csd-icon {
        font-size: 20px;
        padding: 6px;
    }

    /* Promo text mobile */
    .csd-promo-text {
        font-size: 13px;
        padding: 12px 8px;
    }

    /* Input e textarea mobile */
    .csd-control-group input,
    .csd-control-group select,
    .csd-control-group textarea {
        font-size: 16px; /* Previene lo zoom su iOS */
        padding: 10px;
    }

    .csd-range-info {
        display: block;
        margin-left: 0;
        margin-top: 5px;
    }
}

/* Ulteriori ottimizzazioni per schermi molto piccoli */
@media (max-width: 480px) {
    .csd-thumb {
        flex: 0 0 calc(50% - 5px);
        height: 60px;
    }

    h1 {
        font-size: 24px;
    }

    h3 {
        font-size: 18px;
    }

    .csd-canvas-thumb span {
        display: none;
    }

    .csd-canvas-thumb i {
        margin-bottom: 0;
    }
}

/* Ottimizzazioni per tablet in landscape */
@media (min-width: 769px) and (max-width: 1024px) {
    .csd-thumb {
        flex: 0 0 calc(25% - 7.5px);
    }

    .csd-control-row {
        flex-wrap: wrap;
    }

    .csd-control-item {
        flex: 0 0 calc(50% - 7.5px);
    }

    .csd-alignment,
    .csd-letter-spacing {
        flex: 0 0 100%;
    }
}

/* Fix per touch devices */
@media (hover: none) and (pointer: coarse) {
    .csd-align-btn,
    .csd-thumb,
    .csd-icon,
    .csd-actions button {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
    }
}

/* ===== EFFETTI 3D PER STENCIL ===== */
.stencil-3d-container {
    position: relative;
    display: inline-block;
}

.stencil-3d-shadow {
    position: absolute;
    top: 3px;
    left: 3px;
    filter: blur(2px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

.stencil-3d-highlight {
    position: absolute;
    top: -1px;
    left: -1px;
    filter: brightness(1.2);
    opacity: 0.08;
    z-index: 1;
    pointer-events: none;
}

/* Effetto 3D per SVG stencil - Ombra super sfumata e proporzionale */
.stencil-svg-3d {
    filter: drop-shadow(0 0 0 transparent);
    position: relative;
    transition: all 0.3s ease;
}

.stencil-svg-3d::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.03);
    border-radius: inherit;
    z-index: -1;
    filter: blur(3px);
    transform: scale(1.02);
    transition: all 0.3s ease;
}

.stencil-svg-3d:hover::after {
    top: 4px;
    left: 4px;
    background: rgba(0,0,0,0.05);
    filter: blur(6px);
    transform: scale(1.04);
}

/* Canvas 3D Effect - Ombra super sfumata */
canvas.stencil-3d-canvas {
    position: relative;
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.02),
        0 4px 8px rgba(0,0,0,0.03),
        0 6px 12px rgba(0,0,0,0.02),
        0 8px 16px rgba(0,0,0,0.01);
    transition: box-shadow 0.3s ease;
}

canvas.stencil-3d-canvas:hover {
    box-shadow: 
        0 3px 6px rgba(0,0,0,0.03),
        0 6px 12px rgba(0,0,0,0.04),
        0 9px 18px rgba(0,0,0,0.03),
        0 12px 24px rgba(0,0,0,0.02);
}

/* Effetto materiale per lo stencil */
.stencil-material-effect {
    position: relative;
}

.stencil-material-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        rgba(255,255,255,0.1) 0%, 
        rgba(255,255,255,0.05) 25%,
        rgba(0,0,0,0.02) 50%,
        rgba(0,0,0,0.05) 75%,
        rgba(0,0,0,0.05) 100%);
    pointer-events: none;
    z-index: 2;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.stencil-material-effect:hover::before {
    opacity: 0.5;
}

/* Animazione per effetto depth */
@keyframes stencil-depth-pulse {
    0% { 
        filter: drop-shadow(3px 3px 6px rgba(0,0,0,0.06)); 
    }
    50% { 
        filter: drop-shadow(4px 4px 8px rgba(0,0,0,0.08)); 
    }
    100% { 
        filter: drop-shadow(3px 3px 6px rgba(0,0,0,0.06)); 
    }
}

.stencil-3d-active {
    animation: stencil-depth-pulse 2s infinite ease-in-out;
}

/* PNG Download Button */
#csd-download-png {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    color: white !important;
    transition: all 0.3s ease;
}

#csd-download-png:hover {
    background: linear-gradient(135deg, #218838, #1ba085) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

#csd-download-png:disabled {
    background: #6c757d !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Tech Message - Messaggio tecnici nella parte inferiore del canvas */
.csd-tech-message {
    position: absolute;
    bottom: 7px;
    background: rgba(255, 255, 255, 0.92);
    color: #333;
    padding: 4px 10px;
    font-size: 11px;
    line-height: 1.4;
    text-align: center;
    z-index: 8;
    transition: opacity 0.3s ease;
}

.csd-tech-message i {
    color: #4ecdc4;
    margin-right: 6px;
    font-size: 10px;
}

.csd-tech-message:hover {
    background: rgba(255, 255, 255, 0.95);
}

.csd-tech-message .csd-tooltip-trigger {
    margin-left: 6px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.csd-tech-message .csd-tooltip-trigger:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Icons Container */
.csd-icons {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 998;
    padding: 8px;
    backdrop-filter: blur(10px);
}

/* Global Info Icon - Icona info globale in alto a sinistra del canvas */
.csd-global-info-icon {
    cursor: pointer;
    border-radius: 50%;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.csd-global-info-icon:hover {
    transform: translateY(-2px);
}

.csd-global-info-icon svg {
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.05));
}

.csd-global-info-icon:hover svg {
    transform: scale(1.1);
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.08));
}

/* Animazione pulse subtile */
@keyframes info-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.csd-global-info-icon svg {
    animation: info-pulse 3s ease-in-out infinite;
}

.csd-global-info-icon:hover svg {
    animation: none;
}

/* Classe per nascondere l'icona quando disabilitata */
.csd-global-info-icon.tooltip-disabled {
    display: none !important;
}

/* Media query per mobile - messaggio più compatto */
@media (max-width: 768px) {
    .csd-tech-message {
        font-size: 10px;
        padding: 6px 10px;
        bottom: 5px;
        left: 5px;
        right: 5px;
    }
    
    .csd-tech-message i {
        font-size: 9px;
        margin-right: 4px;
    }
}