/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #2d3748;
}

/* Main app container */
.app-container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 360px;
    background: rgba(255, 255, 255, 0.9);
    padding: 30px 25px;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tool-section {
    margin-bottom: 30px;
}

.tool-section h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #718096;
    margin-bottom: 15px;
}

/* Color palette */
.color-palette {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.color-btn {
    width: 45px;
    height: 45px;
    border: 3px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.color-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.color-btn.active {
    border-color: #4a5568;
    transform: scale(1.05);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

/* Custom color picker */
.custom-color-picker {
    width: 100%;
    height: 45px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    background: white;
}

/* Tool buttons */
.tool-btn {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 8px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tool-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tool-btn.secondary {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.tool-btn.secondary:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

/* Grid size selector */
#grid-size {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

/* Canvas container */
.canvas-container {
    flex: 1;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.canvas-header {
    margin-bottom: 20px;
}

.grid-toggle {
    padding: 10px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    color: #4a5568;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.grid-toggle:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

/* Pixel grid */
.pixel-grid {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 1px;
    background: #e2e8f0;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    background-clip: padding-box;
}

.pixel {
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.1s ease;
}

.pixel:hover {
    transform: scale(1.1);
    z-index: 10;
    position: relative;
}

/* Responsive design */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        border-radius: 16px;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .color-palette {
        grid-template-columns: repeat(6, 1fr);
    }

    .pixel-grid {
        grid-template-columns: repeat(16, 1fr);
    }

    .pixel {
        width: 15px;
        height: 15px;
    }
}

@media (max-width: 480px) {
    .pixel-grid {
        grid-template-columns: repeat(12, 1fr);
    }

    .pixel {
        width: 12px;
        height: 12px;
    }

    .canvas-container {
        padding: 20px;
    }
}
