/* App Colorazione Base */
.coloring-app-wrapper {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.coloring-app {
    display: flex;
    gap: 20px;
    max-width: 100%;
    margin: 0 auto;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.toolbar {
    width: 250px;
    min-width: 250px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.toolbar h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #333;
}

.color-picker, 
.brush-size, 
.tools, 
.actions {
    margin-bottom: 25px;
}

.color-picker label,
.brush-size label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.color-input {
    width: 100%;
    height: 45px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
}

.preset-colors {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.color-btn {
    width: 100%;
    height: 45px;
    border: 3px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-btn:hover {
    transform: scale(1.05);
    border-color: #999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.brush-size-input {
    width: 100%;
    margin: 10px 0;
}

.size-value {
    font-weight: 600;
    color: #333;
}

.tool-btn,
.action-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 10px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.tool-btn:hover,
.action-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.tool-btn.active {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.action-btn {
    background: #2196F3;
    color: white;
    border-color: #2196F3;
}

.action-btn:hover {
    background: #0b7dda;
    border-color: #0b7dda;
}

.canvas-container {
    flex: 1;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.coloring-canvas {
    display: block;
    cursor: crosshair;
    max-width: 100%;
    height: auto;
}

/* Galleria selezione immagini */
.coloring-gallery-wrapper {
    max-width: 1200px;
    margin: 20px auto;
}

.coloring-gallery {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.coloring-gallery h3 {
    text-align: center;
    margin: 0 0 30px 0;
    font-size: 24px;
    color: #333;
}

.gallery-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.gallery-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.gallery-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.gallery-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.gallery-item {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    background: #f8f9fa;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    border-color: #4CAF50;
}

.gallery-item.selected {
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.3);
}

.gallery-thumbnail {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-thumbnail {
    opacity: 0.8;
}

.gallery-item-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.gallery-item::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

.gallery-item.selected::after {
    opacity: 1;
    transform: scale(1);
}

.back-to-gallery {
    display: inline-block;
    margin-bottom: 20px;
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s ease;
}

.back-to-gallery:hover {
    background: #5a6268;
}

/* Responsive */
@media (max-width: 768px) {
    .coloring-app {
        flex-direction: column;
    }
    
    .toolbar {
        width: 100%;
    }
    
    .preset-colors {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .gallery-grid.columns-3,
    .gallery-grid.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-grid.columns-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr !important;
    }
}
/* Pulsanti Undo/Redo */
.undo-btn,
.redo-btn {
    background: #9C27B0 !important;
    border-color: #9C27B0 !important;
}

.undo-btn:hover:not(:disabled),
.redo-btn:hover:not(:disabled) {
    background: #7B1FA2 !important;
    border-color: #7B1FA2 !important;
}

.undo-btn:disabled,
.redo-btn:disabled {
    background: #ccc !important;
    border-color: #ccc !important;
    cursor: not-allowed;
    opacity: 0.5;
}
/* Zoom e Pan Controls */
.zoom-controls {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.zoom-controls .tool-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
}

/* Layer Controls */
.layer-controls {
    margin-bottom: 20px;
}

.add-layer-btn {
    width: 100%;
    margin-bottom: 10px;
}

.layers-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.layer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: all 0.2s ease;
}

.layer-item:hover {
    background: #e9ecef;
}

.layer-item.active {
    background: #4CAF50;
    color: white;
}

.layer-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
}

.layer-delete {
    background: #ff5252;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s ease;
}

.layer-delete:hover {
    background: #e53935;
}

.eyedropper-btn {
    width: 100%;
}
