* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background-color: #f5f5f5;
    transition: background-color 0.3s ease;
}

body.dark-mode {
    background-color: #1a1a1a;
}

.app {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* Toggle de tema */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.theme-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.theme-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.dark-mode .theme-btn {
    background: rgba(0, 0, 0, 0.8);
    color: white;
}

/* Paleta de herramientas */
.palette {
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    z-index: 100;
    min-width: 200px;
    transition: all 0.3s ease;
}

.dark-mode .palette {
    background: rgba(0, 0, 0, 0.9);
    color: white;
}

.tool-section {
    margin-bottom: 20px;
}

.tool-section:last-child {
    margin-bottom: 0;
}

.tool-section h3 {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dark-mode .tool-section h3 {
    color: #ccc;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.tool-btn {
    background: transparent;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.tool-btn:hover {
    border-color: #007acc;
    background: rgba(0, 122, 204, 0.1);
    transform: translateY(-1px);
}

.tool-btn.active {
    border-color: #007acc;
    background: #007acc;
    color: white;
}

.dark-mode .tool-btn {
    border-color: #444;
    color: #ccc;
}

.dark-mode .tool-btn:hover {
    border-color: #007acc;
    background: rgba(0, 122, 204, 0.2);
}

.dark-mode .tool-btn.active {
    background: #007acc;
    color: white;
}

/* Tamaños de pincel */
.brush-sizes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.brush-size {
    background: transparent;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
}

.brush-preview {
    background: #666;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.brush-size:hover {
    border-color: #007acc;
    background: rgba(0, 122, 204, 0.1);
}

.brush-size.active {
    border-color: #007acc;
    background: #007acc;
    color: white;
}

.dark-mode .brush-size {
    border-color: #444;
    color: #ccc;
}

.dark-mode .brush-size:hover {
    border-color: #007acc;
    background: rgba(0, 122, 204, 0.2);
}

.dark-mode .brush-size.active {
    background: #007acc;
    color: white;
}

.dark-mode .brush-preview {
    background: #ccc;
}

.brush-size.active .brush-preview {
    background: white;
}

.dark-mode .brush-size.active .brush-preview {
    background: white;
}

/* Paleta de colores */
.color-palette {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-row {
    display: flex;
    gap: 8px;
}

.color-btn {
    width: 30px;
    height: 30px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-btn.active {
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.3);
}

/* Canvas container */
.canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: white;
    transition: background-color 0.3s ease;
}

.dark-mode .canvas-container {
    background: #2a2a2a;
}

#canvas {
    display: block;
    cursor: crosshair;
    transition: cursor 0.2s ease;
}

#canvas.drawing {
    cursor: crosshair;
}

#canvas.selecting {
    cursor: crosshair;
}

#canvas.text {
    cursor: text;
}

#canvas.eraser {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><circle cx="10" cy="10" r="8" fill="white" stroke="black" stroke-width="1"/></svg>') 10 10, auto;
}

/* Input de texto */
.text-input {
    position: fixed;
    border: 2px solid #007acc;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 16px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.9);
    color: black;
    outline: none;
    z-index: 1000;
    min-width: 100px;
    backdrop-filter: blur(5px);
}

.dark-mode .text-input {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-color: #007acc;
}

/* Responsive */
@media (max-width: 768px) {
    .palette {
        left: 10px;
        right: 10px;
        top: 20px;
        transform: none;
        min-width: auto;
        padding: 15px;
    }
    
    .tool-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .brush-sizes {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .color-palette {
        flex-direction: row;
    }
    
    .color-row {
        flex-direction: column;
    }
}
