/* ========================================
   STYLES POUR L'ATELIER DE DESSIN AVANCÉ
   ======================================== */

.drawing-studio-advanced {
    display: grid;
    grid-template-areas: 
        "toolbar toolbar toolbar"
        "sidebar canvas layers";
    grid-template-columns: 200px 1fr 150px;
    grid-template-rows: auto 1fr;
    gap: 15px;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(240, 147, 251, 0.3);
    min-height: 700px;
    color: white;
}

/* Barre d'outils principale */
.toolbar-main {
    grid-area: toolbar;
    display: flex;
    gap: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.tool-section h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    opacity: 0.9;
}

.tool-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tool-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.tool-btn.active {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

/* Palette de couleurs */
.color-palette {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#color-picker {
    width: 50px;
    height: 30px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.preset-colors {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.color-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.color-btn:hover {
    transform: scale(1.1);
    border-color: white;
}

/* Contrôle de taille */
#brush-size {
    width: 100px;
    margin-bottom: 5px;
}

#size-display {
    font-size: 12px;
    opacity: 0.9;
}

/* Barre latérale avec éléments */
.sidebar-elements {
    grid-area: sidebar;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    overflow-y: auto;
    max-height: 600px;
}

.element-section {
    margin-bottom: 20px;
}

.element-section h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    opacity: 0.9;
}

.character-grid, .object-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.character-btn, .object-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 24px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-btn:hover, .object-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.background-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.bg-btn {
    border: none;
    color: white;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Zone de dessin */
.canvas-area {
    grid-area: canvas;
    background: white;
    border-radius: 15px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.canvas-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.canvas-controls button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.canvas-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#drawing-canvas {
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: crosshair;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Panneau de calques */
.layers-panel {
    grid-area: layers;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.layers-panel h4 {
    margin: 0 0 15px 0;
    font-size: 14px;
    opacity: 0.9;
}

.layer-list {
    margin-bottom: 15px;
}

.layer-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
}

.layer-item:hover {
    background: rgba(255, 255, 255, 0.3);
}

.layer-item.active {
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

.layer-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

#add-layer-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    width: 100%;
}

#add-layer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Animations */
@keyframes toolSelect {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.tool-btn.active {
    animation: toolSelect 0.3s ease;
}

/* Responsive */
@media (max-width: 1200px) {
    .drawing-studio-advanced {
        grid-template-areas: 
            "toolbar"
            "canvas"
            "sidebar"
            "layers";
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto;
    }
    
    .toolbar-main {
        flex-direction: column;
        gap: 15px;
    }
    
    .sidebar-elements {
        max-height: 300px;
    }
    
    .character-grid, .object-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .background-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .drawing-studio-advanced {
        padding: 10px;
        gap: 10px;
    }
    
    .toolbar-main {
        padding: 10px;
    }
    
    .tool-buttons {
        justify-content: center;
    }
    
    .tool-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    #drawing-canvas {
        max-width: 100%;
        height: auto;
    }
    
    .character-grid, .object-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .character-btn, .object-btn {
        font-size: 20px;
        padding: 8px;
    }
}

/* Effets spéciaux */
.drawing-sparkle {
    position: absolute;
    pointer-events: none;
    font-size: 20px;
    animation: sparkle 1s ease-out forwards;
}

@keyframes sparkle {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0;
    }
}

/* Message de sauvegarde */
.drawing-message {
    animation: messagePopIn 0.3s ease;
}

@keyframes messagePopIn {
    from {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

