/* ============================================================
   ESTUDIO DE ARTE RORRO - ESTILOS PROFESIONALES (2026)
   ============================================================ */

/* 1. Reset y Variables */
:root {
    --primary-pink: #E91E63;
    --dark-pink: #C2185B;
    --success-green: #4CAF50;
    --bg-light: #F8F9FA;
    --border-gray: #DDDDDD;
    --white: #FFFFFF;
    --shadow: 0 8px 30px rgba(0,0,0,0.12);
}

#art-studio {
    max-width: 1100px;
    margin: 20px auto;
    background: var(--white);
    border-radius: 25px;
    box-shadow: var(--shadow);
    padding: 25px;
    font-family: 'Verdana', sans-serif;
    user-select: none; /* Evita selección de texto al dibujar */
}

/* 2. Barra Superior de Acciones */
.canvas-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
    flex-wrap: wrap;
}

.action-group {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border-gray);
    background: var(--white);
    color: #444;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.action-btn:hover { background: var(--bg-light); transform: translateY(-2px); }
.delete-btn:hover { color: #f44336; border-color: #f44336; }

/* Controles de Zoom */
.zoom-controls {
    display: flex;
    align-items: center;
    background: var(--bg-light);
    padding: 4px 15px;
    border-radius: 50px;
    border: 1px solid var(--border-gray);
    gap: 12px;
}

#zoomPercent {
    font-size: 13px;
    font-weight: bold;
    min-width: 45px;
    text-align: center;
    color: #666;
}

/* Botón Guardar */
.btn-save {
    background: var(--success-green);
    color: white;
    border: none;
    padding: 0 20px;
    height: 42px;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 0 #388E3C;
    transition: all 0.1s active;
}

.btn-save:active { transform: translateY(3px); box-shadow: none; }

/* 3. Contenedor del Estudio (Columnas) */
.studio-container {
    display: flex;
    gap: 20px;
}

.palette-column, .tools-column {
    width: 60px;
    flex-shrink: 0;
}

.canvas-column {
    flex-grow: 1;
}

/* 4. Canvas Wrapper (IMPORTANTE PARA EL ZOOM) */
.canvas-wrapper {
    width: 100%;
    position: relative;
    overflow: hidden; /* Corta el dibujo cuando se escala */
    border: 5px solid var(--primary-pink);
    border-radius: 18px;
    background: #fff;
    line-height: 0;
    touch-action: none; /* Crucial para móviles */
}

#drawingCanvas {
    width: 100%;
    height: auto;
    display: block;
    cursor: crosshair;
    transition: transform 0.2s ease-out; /* Suaviza el Zoom */
    transform-origin: center center;
}

/* 5. Paleta de Colores */
.color-palette-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.color-swatch.active {
    border-color: #333;
    transform: scale(1.15);
}

.custom-color-label {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

#color {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* 6. Herramientas */
.tool-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.tool-btn {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    border: 1px solid #ddd;
    background: var(--white);
    cursor: pointer;
    font-size: 20px;
    color: #555;
    transition: all 0.2s;
}

.tool-btn.active {
    background: var(--primary-pink);
    color: white;
    border-color: var(--primary-pink);
    box-shadow: 0 5px 15px rgba(233, 30, 99, 0.3);
}

/* Animación Pincel Mágico */
.magic-tool.active {
    background: linear-gradient(45deg, #ff0000, #ffeb3b, #2196f3, #4caf50, #ff0000);
    background-size: 400%;
    animation: rainbow 8s linear infinite;
    border: none;
}

@keyframes rainbow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Control de Grosor */
.size-control-slider {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

input[type=range] {
    writing-mode: bt-lr; /* Orientación para algunos navegadores */
    appearance: none;
    width: 120px;
    height: 8px;
    background: #ddd;
    border-radius: 5px;
    outline: none;
    transform: rotate(-90deg); /* Lo hace vertical */
    margin: 60px 0;
}

/* 7. Sellos (Stamps) */
.stamps-container {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px dashed #eee;
    text-align: center;
}

.label-stamps {
    font-size: 13px;
    font-weight: bold;
    color: var(--primary-pink);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stamps-list {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.stamp-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: 2px solid var(--primary-pink);
    background: white;
    color: var(--primary-pink);
    font-size: 24px;
    cursor: pointer;
    transition: 0.2s;
}

.stamp-btn.active {
    background: var(--primary-pink);
    color: white;
    transform: scale(1.1);
}

.label-tool-mini {
    font-size: 10px;
    color: #999;
    font-weight: bold;
    margin-bottom: 5px;
    text-transform: uppercase;
}

/* ============================================================
   RESPONSIVIDAD (MÓVILES)
   ============================================================ */

@media (max-width: 768px) {
    #art-studio { padding: 15px; border-radius: 0; margin: 0; }
    
    .studio-container { flex-direction: column; }

    .palette-column, .tools-column {
        width: 100%;
        order: 2;
    }

    .color-palette-box {
        flex-direction: row;
        overflow-x: auto;
        padding: 10px 0;
        width: 100%;
        justify-content: flex-start;
    }

    .tool-box {
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
        padding: 10px 0;
    }

    .size-control-slider {
        flex-direction: row;
        width: 100%;
    }

    input[type=range] {
        transform: rotate(0);
        margin: 10px 0;
        width: 100%;
    }

    .canvas-actions-bar {
        justify-content: center;
    }
}